max_stars_repo_path
stringlengths
4
261
max_stars_repo_name
stringlengths
6
106
max_stars_count
int64
0
38.8k
id
stringlengths
1
6
text
stringlengths
7
1.05M
src/fltk-widgets-valuators.adb
micahwelf/FLTK-Ada
1
22325
<gh_stars>1-10 with Interfaces.C.Strings, System; use type System.Address; package body FLTK.Widgets.Valuators is procedure valuator_set_draw_hook (W, D : in System.Address); pragma Import (C, valuator_set_draw_hook, "valuator_set_draw_hook"); pragma Inline (valuator_set_draw_hook); procedure valuator_set_handle_hook (W, H : in System.Address); pragma Import (C, valuator_set_handle_hook, "valuator_set_handle_hook"); pragma Inline (valuator_set_handle_hook); function new_fl_valuator (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_valuator, "new_fl_valuator"); pragma Inline (new_fl_valuator); procedure free_fl_valuator (V : in System.Address); pragma Import (C, free_fl_valuator, "free_fl_valuator"); pragma Inline (free_fl_valuator); function fl_valuator_clamp (V : in System.Address; D : in Interfaces.C.double) return Interfaces.C.double; pragma Import (C, fl_valuator_clamp, "fl_valuator_clamp"); pragma Inline (fl_valuator_clamp); function fl_valuator_round (V : in System.Address; D : in Interfaces.C.double) return Interfaces.C.double; pragma Import (C, fl_valuator_round, "fl_valuator_round"); pragma Inline (fl_valuator_round); function fl_valuator_increment (V : in System.Address; D : in Interfaces.C.double; S : in Interfaces.C.int) return Interfaces.C.double; pragma Import (C, fl_valuator_increment, "fl_valuator_increment"); pragma Inline (fl_valuator_increment); function fl_valuator_get_minimum (V : in System.Address) return Interfaces.C.double; pragma Import (C, fl_valuator_get_minimum, "fl_valuator_get_minimum"); pragma Inline (fl_valuator_get_minimum); procedure fl_valuator_set_minimum (V : in System.Address; D : in Interfaces.C.double); pragma Import (C, fl_valuator_set_minimum, "fl_valuator_set_minimum"); pragma Inline (fl_valuator_set_minimum); function fl_valuator_get_maximum (V : in System.Address) return Interfaces.C.double; pragma Import (C, fl_valuator_get_maximum, "fl_valuator_get_maximum"); pragma Inline (fl_valuator_get_maximum); procedure fl_valuator_set_maximum (V : in System.Address; D : in Interfaces.C.double); pragma Import (C, fl_valuator_set_maximum, "fl_valuator_set_maximum"); pragma Inline (fl_valuator_set_maximum); function fl_valuator_get_step (V : in System.Address) return Interfaces.C.double; pragma Import (C, fl_valuator_get_step, "fl_valuator_get_step"); pragma Inline (fl_valuator_get_step); procedure fl_valuator_set_step (V : in System.Address; T : in Interfaces.C.double); pragma Import (C, fl_valuator_set_step, "fl_valuator_set_step"); pragma Inline (fl_valuator_set_step); function fl_valuator_get_value (V : in System.Address) return Interfaces.C.double; pragma Import (C, fl_valuator_get_value, "fl_valuator_get_value"); pragma Inline (fl_valuator_get_value); procedure fl_valuator_set_value (V : in System.Address; D : in Interfaces.C.double); pragma Import (C, fl_valuator_set_value, "fl_valuator_set_value"); pragma Inline (fl_valuator_set_value); procedure fl_valuator_bounds (V : in System.Address; A, B : in Interfaces.C.double); pragma Import (C, fl_valuator_bounds, "fl_valuator_bounds"); pragma Inline (fl_valuator_bounds); procedure fl_valuator_precision (V : in System.Address; D : in Interfaces.C.int); pragma Import (C, fl_valuator_precision, "fl_valuator_precision"); pragma Inline (fl_valuator_precision); procedure fl_valuator_range (V : in System.Address; A, B : in Interfaces.C.double); pragma Import (C, fl_valuator_range, "fl_valuator_range"); pragma Inline (fl_valuator_range); function fl_valuator_handle (V : in System.Address; E : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_valuator_handle, "fl_valuator_handle"); pragma Inline (fl_valuator_handle); procedure Finalize (This : in out Valuator) is begin if This.Void_Ptr /= System.Null_Address and then This in Valuator'Class then free_fl_valuator (This.Void_Ptr); This.Void_Ptr := System.Null_Address; end if; Finalize (Widget (This)); end Finalize; package body Forge is function Create (X, Y, W, H : in Integer; Text : in String) return Valuator is begin return This : Valuator do This.Void_Ptr := new_fl_valuator (Interfaces.C.int (X), Interfaces.C.int (Y), Interfaces.C.int (W), Interfaces.C.int (H), Interfaces.C.To_C (Text)); fl_widget_set_user_data (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); valuator_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); valuator_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; end Forge; function Clamp (This : in Valuator; Input : in Long_Float) return Long_Float is begin return Long_Float (fl_valuator_clamp (This.Void_Ptr, Interfaces.C.double (Input))); end Clamp; function Round (This : in Valuator; Input : in Long_Float) return Long_Float is begin return Long_Float (fl_valuator_round (This.Void_Ptr, Interfaces.C.double (Input))); end Round; function Increment (This : in Valuator; Input : in Long_Float; Step : in Integer) return Long_Float is begin return Long_Float (fl_valuator_increment (This.Void_Ptr, Interfaces.C.double (Input), Interfaces.C.int (Step))); end Increment; function Get_Minimum (This : in Valuator) return Long_Float is begin return Long_Float (fl_valuator_get_minimum (This.Void_Ptr)); end Get_Minimum; procedure Set_Minimum (This : in out Valuator; To : in Long_Float) is begin fl_valuator_set_minimum (This.Void_Ptr, Interfaces.C.double (To)); end Set_Minimum; function Get_Maximum (This : in Valuator) return Long_Float is begin return Long_Float (fl_valuator_get_maximum (This.Void_Ptr)); end Get_Maximum; procedure Set_Maximum (This : in out Valuator; To : in Long_Float) is begin fl_valuator_set_maximum (This.Void_Ptr, Interfaces.C.double (To)); end Set_Maximum; function Get_Step (This : in Valuator) return Long_Float is begin return Long_Float (fl_valuator_get_step (This.Void_Ptr)); end Get_Step; procedure Set_Step (This : in out Valuator; To : in Long_Float) is begin fl_valuator_set_step (This.Void_Ptr, Interfaces.C.double (To)); end Set_Step; function Get_Value (This : in Valuator) return Long_Float is begin return Long_Float (fl_valuator_get_value (This.Void_Ptr)); end Get_Value; procedure Set_Value (This : in out Valuator; To : in Long_Float) is begin fl_valuator_set_value (This.Void_Ptr, Interfaces.C.double (To)); end Set_Value; procedure Set_Bounds (This : in out Valuator; Min, Max : in Long_Float) is begin fl_valuator_bounds (This.Void_Ptr, Interfaces.C.double (Min), Interfaces.C.double (Max)); end Set_Bounds; procedure Set_Precision (This : in out Valuator; To : in Integer) is begin fl_valuator_precision (This.Void_Ptr, Interfaces.C.int (To)); end Set_Precision; procedure Set_Range (This : in out Valuator; Min, Max : in Long_Float) is begin fl_valuator_range (This.Void_Ptr, Interfaces.C.double (Min), Interfaces.C.double (Max)); end Set_Range; function Handle (This : in out Valuator; Event : in Event_Kind) return Event_Outcome is begin return Event_Outcome'Val (fl_valuator_handle (This.Void_Ptr, Event_Kind'Pos (Event))); end Handle; end FLTK.Widgets.Valuators;
src/Pi/Cp.agda
mietek/formal-logic
26
16797
<gh_stars>10-100 -- Classical propositional logic, PHOAS approach, initial encoding module Pi.Cp where -- Types infixl 2 _&&_ infixl 1 _||_ infixr 0 _=>_ data Ty : Set where UNIT : Ty _=>_ : Ty -> Ty -> Ty _&&_ : Ty -> Ty -> Ty _||_ : Ty -> Ty -> Ty FALSE : Ty infixr 0 _<=>_ _<=>_ : Ty -> Ty -> Ty a <=> b = (a => b) && (b => a) NOT : Ty -> Ty NOT a = a => FALSE TRUE : Ty TRUE = FALSE => FALSE -- Context and truth judgement Cx : Set1 Cx = Ty -> Set isTrue : Ty -> Cx -> Set isTrue a tc = tc a -- Terms module Cp where infixl 1 _$_ data Tm (tc : Cx) : Ty -> Set where var : forall {a} -> isTrue a tc -> Tm tc a lam' : forall {a b} -> (isTrue a tc -> Tm tc b) -> Tm tc (a => b) _$_ : forall {a b} -> Tm tc (a => b) -> Tm tc a -> Tm tc b pair' : forall {a b} -> Tm tc a -> Tm tc b -> Tm tc (a && b) fst : forall {a b} -> Tm tc (a && b) -> Tm tc a snd : forall {a b} -> Tm tc (a && b) -> Tm tc b left : forall {a b} -> Tm tc a -> Tm tc (a || b) right : forall {a b} -> Tm tc b -> Tm tc (a || b) case' : forall {a b c} -> Tm tc (a || b) -> (isTrue a tc -> Tm tc c) -> (isTrue b tc -> Tm tc c) -> Tm tc c abort' : forall {a} -> (isTrue (NOT a) tc -> Tm tc FALSE) -> Tm tc a lam'' : forall {tc a b} -> (Tm tc a -> Tm tc b) -> Tm tc (a => b) lam'' f = lam' \x -> f (var x) case'' : forall {tc a b c} -> Tm tc (a || b) -> (Tm tc a -> Tm tc c) -> (Tm tc b -> Tm tc c) -> Tm tc c case'' xy f g = case' xy (\x -> f (var x)) (\y -> g (var y)) abort'' : forall {tc a} -> (Tm tc (NOT a) -> Tm tc FALSE) -> Tm tc a abort'' f = abort' \na -> f (var na) syntax lam'' (\a -> b) = lam a => b syntax pair' x y = [ x , y ] syntax case'' xy (\x -> z1) (\y -> z2) = case xy of x => z1 or y => z2 syntax abort'' (\x -> y) = abort x => y Thm : Ty -> Set1 Thm a = forall {tc} -> Tm tc a open Cp public
oeis/265/A265280.asm
neoneye/loda-programs
11
165695
<gh_stars>10-100 ; A265280: Binary representation of the n-th iteration of the "Rule 86" elementary cellular automaton starting with a single ON (black) cell. ; Submitted by <NAME> ; 1,111,10011,1111011,100010011,11101111011,1001000010011,111111001111011,10000011100010011,1110001001101111011,100110111101000010011,11110100001011001111011,1000101100110011100010011,111011001110111001101111011,10010011100100011101000010011,1111111001111101001011001111011,100000011100001011110011100010011,11100001001100110000111001101111011,1001100111101110110010011101000010011,111101110001000100111111001011001111011,10001000110111011110000011110011100010011 seq $0,245549 ; State of one-dimensional cellular automaton 'sigma' (Rule 30): 000,001,010,011,100,101,110,111 -> 0,0,0,1,1,1,1,0 at generation n, regarded as a binary number. seq $0,4086 ; Read n backwards (referred to as R(n) in many sequences).
src/sdl-events-windows.ads
treggit/sdlada
89
11589
<reponame>treggit/sdlada<gh_stars>10-100 -------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2020, <NAME> -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- -- SDL.Events.Windows -- -- Window specific events. -------------------------------------------------------------------------------------------------------------------- with SDL.Video.Windows; package SDL.Events.Windows is pragma Preelaborate; -- Window events. Window : constant Event_Types := 16#0000_0200#; System_Window_Manager : constant Event_Types := Window + 1; type Window_Event_ID is (None, Shown, Hidden, Exposed, Moved, Resized, Size_Changed, Minimised, Maximised, Restored, Enter, Leave, Focus_Gained, Focus_Lost, Close, Take_Focus, Hit_Test) with Convention => C; type Window_Events is record Event_Type : Event_Types; -- Will be set to Window. Time_Stamp : Time_Stamps; ID : SDL.Video.Windows.ID; Event_ID : Window_Event_ID; Padding_1 : Padding_8; Padding_2 : Padding_8; Padding_3 : Padding_8; Data_1 : Interfaces.Integer_32; Data_2 : Interfaces.Integer_32; end record with Convention => C; private for Window_Events use record Event_Type at 0 * SDL.Word range 0 .. 31; Time_Stamp at 1 * SDL.Word range 0 .. 31; ID at 2 * SDL.Word range 0 .. 31; Event_ID at 3 * SDL.Word range 0 .. 7; Padding_1 at 3 * SDL.Word range 8 .. 15; Padding_2 at 3 * SDL.Word range 16 .. 23; Padding_3 at 3 * SDL.Word range 24 .. 31; Data_1 at 4 * SDL.Word range 0 .. 31; Data_2 at 5 * SDL.Word range 0 .. 31; end record; end SDL.Events.Windows;
nat.agda
heades/AUGL
0
12351
module nat where open import product open import bool open import maybe open import eq ---------------------------------------------------------------------- -- datatypes ---------------------------------------------------------------------- data ℕ : Set where zero : ℕ suc : ℕ → ℕ nat = ℕ ---------------------------------------------------------------------- -- syntax ---------------------------------------------------------------------- infixl 10 _*_ infixl 9 _+_ _∸_ infixl 8 _<_ _=ℕ_ _≤_ _>_ _≥_ -- pragmas to get decimal notation: {-# BUILTIN NATURAL ℕ #-} ---------------------------------------------------------------------- -- operations ---------------------------------------------------------------------- --------------------------------------- -- basic arithmetic operations --------------------------------------- _+_ : ℕ → ℕ → ℕ zero + n = n suc m + n = suc (m + n) {-# BUILTIN NATPLUS _+_ #-} _*_ : ℕ → ℕ → ℕ zero * n = zero suc m * n = n + (m * n) {-# BUILTIN NATTIMES _*_ #-} pred : ℕ → ℕ pred 0 = 0 pred (suc n) = n _∸_ : ℕ → ℕ → ℕ m ∸ zero = m zero ∸ suc n = zero suc m ∸ suc n = m ∸ n -- see nat-division.agda for division function {-# BUILTIN NATMINUS _∸_ #-} square : ℕ → ℕ square x = x * x -------------------------------------------------- -- comparisons -------------------------------------------------- _<_ : ℕ → ℕ → 𝔹 0 < 0 = ff 0 < (suc y) = tt (suc x) < (suc y) = x < y (suc x) < 0 = ff _=ℕ_ : ℕ → ℕ → 𝔹 0 =ℕ 0 = tt suc x =ℕ suc y = x =ℕ y _ =ℕ _ = ff _≤_ : ℕ → ℕ → 𝔹 x ≤ y = (x < y) || x =ℕ y _>_ : ℕ → ℕ → 𝔹 a > b = b < a _≥_ : ℕ → ℕ → 𝔹 a ≥ b = b ≤ a min : ℕ → ℕ → ℕ min x y = if x < y then x else y max : ℕ → ℕ → ℕ max x y = if x < y then y else x data compare-t : Set where compare-lt : compare-t compare-eq : compare-t compare-gt : compare-t compare : ℕ → ℕ → compare-t compare 0 0 = compare-eq compare 0 (suc y) = compare-lt compare (suc x) 0 = compare-gt compare (suc x) (suc y) = compare x y iszero : ℕ → 𝔹 iszero 0 = tt iszero _ = ff parity : ℕ → 𝔹 parity 0 = ff parity (suc x) = ~ (parity x) _pow_ : ℕ → ℕ → ℕ x pow 0 = 1 x pow (suc y) = x * (x pow y) factorial : ℕ → ℕ factorial 0 = 1 factorial (suc x) = (suc x) * (factorial x) is-even : ℕ → 𝔹 is-odd : ℕ → 𝔹 is-even 0 = tt is-even (suc x) = is-odd x is-odd 0 = ff is-odd (suc x) = is-even x
src/API/protypo-api-engine_values-engine_value_vector_wrappers.ads
fintatarta/protypo
0
16624
with Ada.Finalization; with Protypo.Api.Engine_Values.Handlers; with Protypo.Api.Engine_Values.Engine_Value_Vectors; -- -- ## What is this? -- -- This is a wrapper that includes in itself a vector of `Engine_Value`. -- It allows to access the internal vector via the `Vector` function -- that returns a reference. -- -- It implements the `Ambivalent_Interface` and it exports the usual -- access methods -- -- * _indexed_ access to access a specific element of the array -- * _first_, _last_ and _length_ analoguos to the corresponding Ada -- attributes for arrays. -- * _range_ and _iterate_ iterators to run over the array content. -- _range_ iterates over the set of indexes, _iterate_ over the array -- elements -- package Protypo.Api.Engine_Values.Engine_Value_Vector_Wrappers is type Vector_Reference (Ref : access Engine_Value_Vectors.Vector) is limited private with Implicit_Dereference => Ref; type Vector_Handler is new Ada.Finalization.Controlled and Handlers.Ambivalent_Interface with private; type Vector_Handler_Access is access Vector_Handler; overriding function Get (X : Vector_Handler; Index : Engine_Value_Vectors.Vector) return Handler_Value; overriding function Get (X : Vector_Handler; Field : ID) return Handler_Value; overriding function Is_Field (X : Vector_Handler; Field : Id) return Boolean; function Vector (Item : Vector_Handler) return Vector_Reference; private type Vector_Reference (Ref : access Engine_Value_Vectors.Vector) is limited null record; type Vector_Access is access Engine_Value_Vectors.Vector; type Vector_Handler is new Ada.Finalization.Controlled and Handlers.Ambivalent_Interface with record Vect : Vector_Access; end record; overriding procedure Initialize (Object : in out Vector_Handler); -- function Make_Handler return Vector_Handler_Access -- is (new Vector_Handler'(Vect => new Vectors.Vector'(Vectors.Empty_Vector))); function Vector (Item : Vector_Handler) return Vector_Reference is (Vector_Reference'(Ref => Item.Vect)); end Protypo.Api.Engine_Values.Engine_Value_Vector_Wrappers;
src/API/protypo-api-consumers-buffers.ads
fintatarta/protypo
0
28733
<gh_stars>0 with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; package Protypo.Api.Consumers.Buffers is type Buffer (<>) is new Consumer_Interface with private; type Buffer_Access is access Api.Consumers.Buffers.Buffer; function New_Buffer return Buffer_Access; procedure Destroy (Item : in out Buffer_Access); overriding procedure Process (Consumer : in out Buffer; Parameter : String); function Get_Data (Consumer : Buffer) return String; private type Buffer is new Consumer_Interface with record Data : Unbounded_String; end record; end Protypo.Api.Consumers.Buffers;
antlr/multiple-exampples/src/main/antlr/com/mageddo/antlr/parser/stringliteral/StringLiteral.g4
mageddo/java-examples
19
1211
<reponame>mageddo/java-examples<filename>antlr/multiple-exampples/src/main/antlr/com/mageddo/antlr/parser/stringliteral/StringLiteral.g4<gh_stars>10-100 grammar StringLiteral; @header { package com.mageddo.antlr.parser.stringliteral; } json : STRING ; STRING : '"' (ESC | SAFECODEPOINT)* '"' ; fragment ESC : '\\' (["\\/bfnrt]) ; fragment SAFECODEPOINT : ~ ["\\\u0000-\u001F] ; WS : [ \t\n\r] + -> skip ;
programs/oeis/115/A115391.asm
jmorken/loda
1
82255
; A115391: a(0)=0; then a(4*k+1)=a(4*k)+(4*k+1)^2, a(4*k+2)=a(4*k+1)+(4*k+3)^2, a(4*k+3)=a(4*k+2)+(4*k+2)^2, a(4*k+4)=a(4*k+3)+(4*k+4)^2. ; 1,10,14,30,55,104,140,204,285,406,506,650,819,1044,1240,1496,1785,2146,2470,2870,3311,3840,4324,4900,5525,6254,6930,7714,8555,9516,10416,11440,12529,13754,14910,16206,17575,19096,20540,22140,23821,25670,27434,29370,31395,33604,35720,38024,40425,43026,45526,48230,51039,54064,56980,60116,63365,66846,70210,73810,77531,81500,85344,89440,93665,98154,102510,107134,111895,116936,121836,127020,132349,137974,143450,149226,155155,161396,167480,173880,180441,187330,194054,201110,208335,215904,223300,231044,238965,247246,255346,263810,272459,281484,290320,299536,308945,318746,328350,338350,348551,359160,369564,380380,391405,402854,414090,425754,437635,449956,462056,474600,487369,500594,513590,527046,540735,554896,568820,583220,597861,612990,627874,643250,658875,675004,690880,707264,723905,741066,757966,775390,793079,811304,829260,847756,866525,885846,904890,924490,944371,964820,984984,1005720,1026745,1048354,1069670,1091574,1113775,1136576,1159076,1182180,1205589,1229614,1253330,1277666,1302315,1327596,1352560,1378160,1404081,1430650,1456894,1483790,1511015,1538904,1566460,1594684,1623245,1652486,1681386,1710970,1740899,1771524,1801800,1832776,1864105,1896146,1927830,1960230,1992991,2026480,2059604,2093460,2127685,2162654,2197250,2232594,2268315,2304796,2340896,2377760,2415009,2453034,2490670,2529086,2567895,2607496,2646700,2686700,2727101,2768310,2809114,2850730,2892755,2935604,2978040,3021304,3064985,3109506,3153606,3198550,3243919,3290144,3335940,3382596,3429685,3477646,3525170,3573570,3622411,3672140,3721424,3771600,3822225,3873754,3924830,3976814,4029255,4082616,4135516,4189340,4243629,4298854,4353610,4409306,4465475,4522596,4579240,4636840,4694921,4753970,4812534,4872070,4932095,4993104,5053620,5115124,5177125,5240126 mov $4,$0 mov $5,$0 add $5,1 lpb $5 mov $0,$4 sub $5,1 sub $0,$5 mov $3,$0 div $3,2 sub $0,$3 mul $0,2 sub $2,2 add $3,45 mod $3,2 add $3,$0 lpb $0 div $0,$2 pow $3,2 lpe mul $3,2 mov $6,$3 sub $6,2 div $6,2 add $6,1 add $1,$6 lpe
Transynther/x86/_processed/NC/_zr_/i7-7700_9_0x48_notsx.log_21829_1803.asm
ljhsiun2/medusa
9
102004
.global s_prepare_buffers s_prepare_buffers: push %r12 push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0x62b9, %rsi lea addresses_WT_ht+0x1bfb9, %rdi nop nop nop nop nop inc %rdx mov $7, %rcx rep movsw nop and $14836, %r12 pop %rsi pop %rdx pop %rdi pop %rcx pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r15 push %r8 push %r9 push %rbp push %rbx push %rcx // Store lea addresses_WC+0xe3b9, %r15 nop sub $2912, %rcx movw $0x5152, (%r15) nop nop add $17618, %r10 // Store mov $0x6b9, %r8 nop nop nop and $27742, %rbp movl $0x51525354, (%r8) nop nop nop nop nop cmp %r10, %r10 // Faulty Load mov $0x61f3db00000000b9, %r15 nop nop nop nop nop cmp $10702, %r8 mov (%r15), %cx lea oracles, %rbx and $0xff, %rcx shlq $12, %rcx mov (%rbx,%rcx,1), %rcx pop %rcx pop %rbx pop %rbp pop %r9 pop %r8 pop %r15 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_NC', 'congruent': 0}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_WC', 'congruent': 8}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_P', 'congruent': 9}, 'OP': 'STOR'} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_NC', 'congruent': 0}} <gen_prepare_buffer> {'dst': {'same': False, 'congruent': 6, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_normal_ht'}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
oeis/055/A055874.asm
neoneye/loda-programs
11
96457
; A055874: a(n) = largest m such that 1, 2, ..., m divide n. ; 1,2,1,2,1,3,1,2,1,2,1,4,1,2,1,2,1,3,1,2,1,2,1,4,1,2,1,2,1,3,1,2,1,2,1,4,1,2,1,2,1,3,1,2,1,2,1,4,1,2,1,2,1,3,1,2,1,2,1,6,1,2,1,2,1,3,1,2,1,2,1,4,1,2,1,2,1,3,1,2,1,2,1,4,1,2,1,2,1,3,1,2,1,2,1,4,1,2,1,2 mov $2,$0 mov $0,1 mov $1,1 lpb $2 add $0,$1 sub $2,$1 dif $2,$0 mul $2,$0 lpe
programs/oeis/005/A005021.asm
jmorken/loda
1
88148
; A005021: Random walks (binomial transform of A006054). ; 1,5,19,66,221,728,2380,7753,25213,81927,266110,864201,2806272,9112264,29587889,96072133,311945595,1012883066,3288813893,10678716664,34673583028,112584429049,365559363741,1186963827439,3854047383798,12514013318097,40632746115136,131933698050896,428386026881761,1390960692218565,4516420997853155 lpb $0 mov $2,$0 cal $2,94789 ; Number of (s(0), s(1), ..., s(2n+1)) such that 0 < s(i) < 7 and |s(i) - s(i-1)| = 1 for i = 1,2,...,2n+1, s(0) = 1, s(2n+1) = 4. sub $0,1 add $1,$2 lpe add $1,1
_tests/trconvert/antlr2/java.g4
SKalt/Domemtech.Trash
16
5679
/** Java 1.3 Recognizer * * Run 'java Main [-showtree] directory-full-of-java-files' * * [The -showtree option pops up a Swing frame that shows * the AST constructed from the parser.] * * Run 'java Main <directory full of java files>' * * Contributing authors: * <NAME> <EMAIL> * <NAME> <EMAIL> * <NAME> <EMAIL> * <NAME> <EMAIL> * <NAME> <EMAIL> * <NAME> <EMAIL> * <NAME> <EMAIL> * <NAME> <EMAIL> * <NAME> <EMAIL> * * Version 1.00 December 9, 1997 -- initial release * Version 1.01 December 10, 1997 * fixed bug in octal def (0..7 not 0..8) * Version 1.10 August 1998 (parrt) * added tree construction * fixed definition of WS,comments for mac,pc,unix newlines * added unary plus * Version 1.11 (Nov 20, 1998) * Added "shutup" option to turn off last ambig warning. * Fixed inner class def to allow named class defs as statements * synchronized requires compound not simple statement * add [] after builtInType DOT class in primaryExpression * "const" is reserved but not valid..removed from modifiers * Version 1.12 (Feb 2, 1999) * Changed LITERAL_xxx to xxx in tree grammar. * Updated java.g to use tokens {...} now for 2.6.0 (new feature). * * Version 1.13 (Apr 23, 1999) * Didn't have (stat)? for else clause in tree parser. * Didn't gen ASTs for interface extends. Updated tree parser too. * Updated to 2.6.0. * Version 1.14 (Jun 20, 1999) * Allowed final/abstract on local classes. * Removed local interfaces from methods * Put instanceof precedence where it belongs...in relationalExpr * It also had expr not type as arg; fixed it. * Missing ! on SEMI in classBlock * fixed: (expr) + "string" was parsed incorrectly (+ as unary plus). * fixed: didn't like Object[].class in parser or tree parser * Version 1.15 (Jun 26, 1999) * Screwed up rule with instanceof in it. :( Fixed. * Tree parser didn't like (expr).something; fixed. * Allowed multiple inheritance in tree grammar. oops. * Version 1.16 (August 22, 1999) * Extending an interface built a wacky tree: had extra EXTENDS. * Tree grammar didn't allow multiple superinterfaces. * Tree grammar didn't allow empty var initializer: {} * Version 1.17 (October 12, 1999) * ESC lexer rule allowed 399 max not 377 max. * java.tree.g didn't handle the expression of synchronized * statements. * Version 1.18 (August 12, 2001) * Terence updated to Java 2 Version 1.3 by * observing/combining work of <NAME> and Steve * Messick. Handles 1.3 src. Summary: * o primary didn't include boolean.class kind of thing * o constructor calls parsed explicitly now: * see explicitConstructorInvocation * o add strictfp modifier * o missing objBlock after new expression in tree grammar * o merged local class definition alternatives, moved after declaration * o fixed problem with ClassName.super.field * o reordered some alternatives to make things more efficient * o long and double constants were not differentiated from int/float * o whitespace rule was inefficient: matched only one char * o add an examples directory with some nasty 1.3 cases * o made Main.java use buffered IO and a Reader for Unicode support * o supports UNICODE? * Using Unicode charVocabulay makes code file big, but only * in the bitsets at the end. I need to make ANTLR generate * unicode bitsets more efficiently. * Version 1.19 (April 25, 2002) * Terence added in nice fixes by <NAME> concerning floating * constants and problems with super() calls. John did a nice * reorg of the primary/postfix expression stuff to read better * and makes f.g.super() parse properly (it was METHOD_CALL not * a SUPER_CTOR_CALL). Also: * * o "finally" clause was a root...made it a child of "try" * o Added stuff for asserts too for Java 1.4, but *commented out* * as it is not backward compatible. * * Version 1.20 (October 27, 2002) * * Terence ended up reorging <NAME>' stuff to * remove some nondeterminisms and some syntactic predicates. * Note that the grammar is stricter now; e.g., this(...) must * be the first statement. * * Trinary ?: operator wasn't working as array name: * (isBig ? bigDigits : digits)[i]; * * Checked parser/tree parser on source for * Resin-2.0.5, jive-2.1.1, jdk 1.3.1, Lucene, antlr 2.7.2a4, * and the 110k-line jGuru server source. * * Version 1.21 (October 17, 2003) * Fixed lots of problems including: * <NAME>: add typeDefinition to interfaceBlock in java.tree.g * He found a problem/fix with floating point that start with 0 * Ray also fixed problem that (int.class) was not recognized. * Thorsten van Ellen noticed that \n are allowed incorrectly in strings. * TJP fixed CHAR_LITERAL analogously. * * This grammar is in the PUBLIC DOMAIN */ grammar JavaRecognizer; // Compilation Unit: In Java, this is a single file. This is the start // rule for this parser compilationUnit : // A compilation unit starts with an optional package definition ( packageDefinition | /* nothing */ ) // Next we have a series of zero or more import statements ( importDefinition )* // Wrapping things up with any number of class or interface // definitions ( typeDefinition )* EOF ; // Package statement: "package" followed by an identifier. packageDefinition // let ANTLR handle errors :'package' identifier SEMI ; // Import statement: import followed by a package or class name importDefinition :'import' identifierStar SEMI ; // A type definition in a file is either a class or interface definition. typeDefinition :modifiers ( classDefinition | interfaceDefinition ) | SEMI ; /** A declaration is the creation of a reference or primitive-type variable * Create a separate Type/Var tree for each var in the var list. */ declaration :modifierstypeSpecvariableDefinitions ; // A type specification is a type name with possible brackets afterwards // (which would make it an array type). typeSpec : classTypeSpec | builtInTypeSpec ; // A class type specification is a class type with possible brackets afterwards // (which would make it an array type). classTypeSpec : identifier (LBRACK RBRACK)* ; // A builtin type specification is a builtin type with possible brackets // afterwards (which would make it an array type). builtInTypeSpec : builtInType (LBRACK RBRACK)* ; // A type name. which is either a (possibly qualified) class name or // a primitive (builtin) type type : identifier | builtInType ; // The primitive types. builtInType : 'void' | 'boolean' | 'byte' | 'char' | 'short' | 'int' | 'float' | 'long' | 'double' ; // A (possibly-qualified) java identifier. We start with the first IDENT // and expand its name by adding dots and following IDENTS identifier : IDENT ( DOT IDENT )* ; identifierStar : IDENT ( DOT IDENT )* ( DOT STAR )? ; // A list of zero or more modifiers. We could have used (modifier)* in // place of a call to modifiers, but I thought it was a good idea to keep // this rule separate so they can easily be collected in a Vector if // someone so desires modifiers : ( modifier )* ; // modifiers for Java classes, interfaces, class/instance vars and methods modifier : 'private' | 'public' | 'protected' | 'static' | 'transient' | 'final' | 'abstract' | 'native' | 'threadsafe' | 'synchronized' // | "const" // reserved word, but not valid | 'volatile' | 'strictfp' ; // Definition of a Java class classDefinition : 'class' IDENTsuperClassClauseimplementsClauseclassBlock ; superClassClause : ( 'extends'identifier )? ; // Definition of a Java Interface interfaceDefinition : 'interface' IDENTinterfaceExtendsclassBlock ; // This is the body of a class. You can have fields and extra semicolons, // That's about it (until you see what a field is...) classBlock : LCURLY ( field | SEMI )* RCURLY ; // An interface can extend several other interfaces... interfaceExtends : ('extends' identifier ( COMMA identifier )* )? ; // A class can implement several interfaces... implementsClause : ('implements' identifier ( COMMA identifier )* )? ; // Now the various things that can be defined inside a class or interface... // Note that not all of these are really valid in an interface (constructors, // for example), and if this grammar were used for a compiler there would // need to be some semantic checks to make sure we're doing the right thing... field :modifiers (ctorHeadconstructorBody |classDefinition |interfaceDefinition |typeSpec // method or variable declaration(s) ( IDENT // the name of the method // parse the formal parameter declarations. LPARENparameterDeclarationList RPARENdeclaratorBrackets // get the list of exceptions that this method is // declared to throw (throwsClause)? (compoundStatement | SEMI ) |variableDefinitions SEMI ) ) // "static { ... }" class initializer | 'static'compoundStatement // "{ ... }" instance initializer |compoundStatement ; constructorBody :LCURLY ( explicitConstructorInvocation)? (statement)* RCURLY ; /** Catch obvious constructor calls, but not the expr.super(...) calls */ explicitConstructorInvocation : 'this'LPAREN argList RPAREN SEMI | 'super'LPAREN argList RPAREN SEMI ; variableDefinitions : variableDeclarator ( COMMA variableDeclarator )* ; /** Declaration of a variable. This can be a class/instance variable, * or a local variable in a method * It can also include possible initialization. */ variableDeclarator :IDENTdeclaratorBracketsvarInitializer ; declaratorBrackets : (LBRACK RBRACK)* ; varInitializer : ( ASSIGN initializer )? ; // This is an initializer used to set up an array. arrayInitializer :LCURLY ( initializer ( COMMA initializer )* (COMMA)? )? RCURLY ; // The two "things" that can initialize an array element are an expression // and another (nested) array initializer. initializer : expression | arrayInitializer ; // This is the header of a method. It includes the name and parameters // for the method. // This also watches for a list of exception classes in a "throws" clause. ctorHead : IDENT // the name of the method // parse the formal parameter declarations. LPAREN parameterDeclarationList RPAREN // get the list of exceptions that this method is declared to throw (throwsClause)? ; // This is a list of exception classes that the method is declared to throw throwsClause : 'throws' identifier ( COMMA identifier )* ; // A list of formal parameters parameterDeclarationList : ( parameterDeclaration ( COMMA parameterDeclaration )* )? ; // A formal parameter. parameterDeclaration :parameterModifiertypeSpecIDENTdeclaratorBrackets ; parameterModifier : ('final')? ; // Compound statement. This is used in many contexts: // Inside a class definition prefixed with "static": // it is a class initializer // Inside a class definition without "static": // it is an instance initializer // As the body of a method // As a completely indepdent braced block of code inside a method // it starts a new scope for variable definitions compoundStatement :LCURLY // include the (possibly-empty) list of statements (statement)* RCURLY ; statement // A list of statements in curly braces -- start a new scope! : compoundStatement // declarations are ambiguous with "ID DOT" relative to expression // statements. Must backtrack to be sure. Could use a semantic // predicate to test symbol table to see what the type was coming // up, but that's pretty hard without a symbol table ;) | declaration SEMI // An expression statement. This could be a method call, // assignment statement, or any other expression evaluated for // side-effects. | expression SEMI // class definition |modifiers classDefinition // Attach a label to the front of a statement | IDENTCOLON statement // If-else statement | 'if' LPAREN expression RPAREN statement ( 'else' statement )? // For statement | 'for' LPAREN forInit SEMI // initializer forCond SEMI // condition test forIter // updater RPAREN statement // statement to loop over // While statement | 'while' LPAREN expression RPAREN statement // do-while statement | 'do' statement 'while' LPAREN expression RPAREN SEMI // get out of a loop (or switch) | 'break' (IDENT)? SEMI // do next iteration of a loop | 'continue' (IDENT)? SEMI // Return an expression | 'return' (expression)? SEMI // switch/case statement | 'switch' LPAREN expression RPAREN LCURLY ( casesGroup )* RCURLY // exception try-catch block | tryBlock // throw an exception | 'throw' expression SEMI // synchronize a statement | 'synchronized' LPAREN expression RPAREN compoundStatement // asserts (uncomment if you want 1.4 compatibility) // | "assert"^ expression ( COLON! expression )? SEMI! // empty statement |SEMI ; casesGroup : ( aCase )+ caseSList ; aCase : ('case' expression | 'default') COLON ; caseSList : (statement)* ; // The initializer for a for loop forInit // if it looks like a declaration, it is : ( declaration // otherwise it could be an expression list... | expressionList )? ; forCond : (expression)? ; forIter : (expressionList)? ; // an exception handler try/catch block tryBlock : 'try' compoundStatement (handler)* ( finallyClause )? ; finallyClause : 'finally' compoundStatement ; // an exception handler handler : 'catch' LPAREN parameterDeclaration RPAREN compoundStatement ; // expressions // Note that most of these expressions follow the pattern // thisLevelExpression : // nextHigherPrecedenceExpression // (OPERATOR nextHigherPrecedenceExpression)* // which is a standard recursive definition for a parsing an expression. // The operators in java have the following precedences: // lowest (13) = *= /= %= += -= <<= >>= >>>= &= ^= |= // (12) ?: // (11) || // (10) && // ( 9) | // ( 8) ^ // ( 7) & // ( 6) == != // ( 5) < <= > >= // ( 4) << >> // ( 3) +(binary) -(binary) // ( 2) * / % // ( 1) ++ -- +(unary) -(unary) ~ ! (type) // [] () (method call) . (dot -- identifier qualification) // new () (explicit parenthesis) // // the last two are not usually on a precedence chart; I put them in // to point out that new has a higher precedence than '.', so you // can validy use // new Frame().show() // // Note that the above precedence levels map to the rules below... // Once you have a precedence chart, writing the appropriate rules as below // is usually very straightfoward // the mother of all expressions expression : assignmentExpression ; // This is a list of expressions. expressionList : expression (COMMA expression)* ; // assignment expression (level 13) assignmentExpression : conditionalExpression ( ( ASSIGN | PLUS_ASSIGN | MINUS_ASSIGN | STAR_ASSIGN | DIV_ASSIGN | MOD_ASSIGN | SR_ASSIGN | BSR_ASSIGN | SL_ASSIGN | BAND_ASSIGN | BXOR_ASSIGN | BOR_ASSIGN ) assignmentExpression )? ; // conditional test (level 12) conditionalExpression : logicalOrExpression ( QUESTION assignmentExpression COLON conditionalExpression )? ; // logical or (||) (level 11) logicalOrExpression : logicalAndExpression (LOR logicalAndExpression)* ; // logical and (&&) (level 10) logicalAndExpression : inclusiveOrExpression (LAND inclusiveOrExpression)* ; // bitwise or non-short-circuiting or (|) (level 9) inclusiveOrExpression : exclusiveOrExpression (BOR exclusiveOrExpression)* ; // exclusive or (^) (level 8) exclusiveOrExpression : andExpression (BXOR andExpression)* ; // bitwise or non-short-circuiting and (&) (level 7) andExpression : equalityExpression (BAND equalityExpression)* ; // equality/inequality (==/!=) (level 6) equalityExpression : relationalExpression ((NOT_EQUAL | EQUAL) relationalExpression)* ; // boolean relational expressions (level 5) relationalExpression : shiftExpression ( ( ( LT | GT | LE | GE ) shiftExpression )* | 'instanceof' typeSpec ) ; // bit shift expressions (level 4) shiftExpression : additiveExpression ((SL | SR | BSR) additiveExpression)* ; // binary addition/subtraction (level 3) additiveExpression : multiplicativeExpression ((PLUS | MINUS) multiplicativeExpression)* ; // multiplication/division/modulo (level 2) multiplicativeExpression : unaryExpression ((STAR | DIV | MOD ) unaryExpression)* ; unaryExpression : INC unaryExpression | DEC unaryExpression | MINUS unaryExpression | PLUS unaryExpression | unaryExpressionNotPlusMinus ; unaryExpressionNotPlusMinus : BNOT unaryExpression | LNOT unaryExpression // use predicate to skip cases like: (int.class) |LPAREN builtInTypeSpec RPAREN unaryExpression // Have to backtrack to see if operator follows. If no operator // follows, it's a typecast. No semantic checking needed to parse. // if it _looks_ like a cast, it _is_ a cast; else it's a "(expr)" |LPAREN classTypeSpec RPAREN unaryExpressionNotPlusMinus | postfixExpression ; // qualified names, array expressions, method invocation, post inc/dec postfixExpression : /* "this"! lp1:LPAREN^ argList RPAREN! {#lp1.setType(CTOR_CALL);} | "super"! lp2:LPAREN^ argList RPAREN! {#lp2.setType(SUPER_CTOR_CALL);} | */ primaryExpression ( /* options { // the use of postfixExpression in SUPER_CTOR_CALL adds DOT // to the lookahead set, and gives loads of false non-det // warnings. // shut them off. generateAmbigWarnings=false; } : */ DOT IDENT (LPAREN argList RPAREN )? | DOT 'this' | DOT 'super' (LPAREN argList RPAREN | DOT IDENT (LPAREN argList RPAREN )? ) | DOT newExpression |LBRACK expression RBRACK )* (INC |DEC )? ; // the basic element of an expression primaryExpression : identPrimary ( DOT 'class' )? | constant | 'true' | 'false' | 'null' | newExpression | 'this' | 'super' | LPAREN assignmentExpression RPAREN // look for int.class and int[].class | builtInType (LBRACK RBRACK )* DOT 'class' ; /** Match a, a.b.c refs, a.b.c(...) refs, a.b.c[], a.b.c[].class, * and a.b.c.class refs. Also this(...) and super(...). Match * this or super. */ identPrimary : IDENT ( DOT IDENT )* ( (LPAREN argList RPAREN ) | (LBRACK RBRACK )+ )? ; /** object instantiation. * Trees are built as illustrated by the following input/tree pairs: * * new T() * * new * | * T -- ELIST * | * arg1 -- arg2 -- .. -- argn * * new int[] * * new * | * int -- ARRAY_DECLARATOR * * new int[] {1,2} * * new * | * int -- ARRAY_DECLARATOR -- ARRAY_INIT * | * EXPR -- EXPR * | | * 1 2 * * new int[3] * new * | * int -- ARRAY_DECLARATOR * | * EXPR * | * 3 * * new int[1][2] * * new * | * int -- ARRAY_DECLARATOR * | * ARRAY_DECLARATOR -- EXPR * | | * EXPR 1 * | * 2 * */ newExpression : 'new' type ( LPAREN argList RPAREN (classBlock)? //java 1.1 // Note: This will allow bad constructs like // new int[4][][3] {exp,exp}. // There needs to be a semantic check here... // to make sure: // a) [ expr ] and [ ] are not mixed // b) [ expr ] and an init are not used together | newArrayDeclarator (arrayInitializer)? ) ; argList : ( expressionList | ) ; newArrayDeclarator : (LBRACK (expression)? RBRACK )+ ; constant : NUM_INT | CHAR_LITERAL | STRING_LITERAL | NUM_FLOAT | NUM_LONG | NUM_DOUBLE ; FINAL : 'final'; ABSTRACT : 'abstract'; STRICTFP : 'strictfp'; // OPERATORS QUESTION : '?' ; LPAREN : '(' ; RPAREN : ')' ; LBRACK : '[' ; RBRACK : ']' ; LCURLY : '{' ; RCURLY : '}' ; COLON : ':' ; COMMA : ',' ; //DOT : '.' ; ASSIGN : '=' ; EQUAL : '==' ; LNOT : '!' ; BNOT : '~' ; NOT_EQUAL : '!=' ; DIV : '/' ; DIV_ASSIGN : '/=' ; PLUS : '+' ; PLUS_ASSIGN : '+=' ; INC : '++' ; MINUS : '-' ; MINUS_ASSIGN : '-=' ; DEC : '--' ; STAR : '*' ; STAR_ASSIGN : '*=' ; MOD : '%' ; MOD_ASSIGN : '%=' ; SR : '>>' ; SR_ASSIGN : '>>=' ; BSR : '>>>' ; BSR_ASSIGN : '>>>=' ; GE : '>=' ; GT : '>' ; SL : '<<' ; SL_ASSIGN : '<<=' ; LE : '<=' ; LT : '<' ; BXOR : '^' ; BXOR_ASSIGN : '^=' ; BOR : '|' ; BOR_ASSIGN : '|=' ; LOR : '||' ; BAND : '&' ; BAND_ASSIGN : '&=' ; LAND : '&&' ; SEMI : ';' ; // Whitespace -- ignored WS : ( ' ' | '\t' | '\f' // handle newlines | ( '\r\n' // Evil DOS | '\r' // Macintosh | '\n' // Unix (the right way) ) )+ ; // Single-line comments SL_COMMENT : '//' (~('\n'|'\r'))* ('\n'|'\r'('\n')?) ; // multiple-line comments ML_COMMENT : '/*' ( { LA(2)!='/' }? '*' | '\r' '\n' | '\r' | '\n' | ~('*'|'\n'|'\r') )* '*/' ; // character literals CHAR_LITERAL : '\'' ( ESC | ~('\''|'\n'|'\r'|'\\') ) '\'' ; // string literals STRING_LITERAL : '"' (ESC|~('"'|'\\'|'\n'|'\r'))* '"' ; ESC : '\\' ( 'n' | 'r' | 't' | 'b' | 'f' | '"' | '\'' | '\\' | ('u')+ HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT | '0'..'3' ( '0'..'7' ( '0'..'7' )? )? | '4'..'7' ( '0'..'7' )? ) ; HEX_DIGIT : ('0'..'9'|'A'..'F'|'a'..'f') ; VOCAB : '\3'..'\377' ; // an identifier. Note that testLiterals is set to true! This means // that after we match the rule, we look in the literals table to see // if it's a literal or really an identifer IDENT : ('a'..'z'|'A'..'Z'|'_'|'$') ('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'$')* ; // a numeric literal NUM_INT : '.' ( ('0'..'9')+ (EXPONENT)? (FLOAT_SUFFIX)? )? | ( '0' // special case for just '0' ( ('x'|'X') ( HEX_DIGIT )+ | ('0'..'9')+ | ('0'..'7')+ // octal )? | ('1'..'9') ('0'..'9')* // non-zero decimal ) ( ('l'|'L') // only check to see if it's a float if looks like decimal so far | {isDecimal}? ( '.' ('0'..'9')* (EXPONENT)? (FLOAT_SUFFIX)? | EXPONENT (FLOAT_SUFFIX)? |FLOAT_SUFFIX ) )? ; EXPONENT : ('e'|'E') ('+'|'-')? ('0'..'9')+ ; FLOAT_SUFFIX : 'f'|'F'|'d'|'D' ;
old/Spaces/WedgeCircles.agda
timjb/HoTT-Agda
294
392
<filename>old/Spaces/WedgeCircles.agda {-# OPTIONS --without-K #-} open import Base module Spaces.WedgeCircles {i} (A : Set i) where {- The idea is data wedge-circles : Set (suc i) where base : wedge-circles loops : A → base ≡ base -} private data #wedge-circles : Set (suc i) where #base : #wedge-circles wedge-circles : Set (suc i) wedge-circles = #wedge-circles base : wedge-circles base = #base postulate -- HIT loops : A → base ≡ base wedge-circles-rec : ∀ {i} (P : wedge-circles → Set i) (x : P base) (p : (t : A) → transport P (loops t) x ≡ x) → ((t : wedge-circles) → P t) wedge-circles-rec P x p #base = x postulate -- HIT β : ∀ {i} (P : wedge-circles → Set i) (x : P base) (p : (t : A) → transport P (loops t) x ≡ x) (t : A) → apd (wedge-circles-rec P x p) (loops t) ≡ p t wedge-circles-rec-nondep : ∀ {i} (B : Set i) (x : B) (p : A → x ≡ x) → (wedge-circles → B) wedge-circles-rec-nondep B x p #base = x postulate -- HIT β-nondep : ∀ {i} (B : Set i) (x : B) (p : A → x ≡ x) (t : A) → ap (wedge-circles-rec-nondep B x p) (loops t) ≡ p t
programs/oeis/161/A161435.asm
neoneye/loda
22
26694
<gh_stars>10-100 ; A161435: Number of reduced words of length n in the Weyl group A_3 (or D_3). ; 1,3,5,6,5,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 mul $0,2 mov $2,1 add $2,$0 trn $0,5 mov $1,8 lpb $1 mov $1,$2 lpe trn $1,$0 mov $0,$1
programs/oeis/140/A140649.asm
neoneye/loda
22
170020
; A140649: Triangle whose rows are decreasing powers of 2, followed by 0. ; 1,0,2,1,0,4,2,1,0,8,4,2,1,0,16,8,4,2,1,0,32,16,8,4,2,1,0,64,32,16,8,4,2,1,0,128,64,32,16,8,4,2,1,0,256,128,64,32,16,8,4,2,1,0,512,256,128,64,32,16,8,4,2,1,0,1024,512,256,128,64,32,16,8,4,2,1,0,2048,1024,512,256,128,64,32,16,8,4,2,1,0,4096 add $0,1 seq $0,25676 ; Exponent of 8 (value of i) in n-th number of form 8^i*9^j. sub $0,1 mov $1,2 pow $1,$0 mov $0,$1
test/Compiler/simple/Issue1252.agda
redfish64/autonomic-agda
0
6860
<gh_stars>0 module Issue1252 where data Bool : Set where true false : Bool {-# COMPILED_DATA Bool Bool True False #-} foo : Bool → Bool foo true = false foo false = true {-# COMPILED_EXPORT foo foohs #-}
test/Succeed/Issue1999.agda
cruhland/agda
1,989
4897
-- Andreas, 2016-06-01, issue 1999 -- Bug in TypeChecking.Signature.applySection -- If that function was not such horrible spaghetti code, -- there would be less bugs like this. -- Bug was: code for applying projection used ts instead of ts' -- {-# OPTIONS -v tc.mod.apply:80 #-} module Issue1999 where import Common.Product as P using (_×_ ; proj₂) module One (A : Set) where open P public module Two (A : Set) where module M = One A myproj : A M.× A → A myproj p = M.proj₂ p -- WAS: Internal error in Substitute (projection applied to lambda) -- Should work.
Task/Date-manipulation/AppleScript/date-manipulation-1.applescript
LaudateCorpus1/RosettaCodeData
1
1099
<reponame>LaudateCorpus1/RosettaCodeData set x to "March 7 2009 7:30pm EST" return (date x) + 12 * hours
unittests/ASM/PrimaryGroup/1_81_02.asm
cobalt2727/FEX
628
19644
<filename>unittests/ASM/PrimaryGroup/1_81_02.asm %ifdef CONFIG { "RegData": { "RAX": "0x4142A4A7A6A84748", "RBX": "0x51525354181B1E21", "RCX": "0x61626365282B2E31", "RDX": "0x6162636465666569" }, "MemoryRegions": { "0x100000000": "4096" } } %endif mov rdx, 0xe0000000 mov rax, 0x4142434445464748 mov [rdx + 8 * 0], rax mov rax, 0x5152535455565758 mov [rdx + 8 * 1], rax mov rax, 0x6162636465666768 mov [rdx + 8 * 2], rax mov rax, 0x6162636465666768 mov [rdx + 8 * 3], rax clc adc word [rdx + 8 * 0 + 2], 0x6162 clc adc dword [rdx + 8 * 1 + 0], 0x61626364 clc adc qword [rdx + 8 * 2 + 0], 0x61626364 clc adc qword [rdx + 8 * 3 + 0], -256 stc adc word [rdx + 8 * 0 + 4], 0x6162 stc adc dword [rdx + 8 * 1 + 0], 0x61626364 stc adc qword [rdx + 8 * 2 + 0], 0x61626364 stc adc qword [rdx + 8 * 3 + 0], -256 mov rax, [rdx + 8 * 0] mov rbx, [rdx + 8 * 1] mov rcx, [rdx + 8 * 2] mov rdx, [rdx + 8 * 3] hlt
corpus/creole.g4
raku-community-modules/ANTLR4-Grammar
28
3180
/* [The "BSD licence"] Copyright (c) 2013 <NAME> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. */ /* * examples here: http://svn.ez.no/svn/ezcomponents/trunk/Document/tests/files/wiki/creole/ */ grammar creole; document : (line? CR)* ; line : markup+ ; markup : bold | italics | href | title | hline | text | listitem | image | tablerow | tableheader | nowiki ; text : (TEXT | RSLASH)+ ('\\\\' text)* ; bold : '**' markup+ '**'? ; italics : RSLASH RSLASH markup+ RSLASH RSLASH ; href : LBRACKET text ('|' markup+)? RBRACKET | LBRACE text '|' markup+ RBRACE // Creole 0.2 ; image : LBRACE text RBRACE ; hline : '----' ; listitem : ('*'+ markup) | ('#'+ markup) ; tableheader : ('|=' markup+)+ '|' WS* ; tablerow : ('|' markup+)+ '|' WS* ; title : '='+ markup '='* ; nowiki : NOWIKI ; HASH : '#' ; LBRACKET : '[[' ; RBRACKET : ']]' ; LBRACE : '{{' ; RBRACE : '}}' ; TEXT : (LETTERS | DIGITS | SYMBOL | WS)+ ; WS : [ \t] ; CR : '\n' | EOF ; NOWIKI : '{{{' .*? '}}}' ; RSLASH : '/' ; fragment LETTERS : [a-zA-Z] ; fragment DIGITS : [0-9] ; fragment SYMBOL : '.' | ';' | ':' | ',' | '(' | ')' | '-' | '\\' | '\'' | '~' | '"' | '+' ;
src/SonicBoomRiseOfLyric/Mods/FixPauseStateReset/patch_FixPauseStateReset.asm
lilystudent2016/cemu_graphic_packs
1,002
1584
[WiiULauncher0US] moduleMatches = 0x90DAC5CE ; Skip CBrbAICompanion::ForceIdle subroutine 0x306EBA0 = nop [WiiULauncher0EU] moduleMatches = 0x8F7D2702 ; Skip CBrbAICompanion::ForceIdle subroutine 0x306EB80 = nop [WiiULauncher0JP] moduleMatches = 0x0D395735 ; Skip CBrbAICompanion::ForceIdle subroutine 0x306EA30 = nop [WiiULauncher16] moduleMatches = 0x113CC316 ; Skip CBrbAICompanion::ForceIdle subroutine 0x306EDBC = nop
js/packages/k0-integration-tests-fabric/itermscripts/fabric_1_devmode_setup.applescript
appliedblockchain/k0
63
790
<reponame>appliedblockchain/k0 tell application "System Events" to keystroke "t" using command down tell application "iTerm" activate select first window tell current session of current window write text "cd $GOPATH/src/github.com/appliedblockchain/k0/js/packages/k0-integration-tests-fabric/devnetwork" write text "./start.sh &" split horizontally with default profile split horizontally with default profile end tell repeat with sessionNumber in {2, 6} tell session sessionNumber of current tab of current window split vertically with default profile split vertically with default profile split vertically with default profile end tell end repeat tell session 1 of current tab of current window write text "wait" write text "cd alphaadmin" write text "peer channel create -o localhost:7050 -c the-channel -f ../artefacts/channel_creation.tx --outputBlock ../artefacts/the-channel.block" write text "docker-compose logs -f" end tell my change_directory(2, "alphapeer") my change_directory(3, "betapeer") my change_directory(4, "gammapeer") my change_directory(5, "bankpeer") my change_directory(6, "alphaadmin") my change_directory(7, "betaadmin") my change_directory(8, "gammaadmin") my change_directory(9, "bankadmin") delay 5 repeat with sessionNumber in {2, 3, 4, 5} tell session sessionNumber of current tab of current window write text "peer node start --peer-chaincodedev=true" end tell end repeat delay 2 repeat with sessionNumber in {6, 7, 8, 9} tell session sessionNumber of current tab of current window write text "peer channel join -b ../artefacts/the-channel.block" end tell end repeat end tell on change_directory(session_num, dir) tell application "iTerm" tell session session_num of current tab of current window write text ("cd $GOPATH/src/github.com/appliedblockchain/k0/js/packages/k0-integration-tests-fabric/devnetwork/" & dir) end tell end tell end change_directory
src/int2str.asm
LessNick/CLi-for-WildCommander
8
244831
;-------------------------------------------------------------- ; int2str перевод int в текст (десятичное число) ; (C) BUDDER/MGN - 2011.12.26 ; char2str перевод char(8bit) в текст (десятичное число) ; Added by breeze ;-------------------------------------------------------------- ; i:[HL] - int16, EXX DE - String addres ; o:Decimal string(5) _int2str ld bc,10000 call delit ld (de),a inc de ld bc,1000 call delit ld (de),a inc de ; i:[HL] - int8, EXX DE - String addres ; o:Decimal string(3) _char2str ld bc,100 call delit ld (de),a inc de ; i:[HL] - int4, EXX DE - String addres ; o:Decimal string(3) _fourbit2str ld c,10 call delit ld (de),a inc de ld c,1 call delit ld (de),a ret delit ld a,#ff or a dlit inc a sbc hl,bc jp nc,dlit add hl,bc add a,#30 ret ;-------------------------------------------------------------- word2str ;ВЫВОД 32bit ЧИСЛА: DECZON4 ;i:[DE,HL] - int32 ; EXX DE - String addres ; o:Decimal string(10) LD BC,#CA00,(CLHL),BC; 1B LD BC,#3B9A,(CLDE),BC CALL DELIT4T EXX:LD (DE),A:INC DE:EXX LD BC,#E100,(CLHL),BC; 100M LD BC,#05F5,(CLDE),BC CALL DELIT4T EXX:LD (DE),A:INC DE:EXX LD BC,#9680,(CLHL),BC; 10M LD BC,#0098,(CLDE),BC CALL DELIT4T EXX:LD (DE),A:INC DE:EXX LD BC,#4240,(CLHL),BC; 1M LD BC,#000F,(CLDE),BC CALL DELIT4T EXX:LD (DE),A:INC DE:EXX LD BC,#86A0,(CLHL),BC; 100K LD BC,#0001,(CLDE),BC CALL DELIT4T EXX:LD (DE),A:INC DE:EXX ;--------------------------------------- DELIT4T ;i:[DE,HL]/[CLDE,CLHL] ; o:[DE,HL] - Remainder ; BC - Count LD IX,0-1 NAZE OR A DLTB LD BC,0 INC IX EX DE,HL:SBC HL,BC:JR C,ND DLTA LD BC,0 EX DE,HL:SBC HL,BC:JR NC,DLTB DEC DE LD A,D:INC A:JR NZ,NAZE LD A,E:INC A:JR NZ,NAZE INC DE ADD HL,BC EX DE,HL LD BC,(CLDE) ;------- ND ADD HL,BC EX DE,HL Nd PUSH IX POP BC LD A,C:ADD A,#30 RET ;--------------------------------------- CLHL EQU DLTA+1 CLDE EQU DLTB+1 ;---------------------------------------
programs/oeis/013/A013709.asm
neoneye/loda
22
89292
; A013709: a(n) = 4^(2n+1). ; 4,64,1024,16384,262144,4194304,67108864,1073741824,17179869184,274877906944,4398046511104,70368744177664,1125899906842624,18014398509481984,288230376151711744,4611686018427387904,73786976294838206464,1180591620717411303424,18889465931478580854784,302231454903657293676544,4835703278458516698824704,77371252455336267181195264,1237940039285380274899124224,19807040628566084398385987584,316912650057057350374175801344,5070602400912917605986812821504,81129638414606681695789005144064,1298074214633706907132624082305024,20769187434139310514121985316880384,332306998946228968225951765070086144 mov $1,16 pow $1,$0 mul $1,4 mov $0,$1
src/stars/examples/conditionals/prime_numbers.asm
kevintmcdonnell/stars
9
163388
.data start_msg: .asciiz "The first 50 prime numbers are \n" space: .asciiz " " endl: .ascii "\n" .text main: li $s0, 50 # NUMBER_OF_PRIMES: number of primes to display total li $s1, 7 # NUMBER_OF_PRIMES_PER_LINE: number of primes to display per line li $t0, 0 # count: the number of prime numbers li $t1, 2 # number: a number to be tested for primality la $a0, start_msg li $v0, 4 syscall while_loop: # top of while-loop beq $t0, $s0, exit # repeat until count == # of primes to display # initialization of for-loop li $t2, 2 # divisor: for-loop counter variable move $t3, $t1 # upper bound of loop = number li $t4, 2 # declare constant to perform a division div $t3, $t4 # divide number by by 2 mflo $t3 # upper bound of divisor = number / 2 for_loop: bgt $t2, $t3, end_for_loop # repeat until divisor > number / 2 div $t1, $t2 # number / divisor mfhi $t4 # $t4 = number divisor beqz $t4, end_for_loop # it's not a prime #; break out of for-loop addi $t2, $t2, 1 # it still might be prime, so divisor++ j for_loop end_for_loop: beqz $t4, dont_print_number # isPrime is false, so don't print the number addi $t0, $t0, 1 # isPrime is true; count++ and... li $v0, 1 # ...print the number move $a0, $t1 syscall li $a0, ' ' li $v0, 11 syscall # do we need to print a newline? Let's find out div $t0, $s1 # count / NUMBER_OF_PRIMES_PER_LINE mfhi $t4 # t5 = count NUMBER_OF_PRIMES_PER_LINE bnez $t4, dont_print_number # we actually did print number, just don't print newline li $a0, '\n' li $v0, 11 syscall dont_print_number: addi $t1, $t1, 1 # number++: set up next number to test for primality j while_loop exit: li $a0, '\n' li $v0, 11 syscall # terminate program li $v0, 10 syscall
Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/a-tienio.ads
djamal2727/Main-Bearing-Analytical-Model
0
10645
<filename>Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/a-tienio.ads ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . T E X T _ I O . E N U M E R A T I O N _ I O -- -- -- -- S p e c -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. In accordance with the copyright of that document, you can freely -- -- copy and modify this specification, provided that if you redistribute a -- -- modified version, any changes that you have made are clearly indicated. -- -- -- ------------------------------------------------------------------------------ -- In Ada 95, the package Ada.Text_IO.Enumeration_IO is a subpackage of -- Text_IO. This is for compatibility with Ada 83. In GNAT we make it a -- child package to avoid loading the necessary code if Enumeration_IO is -- not instantiated. See routine Rtsfind.Check_Text_IO_Special_Unit for a -- description of how we patch up the difference in semantics so that it -- is invisible to the Ada programmer. private generic type Enum is (<>); package Ada.Text_IO.Enumeration_IO is Default_Width : Field := 0; Default_Setting : Type_Set := Upper_Case; procedure Get (File : File_Type; Item : out Enum) with Pre => Is_Open (File) and then Mode (File) = In_File, Global => (In_Out => File_System); procedure Get (Item : out Enum) with Post => Line_Length'Old = Line_Length and Page_Length'Old = Page_Length, Global => (In_Out => File_System); procedure Put (File : File_Type; Item : Enum; Width : Field := Default_Width; Set : Type_Set := Default_Setting) with Pre => Is_Open (File) and then Mode (File) /= In_File, Post => Line_Length (File)'Old = Line_Length (File) and Page_Length (File)'Old = Page_Length (File), Global => (In_Out => File_System); procedure Put (Item : Enum; Width : Field := Default_Width; Set : Type_Set := Default_Setting) with Post => Line_Length'Old = Line_Length and Page_Length'Old = Page_Length, Global => (In_Out => File_System); procedure Get (From : String; Item : out Enum; Last : out Positive) with Global => null; procedure Put (To : out String; Item : Enum; Set : Type_Set := Default_Setting) with Global => null; end Ada.Text_IO.Enumeration_IO;
day12/tests/day-test.adb
jwarwick/aoc_2020
3
30738
with AUnit.Assertions; use AUnit.Assertions; package body Day.Test is procedure Test_Part1 (T : in out AUnit.Test_Cases.Test_Case'Class) is pragma Unreferenced (T); f : constant Ferry := load_file("test1.txt"); d : constant Natural := distance(f); begin Assert(d = 25, "Wrong number, expected 25, got" & Natural'IMAGE(d)); end Test_Part1; procedure Test_Part2 (T : in out AUnit.Test_Cases.Test_Case'Class) is pragma Unreferenced (T); f : constant Ferry := load_file("test1.txt"); d : constant Natural := waypoint_distance(f); begin Assert(d = 286, "Wrong number, expected 286, got" & Natural'IMAGE(d)); end Test_Part2; function Name (T : Test) return AUnit.Message_String is pragma Unreferenced (T); begin return AUnit.Format ("Test Day package"); end Name; procedure Register_Tests (T : in out Test) is use AUnit.Test_Cases.Registration; begin Register_Routine (T, Test_Part1'Access, "Test Part 1"); Register_Routine (T, Test_Part2'Access, "Test Part 2"); end Register_Tests; end Day.Test;
registrar-dependency_processing.ads
annexi-strayline/AURA
13
27515
------------------------------------------------------------------------------ -- -- -- Ada User Repository Annex (AURA) -- -- ANNEXI-STRAYLINE Reference Implementation -- -- -- -- Core -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2020, ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contributors: -- -- * <NAME> (ANNEXI-STRAYLINE) -- -- -- -- 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 copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- -- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- This package contains specialized processing steps for the consolidation of -- the Registrar's unit dependency maps with Progress; package Registrar.Dependency_Processing is ------------------------------ -- Consolidate_Dependencies -- ------------------------------ procedure Consolidate_Dependencies; Merge_Subunits_Progress: aliased Progress.Progress_Tracker; Fan_Out_Progress : aliased Progress.Progress_Tracker; Build_Reverse_Progress : aliased Progress.Progress_Tracker; -- Consolidate_Dependencies ensures that the Unit/Subsystem Forward/Reverse -- dependency maps are consolidated and coherent -- -- Consolidate_Dependencies must be completed before any of the dependency -- maps are consulted. -- -- Consolidate_Dependencies executes three phases (basically a map-reduce): -- -- 1. Merge Subunits: All forward dependencies of all explicit Subunit units -- are unioned with the forward dependency map of their -- Library Unit parent. -- -- The subsystem forward dependency map is -- opportunistically populated during this phase. -- -- 2. Fan-out : All non-Requested units in the All_Library_Units -- registry have themselves queued for inclusion on the -- reverse dependency map of each forward dependency -- -- Similarily for all non-Requested Subsystems -- -- 3. Build Reverse : All non-Requested units in the All_Library_Units -- registry have their reverse dependency map sets built -- from the queued names generated in the Fan-out phase -- -- Similarily for all non-Requested Subsystems end Registrar.Dependency_Processing;
sharding-core/sharding-core-parse/sharding-core-parse-mysql/src/main/antlr4/imports/mysql/MySQLBase.g4
scuwuyu/incubator-shardingsphere
1
4504
<gh_stars>1-10 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ grammar MySQLBase; import MySQLKeyword, Keyword, Symbol, BaseRule, DataType; alias : ID | PASSWORD | STRING_ ; tableName : ID | ID DOT_ASTERISK_ | ASTERISK_ ; assignmentValueList : LP_ assignmentValues RP_ ; assignmentValues : assignmentValue (COMMA_ assignmentValue)* ; assignmentValue : DEFAULT | MAXVALUE | expr ; functionCall : (ID | DATE) LP_ distinct? (exprs | ASTERISK_)? RP_ | groupConcat | windowFunction ; groupConcat : GROUP_CONCAT LP_ distinct? (exprs | ASTERISK_)? (orderByClause (SEPARATOR expr)?)? RP_ ; windowFunction : ID exprList overClause ; overClause : OVER LP_ windowSpec RP_ | OVER ID ; windowSpec : ID? windowPartitionClause? orderByClause? frameClause? ; windowPartitionClause : PARTITION BY exprs ; frameClause : frameUnits frameExtent ; frameUnits : ROWS | RANGE ; frameExtent : frameStart | frameBetween ; frameStart : CURRENT ROW | UNBOUNDED PRECEDING | UNBOUNDED FOLLOWING | expr PRECEDING | expr FOLLOWING ; frameBetween : BETWEEN frameStart AND frameEnd ; frameEnd : frameStart ; variable : (AT_ AT_)? (GLOBAL | PERSIST | PERSIST_ONLY | SESSION)? DOT_? ID ; assignmentList : assignment (COMMA_ assignment)* ; assignment : columnName EQ_ assignmentValue ; tableReferences : matchNone ; whereClause : WHERE expr ;
source/mcbank4.asm
PaulSlocum/marble-craze
1
241275
; Marble Craze bank 4 ;------------------------------ ; Includes: ; ; - Score/Status display kernal and data ; - In-game Song #1 ;------------------------------ org $4000 rorg $1000 include mcdigit.asm pfDigitRef1 byte 0,5,10,15, 20,25,30,20, 0,20,0,0, 0,0,0,0 byte 35,40,45,50, 55,60,65,55, 35,55,0,0, 0,0,0,0 byte 70,75,80,85, 90,95,100,90, 70,90,0,0, 0,0,0,0 byte 105,110,115,120, 125,130,135,125, 105,125,0,0, 0,0,0,0 byte 140,145,150,155, 160,165,170,160, 140,160,0,0, 0,0,0,0 byte 175,180,185,190, 195,200,205,195, 175,195,0,0, 0,0,0,0 byte 210,215,220,225, 230,235,240,230, 210,230,0,0, 0,0,0,0 byte 140,145,150,155, 160,165,170,160, 140,160,0,0, 0,0,0,0 byte 0,5,10,15, 20,25,30,20, 0,20,0,0, 0,0,0,0 byte 140,145,150,155, 160,165,170,160, 140,160,0,0, 0,0,0,0 byte %00000000 byte %00000000 byte %00000000 byte %00000000 byte %00000000 byte %00000000 livesDisplay byte %00000000 byte %00100000 byte %00100000 byte %00100000 byte %00100000 byte %10100000 byte %10100000 byte %10100000 byte %10100000 byte %10100000 byte %10100000 byte %10100000 byte %10100000 byte %10100000 byte %10100000 byte %10100000 statusOffset byte 0,20,40,60,80,100,120,140,160,180,200,220 negConvert byte 0,255,254,253,252 align 256;----------------------------------------- ALIGN 256 statusText ; Nothing byte 0,0,0,0 byte 0,0,0,0 byte 0,0,0,0 byte 0,0,0,0 byte 0,0,0,0 ;+20PTS byte %00100011, %11000111, %00011100, %11100111 byte %00100000, %00101000, %10010010, %01001000 byte %11111001, %11001000, %10011100, %01000110 byte %00100010, %00001000, %10010000, %01000001 byte %00100011, %11100111, %00010000, %01001110 ;+50PTS byte %00100011, %11100111, %00011100, %11100111 byte %00100010, %00001000, %10010010, %01001000 byte %11111011, %11001000, %10011100, %01000110 byte %00100000, %00101000, %10010000, %01000001 byte %00100011, %11000111, %00010000, %01001110 ;+100PTS byte %00100010, %01100011, %00011100, %11100111 byte %00100010, %10010100, %10010010, %01001000 byte %11111010, %10010100, %10011100, %01000110 byte %00100010, %10010100, %10010000, %01000001 byte %00100010, %01100011, %00010000, %01001110 ;+5SEC byte %00100011, %11100000, %11101110, %01110000 byte %00100010, %00000001, %00001000, %10000000 byte %11111011, %11000000, %11001100, %10000000 byte %00100000, %00100000, %00101000, %10000000 byte %00100011, %11000001, %11001110, %01110000 ;+10SEC byte %00100010, %01100000, %11101110, %01110000 byte %00100010, %10010001, %00001000, %10000000 byte %11111010, %10010000, %11001100, %10000000 byte %00100010, %10010000, %00101000, %10000000 byte %00100010, %01100001, %11001110, %01110000 ;+20SEC byte %00100011, %00011000, %11101110, %01110000 byte %00100000, %10100101, %00001000, %10000000 byte %11111001, %00100100, %11001100, %10000000 byte %00100010, %00100100, %00101000, %10000000 byte %00100011, %10011001, %11001110, %01110000 ;WALLS byte %10001001, %10010001, %00001110, %00000000 byte %10001010, %01010001, %00010000, %00000000 byte %10101011, %11010001, %00001100, %00000000 byte %10101010, %01010001, %00000010, %00000000 byte %01010010, %01011101, %11011100, %00000000 ; GAMEOVER byte %01110010, %01101101, %10010010, %10110110 byte %10000101, %01010101, %00101010, %10100101 byte %10110111, %01010101, %10101010, %10110110 byte %10010101, %01000101, %00101010, %10100101 byte %01100101, %01000101, %10010001, %00110101 ; PAUSE byte %00000001, %10001001, %01001101, %11000000 byte %00000001, %01010101, %01010001, %00000000 byte %00000001, %10011101, %01001001, %10000000 byte %00000001, %00010101, %01000101, %00000000 byte %00000001, %00010100, %10011001, %11000000 ; TIME UP byte %00011101, %01101101, %10000101, %01100000 byte %00001001, %01010101, %00000101, %01010000 byte %00001001, %01010101, %10000101, %01100000 byte %00001001, %01000101, %00000101, %01000000 byte %00001001, %01000101, %10000010, %01000000 ;-------------------------------------------------- align 256 ;----------------------------------------- ALIGN 256 ;1UP byte %00000010, %10010111, %00000000, %00000000 byte %00000010, %10010100, %10000000, %00000000 byte %00000010, %10010111, %00000000, %00000000 byte %00000010, %10010100, %00000000, %00000000 byte %00000010, %01100100, %00000000, %00000000 ;KEY byte %01111000, %00000000, %00000000, %00000000 byte %10000100, %00000000, %00000000, %00000000 byte %10000111, %11111111, %00000000, %00000000 byte %10000100, %00011011, %00000000, %00000000 byte %01111000, %00011011, %00000000, %00000000 ;STOP byte %00000000, %11011111, %01100111, %00000000 byte %00000001, %00000100, %10010100, %10000000 byte %00000000, %10000100, %10010111, %00000000 byte %00000000, %01000100, %10010100, %00000000 byte %00000001, %10000100, %01100100, %00000000 ;ZAP byte %00000010, %01111011, %11011011, %01000000 byte %00000000, %10000010, %00010101, %00000000 byte %00000110, %10011011, %00010101, %01100000 byte %00000000, %10001010, %00010001, %00000000 byte %00000010, %01110011, %11010001, %01000000 ;LIGHTS byte %00001000, %01001110, %10010111, %11001110 byte %00001000, %01010000, %10010001, %00010000 byte %00001000, %01010110, %11110001, %00001100 byte %00001000, %01010010, %10010001, %00000010 byte %00001111, %01001100, %10010001, %00011100 ;WARP byte %00000010, %00100110, %01110011, %10000000 byte %00000010, %00101001, %01001010, %01000000 byte %00000010, %10101111, %01110011, %10000000 byte %00000010, %10101001, %01010010, %00000000 byte %00000001, %01001001, %01001010, %00000000 ;RIGHT byte %00000000, %00000000, %11000000, %00000000 byte %00000000, %00000000, %11110000, %00000000 byte %00000000, %11111111, %11111100, %00000000 byte %00000000, %00000000, %11110000, %00000000 byte %00000000, %00000000, %11000000, %00000000 ;UP byte %00000000, %00000001, %00000000, %00000000 byte %00000000, %00000011, %10000000, %00000000 byte %00000000, %00000111, %11000000, %00000000 byte %00000000, %00000001, %00000000, %00000000 byte %00000000, %00000001, %00000000, %00000000 ; GAMEOVER byte %01110010, %01101101, %10010010, %10110110 byte %10000101, %01010101, %00101010, %10100101 byte %10110111, %01010101, %10101010, %10110110 byte %10010101, %01000101, %00101010, %10100101 byte %01100101, %01000101, %10010001, %00110101 ; PAUSE byte %00000001, %10001001, %01001101, %11000000 byte %00000001, %01010101, %01010001, %00000000 byte %00000001, %10011101, %01001001, %10000000 byte %00000001, %00010101, %01000101, %00000000 byte %00000001, %00010100, %10011001, %11000000 ; TIME UP byte %00011101, %01101101, %10000101, %01100000 byte %00001001, %01010101, %00000101, %01010000 byte %00001001, %01010101, %10000101, %01100000 byte %00001001, %01000101, %00000101, %01000000 byte %00001001, %01000101, %10000010, %01000000 ; align 256 ;========================================================================== ; ; displayText ; ;-------------------------------------------------------------------------- ; This is part of the drawScore function. ; ; This part of the status kernal is located at the beginning ; of this bank since it's sensitive to page boundaries ;========================================================================== displayText ;-------------set up text to display lda frame and #1 tay ; default to blank display ldx #0 ; Set up test pointers stx pfBuffer lda #>statusText sta pfBuffer+1 lda p1Lives,y and #$F0 beq noPowerUpDisplay bpl useFirstPage inc pfBuffer+1 useFirstPage lsr lsr lsr lsr and #%00000111 tax noPowerUpDisplay lda level and #ENDGAME bne endStatusCheck lda titleOptions and #%01000000 beq checkGODisplay ; Pause ldx #9 jmp endStatusCheck checkGODisplay lda p1Status,y cmp #GAMEOVER bne notGameOver1 ; "GAMEOVER" ldx #8 jmp endStatusCheck notGameOver1 cmp #TIMEUP bne endStatusCheck ldx #10 endStatusCheck ;------------------------------------- sta WSYNC lda statusOffset,x tay clc adc #20 sta temp2 lda #STATUSCOLOR sta COLUP0 sta COLUP1 ;------------------------------------------------ ; Draw LEFT player status/powerup info ;------------------------------------------------ lda frame and #1 beq drawLeftSide jmp drawRightSide drawLeftSide sta RESP0 sta RESP1 lda #STATUSCOLOR sta COLUP0 sta COLUP1 lda #%01010000 sta HMP0 lda #%01100000 sta HMP1 lda #1 sta NUSIZ0 sta NUSIZ1 lda (pfBuffer),y sta GRP0 sta WSYNC sta HMOVE lda temp ; waste 3 cycles iLoop1 iny lda (pfBuffer),y sta GRP1 iny lda (pfBuffer),y tax iny lda (pfBuffer),y stx GRP0 sta GRP1 iny lda (pfBuffer),y sta GRP0 sta WSYNC cpy temp2 bne iLoop1 lda #0 sta GRP0 sta GRP1 jmp rtnDrawScore ; align 64 ;------------------------------------------------ ; Draw RIGHT player status/powerup info ;------------------------------------------------ drawRightSide lda #%00110000 sta HMP0 lda #%01000000 sta HMP1 lda #1 sta NUSIZ0 sta NUSIZ1 nop nop nop sta RESP0 sta RESP1 sta WSYNC sta HMOVE lda temp iLoop2 lda (pfBuffer),y sta GRP0 iny lda (pfBuffer),y sta GRP1 iny lda (pfBuffer),y tax iny lda (pfBuffer),y iny nop nop nop nop nop nop nop nop stx GRP0 sta GRP1 STA WSYNC cpy temp2 bne iLoop2 lda #0 sta GRP0 sta GRP1 jmp rtnDrawScore grpDigitRef1 byte 0,3,6,6, 9,6,6,12, 6,15,0,0, 0,0,0,0 byte 18,21,24,24, 27,24,24,30, 24,33,0,0, 0,0,0,0 byte 36,39,42,42, 45,42,42,48, 42,51,0,0, 0,0,0,0 byte 36,39,42,42, 45,42,42,48, 42,51,0,0, 0,0,0,0 byte 54,57,60,60, 63,60,60,66, 60,69,0,0, 0,0,0,0 byte 36,39,42,42, 45,42,42,48, 42,51,0,0, 0,0,0,0 byte 36,39,42,42, 45,42,42,48, 42,51,0,0, 0,0,0,0 byte 72,75,78,78, 81,78,78,84, 78,87,0,0, 0,0,0,0 byte 36,39,42,42, 45,42,42,48, 42,51,0,0, 0,0,0,0 byte 90,93,96,96, 99,96,96,102, 96,105,0,0, 0,0,0,0 marbleFrame byte 0,4,0,2 marbleFallingFrame byte 8,8,8,6 ;========================================================================== ; ; Draw Score ; ;========================================================================== drawScore ;pfBuffer+0, pfBuffer+1 ;2,3 ;4,5 ;6,7 ; p1 grp ;pMarble equ pfBuffer + 8; 2 bytes ;temp3 equ $FE ; p2 grp ;pMarble2 equ pMarble + 2; 2 bytes ;temp4 equ $FF ; set up player 1 score lda #>pfDigits1 sta pfBuffer+1 sta pfBuffer+5 lda #>pfDigits2 sta pfBuffer+3 sta pfBuffer+7 ldy p1ScoreH ;3 lda pfDigitRef1,y sta pfBuffer+0 lda grpDigitRef1,y tay ldx p1ScoreL lda grpDigitRef1,x tax lda grpDigits1,y ora grpDigits2,x sta ENAM0 and #%01111101 sta GRP0 lda grpDigits1+1,y ora grpDigits2+1,x sta pMarble+1 lda grpDigits1+2,y ora grpDigits2+2,x sta temp3 ldy p1ScoreL ;3 lda pfDigitRef1,y sta pfBuffer+2 ; set up player 2 score ldy p2ScoreH ;3 lda pfDigitRef1,y sta pfBuffer+4 lda grpDigitRef1,y tay ldx p2ScoreL lda grpDigitRef1,x tax lda grpDigits1,y ora grpDigits2,x sta ENAM1 and #%01111101 sta GRP1 lda grpDigits1+1,y ora grpDigits2+1,x sta pMarble2+1 lda grpDigits1+2,y ora grpDigits2+2,x sta temp4 ldy p2ScoreL ;3 lda pfDigitRef1,y sta pfBuffer+6 ; lda pMarble ; sta ENAM0 ; and #%01111101 ; sta GRP0 lda #%00100111 sta NUSIZ0 sta NUSIZ1 lda #0 sta COLUP0 sta COLUP1 sta CTRLPF ; Set score color ldx #$0F lda level cmp #255 bne notTitle3 ; Dim score in title screen ldx #$04 notTitle3 STX COLUPF stx ENABL sta HMCLR lda #%01110000 sta HMM0 sta HMM1 ; if title screen is active, don't show ball (divider line) lda level cmp #255 bne notTitle2 lda #0 sta ENABL notTitle2 lda p1Lives and #$0F sta pMarble lda p2Lives and #$0F sta pMarble2 lda pMarble2 tax lda livesDisplay,x sta temp5 lda pMarble tax lda livesDisplay,x ;4 sta PF0 ;3 ; ***************** Wait for Timer ****************** ; Wait for timer timer2 LDA INTIM BNE timer2 ;Loops until the timer is done - that means we're ;somewhere in the last line of vertical blank. STA WSYNC ;End the current scanline - the last line of VBLANK. STA VBLANK ;End the VBLANK period. The TIA will display stuff ;starting with the next scanline. We do have 23 cycles ;of horizontal blank before it displays anything. ; Score Kernal ------------------------------------- ldy #0 lda (pfBuffer+0),y sta PF1 lda (pfBuffer+2),y sta PF2 lda temp5 sta PF0 ; lda pMarble2 ; sta ENAM1 ; and #%01111101 ; sta GRP1 nop nop nop nop lda temp ; waste 3 cycles lda (pfBuffer+4),y sta PF1 lda (pfBuffer+6),y sta PF2 iny lda #%01001001 sta GRP0 lda #255 sta ENAM0 ;-------------- sta WSYNC lda #0 ;2 sta PF0 ;3 lda (pfBuffer+0),y ;5 sta PF1 ;3 lda (pfBuffer+2),y ;5 sta PF2 ;3 ldx pMarble2 lda livesDisplay-1,x sta temp5 ldx pMarble lda #%01001001 ;2 sta GRP1 ;3 lda #255 ;2 sta ENAM1 ;3 lda (pfBuffer+4),y ;5 sta PF1 ;3 lda (pfBuffer+6),y ;5 sta PF2 ;3 ; iny lda #%01001001 ;2 sta GRP0 ;3 lda #255 ;2 sta ENAM0 ;3 ;-------------- sta WSYNC lda livesDisplay-1,x ;4 sta PF0 ;3 lda (pfBuffer+0),y sta PF1 lda (pfBuffer+2),y sta PF2 ; nop ; nop ; nop lda temp5 sta PF0 lda #%01001001 sta GRP1 lda #255 sta ENAM1 lda (pfBuffer+4),y sta PF1 lda (pfBuffer+6),y sta PF2 iny lda pMarble+1 sta ENAM0 and #%01111101 sta GRP0 lda #0 ;----------------- sta WSYNC sta PF0 lda (pfBuffer+0),y sta PF1 lda (pfBuffer+2),y sta PF2 ldx pMarble2 lda livesDisplay-2,x sta temp5 ldx pMarble lda pMarble2+1 sta ENAM1 and #%01111101 sta GRP1 lda (pfBuffer+4),y sta PF1 lda (pfBuffer+6),y sta PF2 iny lda #%01001001 sta GRP0 lda #255 sta ENAM0 ;--------------- sta WSYNC lda livesDisplay-2,x ;4 sta PF0 ;3 lda (pfBuffer+0),y sta PF1 lda (pfBuffer+2),y sta PF2 lda temp5 sta PF0 lda #%01001001 sta GRP1 lda #255 sta ENAM1 lda (pfBuffer+4),y sta PF1 lda (pfBuffer+6),y sta PF2 lda #%01001001 sta GRP0 lda #255 sta ENAM0 lda #0 ;--------------- sta WSYNC sta PF0 lda (pfBuffer+0),y sta PF1 lda (pfBuffer+2),y sta PF2 ldx pMarble2 lda livesDisplay-3,x sta temp5 ldx pMarble lda #%01001001 sta GRP1 lda #255 sta ENAM1 lda (pfBuffer+4),y sta PF1 lda (pfBuffer+6),y sta PF2 iny lda temp3 sta ENAM0 and #%01111101 sta GRP0 ;71 ;---------------- ;sta WSYNC lda livesDisplay-3,x ;4 sta PF0 ;3 lda (pfBuffer+0),y ;6 sta PF1 ;3 lda (pfBuffer+2),y ;6 sta PF2 ;3 ; Start setting up timer display ldx p1TimeH ;3 ;ldx #$25 lda pfDigitRef1,x ;4 sta pfBuffer+0 ;3 lda temp5 sta PF0 lda temp4 ;3 sta ENAM1 ;3 and #%01111101 ;2 sta GRP1 ;3 lda (pfBuffer+4),y ;6 sta PF1 ;3 lda (pfBuffer+6),y ;6 sta PF2 ;3 = 53 ; Start setting up timer display lda grpDigitRef1,x ;4 tay ;2 ;---------- end of score display lda p1TimeL ;3 sta WSYNC sta HMOVE and #$0F tax lda grpDigitRef1,x ;4 tax ;2 ;----------------------------------------------------------------- ; Draw Timers ;----------------------------------------------------------------- lda #0 sta PF0 sta PF1 sta PF2 sta GRP0 sta GRP1 sta ENAM0 sta ENAM1 lda #%00010111 sta NUSIZ0 sta NUSIZ1 ; Timers lda #>pfDigits3 sta pfBuffer+3 sta pfBuffer+7 lda #%11000000 sta HMP0 sta HMP1 lda #%01010000 sta HMM0 sta HMM1 ;sta COLUBK lda grpDigits1,y asl ora grpDigits3,x ; sta pMarble and #%11111101 sta GRP0 lda grpDigits1+1,y asl ora grpDigits3+1,x sta pMarble+1 lda grpDigits1+2,y asl ora grpDigits3+2,x sta temp3 lda level cmp #255 bne notTitleScreen jmp rtnTitleScore notTitleScreen lda p1TimeL ;3 and #$0F tay lda pfDigitRef1,y sta pfBuffer+2 ; set up player 2 score ldy p2TimeH ;3 lda pfDigitRef1,y sta pfBuffer+4 lda grpDigitRef1,y tay lda p2TimeL and #$0F tax lda grpDigitRef1,x tax lda grpDigits1,y asl ora grpDigits3,x sta pMarble2 lda grpDigits1+1,y asl ora grpDigits3+1,x sta pMarble2+1 lda grpDigits1+2,y asl ora grpDigits3+2,x sta temp4 lda p2TimeL ;3 and #$0F tay lda pfDigitRef1,y sta pfBuffer+6 lda #TIMECOLOR sta COLUPF sta WSYNC sta HMOVE ldx #$0F sta ENAM0 sta ENAM1 ; Timer Kernal ------------------------------------- ldy #0 lda (pfBuffer+0),y sta PF1 lda (pfBuffer+2),y sta PF2 ; nop nop lda pMarble2 nop and #%11111101 sta GRP1 stx COLUPF lda (pfBuffer+4),y sta PF1 lda #TIMECOLOR sta COLUPF lda (pfBuffer+6),y sta PF2 iny lda #%10010001 sta GRP0 ;-------------- sta WSYNC lda (pfBuffer+0),y sta PF1 lda (pfBuffer+2),y sta PF2 nop nop nop lda #%10010001 sta GRP1 lda #255 nop lda (pfBuffer+4),y sta PF1 lda (pfBuffer+6),y stx COLUPF sta PF2 lda #TIMECOLOR sta COLUPF lda #%10010001 sta GRP0 ;-------------- sta WSYNC lda (pfBuffer+0),y sta PF1 lda (pfBuffer+2),y sta PF2 nop nop nop lda #%10010001 sta GRP1 lda #255 nop lda (pfBuffer+4),y sta PF1 lda (pfBuffer+6),y stx COLUPF sta PF2 lda #TIMECOLOR sta COLUPF iny lda pMarble+1 and #%11111101 sta GRP0 ;----------------- sta WSYNC lda (pfBuffer+0),y sta PF1 lda (pfBuffer+2),y sta PF2 nop nop nop lda pMarble2+1 nop and #%11111101 sta GRP1 lda (pfBuffer+4),y sta PF1 lda (pfBuffer+6),y stx COLUPF sta PF2 lda #TIMECOLOR sta COLUPF iny lda #%10010001 sta GRP0 lda #255 ;--------------- sta WSYNC lda (pfBuffer+0),y sta PF1 lda (pfBuffer+2),y sta PF2 nop nop nop lda #%10010001 sta GRP1 lda #255 nop lda (pfBuffer+4),y sta PF1 lda (pfBuffer+6),y stx COLUPF sta PF2 lda #TIMECOLOR sta COLUPF lda #%10010001 sta GRP0 ;--------------- sta WSYNC lda (pfBuffer+0),y sta PF1 lda (pfBuffer+2),y sta PF2 nop nop nop lda #%10010001 sta GRP1 lda #255 nop lda (pfBuffer+4),y sta PF1 lda (pfBuffer+6),y stx COLUPF sta PF2 lda #TIMECOLOR sta COLUPF iny lda temp3 and #%11111101 sta GRP0 ;---------------- sta WSYNC lda (pfBuffer+0),y sta PF1 lda (pfBuffer+2),y sta PF2 nop nop nop lda temp4 nop and #%11111101 sta GRP1 lda (pfBuffer+4),y sta PF1 lda (pfBuffer+6),y stx COLUPF sta PF2 lda #TIMECOLOR sta COLUPF ;---------- last one lda #0 sta ENAM0 sta GRP0 ldx #$0F sta WSYNC stx COLUPF sta PF1 sta PF2 sta GRP1 sta ENAM1 ;------------------------------------------------------------------ ; Set Up Marble Shape Pointers ;------------------------------------------------------------------- ; Set up P0 (Left Player) ; Make it flash if it's in falloff/startup mode lda p1Status cmp #GAMEOVER beq noMarble lda p1Status cmp #FASTFLASH beq fastFlash and #FLASH and frame beq draw1 bne noMarble fastFlash lda #4 and frame beq draw1 noMarble ; Draw it off screen lda #>marbleData3 sta pMarble+1 lda #99 sta pMarble jmp noOffset draw1 ; Draw it normally lda #>marbleData2 sta pMarble+1 lda p1y sta pMarble ; For vertical values >100 a different page of image data is used cmp #100 bmi noOffset sbc #64 sta pMarble ;3 lda #>marbleData3 sta pMarble+1 noOffset ; Set up P1 (Right Player) ; Make it flash if it's in falloff/startup mode lda p2Status cmp #GAMEOVER beq noMarble2 lda p2Status cmp #FASTFLASH beq fastFlash2 and #FLASH and frame beq draw2 bne noMarble2 fastFlash2 lda #4 and frame beq draw2 noMarble2 ; Draw it off screen lda #>marbleData3 sta pMarble2+1 lda #99 sta pMarble2 jmp noOffset2 draw2 ; Draw it normally lda #>marbleData2 sta pMarble2+1 lda p2y sta pMarble2 ; For vertical values >100 a different page of image data is used cmp #100 bmi noOffset2 sbc #64 sta pMarble2 ;3 lda #>marbleData3 sta pMarble2+1 noOffset2 nop nop nop lda p1Counter ;3 lsr ;2 lsr ;2 lsr ;2 tay ;2 ;------------------------------- Alternate Marble Shapes lda p1Status cmp #FALLOFF sta WSYNC bne showRotation1 lda p1Counter and #16 beq clearMarble1 ; lda p1Counter ;3 ; lsr ;2 ; lsr ;2 ; lsr ;2 ; tay ;2 lda marbleFallingFrame,y clc adc pMarble+1 sta pMarble+1 jmp shape2 clearMarble1 ; Draw it off screen lda #>marbleData3 sta pMarble+1 lda #99 sta pMarble jmp shape2 showRotation1 ; Show rotation 1 lda p1y sbc p1x and #%00011000 lsr lsr lsr tay lda marbleFrame,y clc adc pMarble+1 sta pMarble+1 ;------------------- right player shape shape2 lda p2Status cmp #FALLOFF bne showRotation2 lda p2Counter and #16 beq clearMarble2 lda p2Counter lsr lsr lsr tay lda marbleFallingFrame,y clc adc pMarble2+1 sta pMarble2+1 jmp endShape clearMarble2 ; Draw it off screen lda #>marbleData3 sta pMarble2+1 lda #99 sta pMarble2 jmp endShape showRotation2 ; Show rotation 2 lda p2y sbc p2x and #%00011000 lsr lsr lsr tay lda marbleFrame,y clc adc pMarble2+1 sta pMarble2+1 endShape ; the rest of the status kernal is located at the beginning ; of this bank since it's sensitive to page boundaries jmp displayText include mcsong.asm ;========================================================================== ; ; readPattern2 caller ; ;-------------------------------------------------------------------------- ; I had to move part of the song pattern to bank 8 to ; fit the first song in here. ;========================================================================== org $4F80 rorg $1F80 callReadPattern2 stx BANK8 nop nop nop nop nop nop jmp rtnCallReadPattern2 ;========================================================================== ; ; songPlayer caller ; ;-------------------------------------------------------------------------- ; call function then switch back to bank 2. ;========================================================================== org $4FB3 rorg $1FB3 jmp songPlayer rtnSongPlayer stx BANK2 ;========================================================================== ; ; readPattern1 caller ; ;-------------------------------------------------------------------------- ; I had to move part of the song pattern to bank 8 to ; fit the first song in here. ;========================================================================== org $4FC0 rorg $1FC0 callReadPattern1 stx BANK8 nop nop nop nop nop nop jmp rtnCallReadPattern1 ;========================================================================== ; ; drawScore caller ; ;-------------------------------------------------------------------------- ; call function then switch back to bank 1. ;========================================================================== org $4FD3 rorg $1FD3 jmp drawScore rtnDrawScore stx BANK3 ;========================================================================== ; ; titleScore caller ; ;-------------------------------------------------------------------------- ; call function then switch back to bank 3. ;========================================================================== org $4FE3 rorg $1FE3 jmp drawScore rtnTitleScore stx BANK3 ;========================================================================== ; ; The cart may start up in this bank. Make sure it switches ; back to bank 2 on startup. ; ;========================================================================== org $4FED rorg $1FED sta BANK2 ; switch to bank 2 (3 bytes) org $4FFC ; Program startup vector .word $1FED .word $1FED
src/02-vehicles/change-vehicle-music.asm
chaoshades/snes-ffci
0
98095
<filename>src/02-vehicles/change-vehicle-music.asm<gh_stars>0 org $808B74 ; Hack directly into ROM skip 1 ; Skip to $808B75 db $0D ; Change music of canoe (Overworld) skip 1 ; Skip to $808B77 db $06 ; Change music of ship (Underworld)
Week_8-9/46 - scas_HW.asm
iamruveyda/KBU-Mikro
1
28047
<gh_stars>1-10 .model small .data DATA5 DB 'ABCDEFGHIJKLM' .code main proc MOV AX,@DATA ;Data segmentini kod bloguna/segmentine tanit. MOV DS,AX ;AX i data segmentine aktar. MOV ES,AX ;AX i extra segmente aktar. SUB CX, CX ;CX artik 00 00 SUB AL, AL ;AL artik 00 NOT CX ;CX artik FF FF CLD ;DF(Direction Flag)=0 ; islemler ileriye dogru REPNE ;Esit degilse yinele SCASB ;CL 1 azaltiyor. DI bir artiyor. NOT CX ;DI da ki cikan sonuc CX de oldu DEC CX ;CX den de 1 cikarinca uzunluk bulundu. ;DEC (decrease-azalt) komutu INC komutunun tersidir. ;buldugun degeri 1 azaltiyordu. MOV DI,OFFSET DATA5 MOV AL,'H' CLD REPNE SCASB JNZ quit ;harf bulmazsa cikar DEC DI quit: RET endp end main
src/gl/implementation/auto_exceptions/gl-raise_exception_on_opengl_error.adb
Roldak/OpenGLAda
79
10741
<gh_stars>10-100 -- part of OpenGLAda, (c) 2017 <NAME> -- released under the terms of the MIT license, see the file "COPYING" with GL.Errors; separate (GL) procedure Raise_Exception_On_OpenGL_Error is begin case Errors.Error_Flag is when Errors.Invalid_Operation => raise Errors.Invalid_Operation_Error; when Errors.Invalid_Value => raise Errors.Invalid_Value_Error; when Errors.Invalid_Framebuffer_Operation => raise Errors.Invalid_Framebuffer_Operation_Error; when Errors.Out_Of_Memory => raise Errors.Out_Of_Memory_Error; when Errors.Stack_Overflow => raise Errors.Stack_Overflow_Error; when Errors.Stack_Underflow => raise Errors.Stack_Underflow_Error; when Errors.Invalid_Enum => raise Errors.Internal_Error; when Errors.No_Error => null; end case; exception when Constraint_Error => raise Errors.Internal_Error; end Raise_Exception_On_OpenGL_Error;
src/Semantics/Substitution.agda
DimaSamoz/temporal-type-systems
4
16239
module Semantics.Substitution where open import Semantics.Substitution.Kits public open import Semantics.Substitution.Traversal public open import Semantics.Substitution.Instances public open import Semantics.Substitution.Soundness public
test/Fail/Issue1296/SolvedMeta.agda
shlevy/agda
1,989
14906
module Issue1296.SolvedMeta where open import Common.Prelude open import Common.Equality test : zero ≡ {!!} test = refl
8085_programming/YT/p1_add_2_nos.asm
SayanGhoshBDA/code-backup
16
166150
LXI H,2060 MOV A,M INX H MOV B,M ADD B STA 2062 HLT // to store the memory contents # ORG 2060H # DB 20H,50H
lib/ayacc/ayacc-initialize-get_arguments.adb
alvaromb/Compilemon
1
23566
<reponame>alvaromb/Compilemon with Command_Line_Interface; use Command_Line_Interface; with String_Pkg; use String_Pkg; --VAX with Vms_Lib; separate (Ayacc.Initialize) procedure Get_Arguments (File : out String_Type; C_Lex : out Switch; Debug : out Switch; Summary : out Switch; Verbose : out Switch; -- UMASS CODES : Error_Recovery : out Switch; -- END OF UMASS CODES. Extension : out String_Type) is C_Lex_Argument : String_Type; Debug_Argument : String_Type; Summary_Argument : String_Type; Verbose_Argument : String_Type; -- UMASS CODES : Error_Recovery_Argument : String_Type; -- END OF UMASS CODES. Positional : Natural := 0; -- Number of positional parameters Total : Natural := 0; -- Total number of parameters Max_Parameters : constant := 7; Incorrect_Call : exception; ---- function Convert_Switch is new ---- Convert (Parameter_Type => Switch, ---- Type_Name => "Switch"); function Convert_Switch (P: in String) return Switch is begin return Switch'Value ( P ); exception when Constraint_Error => ----CLI_Error ("Invalid Parameter, """ & ---- Value (Mixed (Parameter_Text)) & ---- """ is not a legal value for type " & ---- Value (Mixed (Type_Name)) & '.'); raise Invalid_Parameter; end Convert_Switch; procedure Put_Help_Message is begin New_Line; Put_Line (" -- Ayacc: An Ada Parser Generator."); New_Line; Put_Line (" type Switch is (On, Off);"); New_Line; Put_Line (" procedure Ayacc (File : in String;"); Put_Line (" C_Lex : in Switch := Off;"); Put_Line (" Debug : in Switch := Off;"); Put_Line (" Summary : in Switch := On;"); Put_Line (" Verbose : in Switch := Off;"); -- UMASS CODES : Put_Line (" Error_Recovery : in Switch := Off;"); -- END OF UMASS CODES. Put_Line (" Extension : in String := "".adb"");"); New_Line; Put_Line (" -- File Specifies the Ayacc Input Source File."); Put_Line (" -- C_Lex Specifies the Generation of a 'C' Lex Interface."); Put_Line (" -- Debug Specifies the Production of Debugging Output"); Put_Line (" -- By the Generated Parser."); Put_Line (" -- Summary Specifies the Printing of Statistics About the"); Put_Line (" -- Generated Parser."); Put_Line (" -- Verbose Specifies the Production of a Human Readable"); Put_Line (" -- Report of States in the Generated Parser."); -- UMASS CODES : Put_Line (" -- Error_Recovery Specifies the Generation of extension of"); Put_Line (" -- error recovery."); -- END OF UMASS CODES. Put_Line (" -- Extension Specifies the file extension to be used for"); Put_Line (" generated Ada files."); New_Line; end Put_Help_Message; begin --VAX Vms_Lib.Set_Error; Command_Line_Interface.Initialize (Tool_Name => "Ayacc"); Positional := Positional_Arg_Count; Total := Named_Arg_Count + Positional; if Total = 0 then raise Incorrect_Call; elsif Total > Max_Parameters then Put_Line ("Ayacc: Too many parameters."); raise Incorrect_Call; end if; -- Get named values File := Named_Arg_Value ("File", ""); C_Lex_Argument := Named_Arg_Value ("C_Lex", "Off"); Debug_Argument := Named_Arg_Value ("Debug", "Off"); Summary_Argument := Named_Arg_Value ("Summary", "On"); Verbose_Argument := Named_Arg_Value ("Verbose", "Off"); -- UMASS CODES : Error_Recovery_Argument := Named_Arg_Value ("Error_Recovery", "Off"); -- END OF UMASS CODES. Extension := Named_Arg_Value ("Extension", ".a"); -- Get any positional associations if Positional >= 1 then File := Positional_Arg_Value (1); if Positional >= 2 then C_Lex_Argument := Positional_Arg_Value (2); if Positional >= 3 then Debug_Argument := Positional_Arg_Value (3); if Positional >= 4 then Summary_Argument := Positional_Arg_Value (4); if Positional >= 5 then Verbose_Argument := Positional_Arg_Value (5); -- UMASS CODES : if Positional >= 6 then Error_Recovery_Argument := Positional_Arg_Value (5); -- END OF UMASS CODES. if Positional = Max_Parameters then Extension := Positional_Arg_Value (Max_Parameters); end if; -- UMASS CODES : end if; -- END OF UMASS CODES. end if; end if; end if; end if; end if; Command_Line_Interface.Finalize; C_Lex := Convert_Switch (Value (C_Lex_Argument)); Debug := Convert_Switch (Value (Debug_Argument)); Summary := Convert_Switch (Value (Summary_Argument)); Verbose := Convert_Switch (Value (Verbose_Argument)); -- UMASS CODES : Error_Recovery := Convert_Switch (Value (Error_Recovery_Argument)); -- END OF UMASS CODES. exception when Incorrect_Call | Invalid_Parameter | Invalid_Parameter_Order | Missing_Positional_Arg | Unreferenced_Named_Arg | Invalid_Named_Association | Unbalanced_Parentheses => Put_Help_Message ; raise Invalid_Command_Line ; end Get_Arguments;
programs/oeis/330/A330476.asm
neoneye/loda
22
94916
; A330476: a(n) = Sum_{m=2..n} floor(n/m)^2. ; 0,1,2,6,7,16,17,28,34,47,48,75,76,93,108,134,135,172,173,212,231,256,257,322,332,361,384,435,436,513,514,571,598,635,658,760,761,802,833,926,927,1028,1029,1104,1165,1214,1215,1358,1372,1453,1492,1579,1580,1705,1736,1857,1900,1961,1962,2167,2168,2233,2310,2430,2465,2614,2615,2726,2777,2918,2919,3154,3155,3232,3325,3448,3483,3656,3657,3860,3936,4021,4022,4291,4334,4423,4486,4663,4664,4941,4980,5127,5194,5291,5338,5639,5640,5781,5890,6116 mov $4,2 lpb $4 sub $4,1 add $0,$4 sub $0,1 mov $6,$4 lpb $0 mov $7,$0 sub $0,1 add $3,1 div $7,$3 mul $7,$6 add $5,$7 add $6,2 lpe mov $2,$4 lpb $2 add $1,$5 mov $2,0 lpe lpe mov $0,$1
testcode/mp3-cp2b.asm
tanishq-dubey/lc3processor
0
87135
SEGMENT CodeSegment: ; Version 0.11 1/13/2005 LEA R0, DataSegment NOP NOP NOP NOP NOP NOP BRnzp skip NOP NOP NOP NOP NOP NOP SEGMENT DataSegment: ZERO: DATA2 0 ONETWELVE: DATA2 112 ENT: DATA2 10 NINER: DATA2 9999 GECKO: DATA2 42 NOT6: DATA2 4xBAC8 THREE: DATA2 7 TREE: DATA2 3 BADBAD: DATA2 4x0BAD PAT1: DATA2 4x0D0D PAT2: DATA2 4x9884 PAT3: DATA2 4xAE85 GOOD: DATA2 4x5460 five: DATA2 5 TT: DATA2 4x646 RES1: DATA2 0 RES2: DATA2 0 RES3: DATA2 0 RES4: DATA2 0 RES5: DATA2 0 RES6: DATA2 0 RES7: DATA2 0 RES8: DATA2 0 RES9: DATA2 0 RES10: DATA2 0 RES11: DATA2 0 RES12: DATA2 0 RES13: DATA2 0 RES14: DATA2 0 RES15: DATA2 0 RES16: DATA2 0 Bear: DATA2 CatchMe Owl: DATA2 paris skip: LDR R1, R0, ZERO NOP NOP NOP NOP NOP NOP LDR R2, R0, ONETWELVE NOP NOP NOP NOP NOP NOP LDR R7, R0, ENT NOP NOP NOP NOP NOP NOP ADD R1, R2, R7 NOP NOP NOP NOP NOP NOP ADD R3, R1, -4 NOP NOP NOP NOP NOP NOP ADD R1, R1, R3 NOP NOP NOP NOP NOP NOP ADD R1, R1, R1 NOP NOP NOP NOP NOP NOP STR R1, R0, RES1 NOP NOP NOP NOP NOP NOP LDR R1, R0, NINER NOP NOP NOP NOP NOP NOP LDR R2, R0, GECKO NOP NOP NOP NOP NOP NOP AND R6, R1, R2 NOP NOP NOP NOP NOP NOP AND R5, R6, 10 NOP NOP NOP NOP NOP NOP STR R5, R0, RES2 NOP NOP NOP NOP NOP NOP LDR R7, R0, NOT6 NOP NOP NOP NOP NOP NOP NOT R7, R7 NOP NOP NOP NOP NOP NOP STR R7, R0, RES3 NOP NOP NOP NOP NOP NOP LDR R1, R0, PAT1 NOP NOP NOP NOP NOP NOP LSHF R2, R1, 4 NOP NOP NOP NOP NOP NOP RSHFL R3, R1, 2 NOP NOP NOP NOP NOP NOP LSHF R2, R2, 1 NOP NOP NOP NOP NOP NOP RSHFL R3, R3, 1 NOP NOP NOP NOP NOP NOP ADD R2, R2, R3 NOP NOP NOP NOP NOP NOP ADD R2, R2, 1 NOP NOP NOP NOP NOP NOP RSHFA R4, R1, 3 NOP NOP NOP NOP NOP NOP LDR R1, R0, PAT2 NOP NOP NOP NOP NOP NOP RSHFA R5, R1, 6 NOP NOP NOP NOP NOP NOP STR R2, R0, RES4 NOP NOP NOP NOP NOP NOP STR R4, R0, RES5 NOP NOP NOP NOP NOP NOP STR R5, R0, RES6 NOP NOP NOP NOP NOP NOP LEA R1, RES7 NOP NOP NOP NOP NOP NOP STR R1, R0, RES8 NOP NOP NOP NOP NOP NOP ADD R5, R5, 13 NOP NOP NOP NOP NOP NOP STI R5, R0, RES8 NOP NOP NOP NOP NOP NOP LDR R1, R0, TREE NOP NOP NOP NOP NOP NOP LDR R2, R0, THREE NOP NOP NOP NOP NOP NOP AND R3, R3, 0 NOP NOP NOP NOP NOP NOP loop1: ADD R2, R2, 5 NOP NOP NOP NOP NOP NOP ADD R1, R1, -1 NOP NOP NOP NOP NOP NOP BRp loop1 NOP NOP NOP NOP NOP NOP loop2: ADD R1, R1, 7 NOP NOP NOP NOP NOP NOP ADD R2, R2, -6 NOP NOP NOP NOP NOP NOP BRp loop2 NOP NOP NOP NOP NOP NOP BRz loop1 NOP NOP NOP NOP NOP NOP BRn miami NOP NOP NOP NOP NOP NOP LDR R2, R0, five NOP NOP NOP NOP NOP NOP miami: ADD R2, R2, R1 NOP NOP NOP NOP NOP NOP STR R2, R0, RES8 NOP NOP NOP NOP NOP NOP LDR R6, R0, ZERO NOP NOP NOP NOP NOP NOP JSR dallas NOP NOP NOP NOP NOP NOP STR R6, R0, RES9 NOP NOP NOP NOP NOP NOP AND R5, R5, 13 NOP NOP NOP NOP NOP NOP LEA R3, portland NOP NOP NOP NOP NOP NOP JMP R3 NOP NOP NOP NOP NOP NOP LDR R5, R0, BADBAD NOP NOP NOP NOP NOP NOP portland: STR R5, R0, RES10 NOP NOP NOP NOP NOP NOP LDR R5, R0, BADBAD NOP NOP NOP NOP NOP NOP TRAP Bear NOP NOP NOP NOP NOP NOP STR R5, R0, RES11 NOP NOP NOP NOP NOP NOP AND R1, R1, 0 NOP NOP NOP NOP NOP NOP ADD R1, R1, 8 NOP NOP NOP NOP NOP NOP ADD R1, R1, 9 NOP NOP NOP NOP NOP NOP LDB R2, R0, PAT3 NOP NOP NOP NOP NOP NOP LDB R3, R1, PAT3 NOP NOP NOP NOP NOP NOP ADD R4, R3, R2 NOP NOP NOP NOP NOP NOP STR R4, R0, RES12 NOP NOP NOP NOP NOP NOP ADD R2, R2, 11 NOP NOP NOP NOP NOP NOP ADD R3, R3, -2 NOP NOP NOP NOP NOP NOP LEA R1, DataSegment2 ;the following STB instructions store to mem[RES17] NOP NOP NOP NOP NOP NOP BRnzp skip2 NOP NOP NOP NOP NOP NOP SEGMENT DataSegment2: TS: DATA2 4x646 RES17: DATA2 0 RES18: DATA2 0 RES19: DATA2 0 CatchMe: LDR R5, R0, PAT3 NOP NOP NOP NOP NOP NOP NOT R5, R5 NOP NOP NOP NOP NOP NOP RET NOP NOP NOP NOP NOP NOP OverHere: LDR R3, R0, GOOD NOP NOP NOP NOP NOP NOP ADD R1, R1, R3 NOP NOP NOP NOP NOP NOP RET NOP NOP NOP NOP NOP NOP skip2: STB R2, R1, 3 NOP NOP NOP NOP NOP NOP STB R3, R1, 2 NOP NOP NOP NOP NOP NOP LDR R4, R1, RES17 NOP NOP NOP NOP NOP NOP STR R4, R0, RES13 NOP NOP NOP NOP NOP NOP LEA R3, TS NOP NOP NOP NOP NOP NOP STR R3, R0, RES15 NOP NOP NOP NOP NOP NOP LDI R3, R0, RES15 NOP NOP NOP NOP NOP NOP STR R3, R0, RES14 NOP NOP NOP NOP NOP NOP SEGMENT CodeSegment2: LEA R4, DataSegment4 NOP NOP NOP NOP NOP NOP LDR R2, R4, Indy NOP NOP NOP NOP NOP NOP ADD R2, R2, 3 NOP NOP NOP NOP NOP NOP AND R1, R1, 0 NOP NOP NOP NOP NOP NOP ; To test self-modifying code, uncomment ; the following lines and use the first 'Indy' ; STR R2, R4, Indy ; NOP ; NOP ; NOP ; NOP ; NOP ; NOP SEGMENT DataSegment4: ; Indy: ; ADD R1, R1, 9 Indy: ADD R1, R1, 12 NOP NOP NOP NOP NOP NOP STR R1, R0, RES16 NOP NOP NOP NOP NOP NOP ADD R1, R0, 1 NOP NOP NOP NOP NOP NOP LDR R3, R1, PAT3 NOP NOP NOP NOP NOP NOP LEA R6, DataSegment2 NOP NOP NOP NOP NOP NOP STR R3, R6, RES17 NOP NOP NOP NOP NOP NOP LDR R1, R0, PAT3 NOP NOP NOP NOP NOP NOP BRn Nati NOP NOP NOP NOP NOP NOP TRAP Owl NOP NOP NOP NOP NOP NOP Nati: LDR R1, R0, BADBAD NOP NOP NOP NOP NOP NOP LEA R2, OverHere NOP NOP NOP NOP NOP NOP JSRR R2 NOP NOP NOP NOP NOP NOP STR R1, R6, RES18 NOP NOP NOP NOP NOP NOP ADD R1, R0, 2 NOP NOP NOP NOP NOP NOP AND R6, R6, 0 NOP NOP NOP NOP NOP NOP BRz dulles NOP NOP NOP NOP NOP NOP ADD R1, R1, R1 NOP NOP NOP NOP NOP NOP dulles: LEA R6, DataSegment2 NOP NOP NOP NOP NOP NOP STR R1, R6, RES19 NOP NOP NOP NOP NOP NOP bloomington: LEA R5, DataSegment3 NOP NOP NOP NOP NOP NOP LDR R6, R5, DSP NOP NOP NOP NOP NOP NOP LDR R0, R6, RES1 LDR R1, R6, RES2 NOP NOP NOP NOP NOP NOP JSR atlanta NOP NOP NOP NOP NOP NOP LDR R1, R6, RES3 NOP NOP NOP NOP NOP NOP JSR atlanta NOP NOP NOP NOP NOP NOP STR R0, R5, CS1 LDR R0, R6, RES4 LDR R1, R6, RES5 NOP NOP NOP NOP NOP NOP JSR atlanta NOP NOP NOP NOP NOP NOP LDR R1, R6, RES6 NOP NOP NOP NOP NOP NOP JSR atlanta NOP NOP NOP NOP NOP NOP STR R0, R5, CS2 LDR R0, R6, RES7 LDR R1, R6, RES8 NOP NOP NOP NOP NOP NOP JSR atlanta NOP NOP NOP NOP NOP NOP STR R0, R5, CS3 LDR R0, R6, RES9 LDR R1, R6, RES10 NOP NOP NOP NOP NOP NOP JSR atlanta NOP NOP NOP NOP NOP NOP STR R0, R5, CS4 LDR R0, R6, RES11 LDR R1, R6, RES12 NOP NOP NOP NOP NOP NOP JSR atlanta NOP NOP NOP NOP NOP NOP STR R0, R5, CS5 LDR R0, R6, RES13 LDR R1, R6, RES14 NOP NOP NOP NOP NOP NOP JSR atlanta NOP NOP NOP NOP NOP NOP STR R0, R5, CS6 LDR R0, R6, RES15 LDR R1, R6, RES16 NOP NOP NOP NOP NOP NOP JSR atlanta NOP NOP NOP NOP NOP NOP STR R0, R5, CS7 LDR R6, R5, DS2P NOP NOP NOP NOP NOP NOP LDR R0, R6, RES17 LDR R1, R6, RES18 NOP NOP NOP NOP NOP NOP JSR atlanta NOP NOP NOP NOP NOP NOP LDR R1, R6, RES19 NOP NOP NOP NOP NOP NOP JSR atlanta NOP NOP NOP NOP NOP NOP STR R0, R5, CS8 LEA R7, DataSegment3 NOP NOP NOP NOP NOP NOP LDR R0, R7, CS1 LDR R1, R7, CS2 LDR R2, R7, CS3 LDR R3, R7, CS4 LDR R4, R7, CS5 LDR R5, R7, CS6 LDR R6, R7, CS7 LDR R7, R7, CS8 NOP NOP NOP NOP NOP NOP Nowhere: BRnzp nowhere NOP NOP NOP NOP NOP NOP SEGMENT DataSegment3: NINE: DATA2 4x0009 BIGNUMBER: DATA2 4x70CF BYP1: DATA2 4x0000 BYP2: DATA2 4x0000 CS1: DATA2 4x0000 CS2: DATA2 4x0000 CS3: DATA2 4x0000 CS4: DATA2 4x0000 CS5: DATA2 4x0000 CS6: DATA2 4x0000 CS7: DATA2 4x0000 CS8: DATA2 4x0000 DSP: DATA2 DataSegment DS2P: DATA2 DataSegment2 dallas: NOT R6, R7 NOP NOP NOP NOP NOP NOP RET NOP NOP NOP NOP NOP NOP atlanta: AND R2, R0, R1 NOP NOP NOP NOP NOP NOP NOT R2, R2 NOT R0, R0 NOT R1, R1 NOP NOP NOP NOP NOP NOP AND R0, R0, R1 NOP NOP NOP NOP NOP NOP NOT R0, R0 NOP NOP NOP NOP NOP NOP AND R0, R0, R2 NOP NOP NOP NOP NOP NOP RET NOP NOP NOP NOP NOP NOP paris: LDR R1, R0, BADBAD NOP NOP NOP NOP NOP NOP LDB R1, R0, NINER NOP NOP NOP NOP NOP NOP LDB R2, R0, GECKO NOP NOP NOP NOP NOP NOP LDR R3, R0, THREE NOP NOP NOP NOP NOP NOP LDR R4, R0, ZERO NOP NOP NOP NOP NOP NOP
oeis/062/A062113.asm
neoneye/loda-programs
11
91631
<reponame>neoneye/loda-programs ; A062113: a(0)=1; a(1)=2; a(n) = a(n-1) + a(n-2)*(3 - (-1)^n)/2. ; Submitted by <NAME>(s2) ; 1,2,3,7,10,24,34,82,116,280,396,956,1352,3264,4616,11144,15760,38048,53808,129904,183712,443520,627232,1514272,2141504,5170048,7311552,17651648,24963200,60266496,85229696,205762688,290992384,702517760,993510144,2398545664,3392055808,8189147136,11581202944,27959497216,39540700160,95459694592,135000394752,325919783936,460920178688,1112759746560,1573679925248,3799199418368,5372879343616,12971278180352,18344157523968,44286713884672,62630871408640,151204299177984,213835170586624,516243768942592 add $0,2 mov $2,2 lpb $0 sub $0,2 add $1,$2 add $2,$1 mul $1,2 lpe lpb $0 sub $0,1 add $2,$1 lpe mov $0,$2 div $0,4
env/zx/backups/querycsv.old2.asm
pjshumphreys/querycsv
18
161673
<gh_stars>10-100 ;10 CLEAR VAL "46000":RANDOMIZE USR VAL "{BE}23636*256+{BE}23635+70":REM ;10 CLEAR VAL "46000":PRINT"Filename?":INPUT LINE a$:RANDOMIZE USR VAL "49155" ;prevent assembly code from being listed defb 0x0d defb 0xff ;ensure bank 0 is selected ld a, (0x5b5c) ; Previous value of port and 0xf8 ; Select bank 0 ld bc, 0x7ffd di ld (0x5b5c), a out (C), a ei ;load "" code ld ix,0xc000 ; 14t - memory to load into ld de,0x30 ; 10t - 613bytes ld a,255 ; 7t - set type to data scf ; 4t - set carry flag for error checking ;; following part replicates the ROM routing so can skip break to basic inc d ; 4t - resets zero flag ; 4t - replicate ROM routine ex af,af' dec d ; 4t - restore d di ; 4t - disable interrupts call 0x0562 ; 17t - call ROM routine LD_BYTES+12 to skip break to basic ei ; 4t - re-enable interrupts ;randomize usr 49152 jp c,0xc000 ; 12/7t - if carry then jump to error routine otherwise continue
src/main_simulator.adb
thomas070605/shoot-n-loot
0
19325
<gh_stars>0 -- Shoot'n'loot -- Copyright (c) 2021 <NAME> with Menus; procedure Main_Simulator is begin Menus.Run; end Main_Simulator;
AssemblyLanguage_Lab/ASB_LAB_4/test1.asm
strawberrylin/Hust_CS_Lab
1
6071
;main source code ;@author strawberrylin name first extern Sort:far,Print:far public store,num,TIPS .386 ;宏定义9号功能 write macro a lea dx, a mov ah, 9 int 21h endm read macro b lea dx, b mov ah, 10 int 21h endm data segment use16 para public 'data1' bufc db '1:Input the name and score',0ah,0dh, '2:Figure the sum and the average score',0ah,0dh, '3:Sort the score',0ah,0dh, '4:Output the score from high to low',0ah,0dh, '5:Exit...',0ah,0dh, 'Enter your choose:','$' buft2 db 0ah,0dh,'Input name:$' buft3 db 0ah,0dh,'Input chinese score:$' buft4 db 0ah,0dh,'Input math score:$' buft5 db 0ah,0dh,'Input english score:$' buf db 20 db ? db 20 dup(0) num dw 0 store db 200 dup(0) TIPS db 0ah,0dh,'INFORMATIONS AS FOLLOWS:',0ah,0dh,'$' ;信息输出提示语 PRJE DB 0ah,0dh,'PROJECT IS GOING TO EXIT!PRESS ANY KEY TO EXIT!$' ;结束提示语 data ends stack segment use16 para stack 'stack' db 200 dup(0) stack ends code segment use16 para public 'code' assume ds:data,cs:code,ss:stack start: mov ax, data mov ds, ax lea di, store ; 信息储存位置 mov cx, 0 ; 学生数 show: write bufc mov ah, 1 ;input choose int 21h cmp al, '1' jz function1 cmp al, '2' jz function2 cmp al, '3' jz function3 cmp al, '4' jz function4 cmp al, '5' jz function5 jmp show function1: call far ptr INFOIN jmp show function2: call AVG jmp show function3: call far ptr Sort jmp show function4: call far ptr Print jmp show function5: write PRJE mov ah,1 int 21h mov ah, 4ch int 21h code ends ;子程序名:AVG ;功能:计算平均成绩 ;入口参数:储存学生信息的内存地址 store ;出口参数:无 procg segment use16 assume cs:procg AVG proc far push si push cx push dx push ax mov cx, num mov ax, 0 lea si,store add si, 10 fig: mov bl, [si] mov bh, 0 add ax, bx mov bl, [si+1] mov bh, 0 add ax, bx mov bl, [si+2] add ax, bx mov dh, 0 mov dl, 3 div dl mov [si+3], al add si, 16 dec cx jnz fig pop ax pop dx pop cx pop si ret AVG endp procg ends ;子程序名:INFOIN ;功能:录入学生信息 ;入口参数:储存学生信息的内存地址的di ;出口参数:无 proce segment use16 assume cs:proce INFOIN proc far inc cx mov num,cx push dx push ax push cx push si write buft2 read buf mov cl, buf+1 mov ch, 0 lea si, buf+2 begin: mov al, [si] mov [di], al inc si inc di dec cx jnz begin mov byte ptr [di], '$' mov cl, buf+1 mov ch, 0 add di, 10 sub di, cx write buft3 call GSCORE write buft4 call GSCORE write buft5 call GSCORE inc di mov byte ptr [di], 0ah ;在平均成绩后加入'0ah' '0dh' '$' inc di mov byte ptr [di], 0dh ; inc di mov byte ptr [di],'$' ;输出 pop si pop cx pop ax pop dx ret INFOIN endp ;子程序名:GSCORE ;功能:得到输入的成绩 ;入口参数:储存学生信息的偏移地址di ;出口参数:ax,存储对应的成绩 GSCORE proc push dx push bx push si push cx read buf mov cl, buf+1 lea si, buf+2 mov ax, 0 loapi: mov bl, [si] sub bl, 30h mov bh, 0 imul ax, 10 add ax, bx inc si dec cx jnz loapi mov [di], al inc di pop cx pop si pop bx pop dx ret GSCORE endp proce ends end start
bucket_4C/AdaBrowse/patches/patch-ad-setup.ads
jrmarino/ravensource
17
8894
<reponame>jrmarino/ravensource<filename>bucket_4C/AdaBrowse/patches/patch-ad-setup.ads --- ad-setup.ads.orig 2021-09-04 15:36:33 UTC +++ ad-setup.ads @@ -11,6 +11,6 @@ package AD.Setup is private GNAT_Name : constant String := - "gcc"; + "ada"; end AD.Setup;
src/tk/tk-menu.ads
thindil/tashy2
2
13437
-- Copyright (c) 2020-2021 <NAME> <<EMAIL>> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with Tcl.Strings; use Tcl.Strings; with Tk.Widget; use Tk.Widget; -- ****h* Tk/Menu -- FUNCTION -- Provides code for manipulate Tk widget menu -- SOURCE package Tk.Menu is -- **** --## rule off REDUCEABLE_SCOPE -- ****t* Menu/Menu.Tk_Menu -- FUNCTION -- The Tk identifier of the menu -- HISTORY -- 8.6.0 - Added -- SOURCE subtype Tk_Menu is Tk_Widget; -- **** -- ****t* Menu/Menu.Menu_Types -- FUNCTION -- The types of menu -- OPTIONS -- NONE - If used in setting the menu type, then the menu type will be -- set to default type -- MEMUBAR - The menu will be set as the main application menu bar -- TEAROFF - The menu will be show as separated window -- NORMAL - The menu will be show as the standard menu -- HISTORY -- 8.6.0 - Added -- SOURCE type Menu_Types is (NONE, MENUBAR, TEAROFF, NORMAL) with Default_Value => NONE; -- **** -- ****d* Menu/Menu.Default_Menu_Type -- FUNCTION -- Default Tk menu type -- HISTORY -- 8.6.0 - Added -- SOURCE Default_Menu_Type: constant Menu_Types := NORMAL; -- **** -- ****s* Menu/Menu.Menu_Options -- FUNCTION -- Data structure for all available options for the Tk menu -- OPTIONS -- Active_Background - Background color when menu is active (mouse is -- over the menu) -- Active_Border_Width - The width of border drawed around active menu -- Active_Foreground - Foreground color when menu is active -- Background - Normal background color of the menu -- Border_Width - The width of the menu's border -- Disabled_Foreground - Foreground color when the menu is disabled -- Font - The Tk font which will be used to draw text on the menu -- Foreground - Normal foreground color of the menu -- Relief - 3-D effect desired for the menu -- Post_Command - The Tcl command executed before the menu is posted -- Tear_Off - If true, the menu can be torn off, otherwise this option -- is disabled -- Tear_Off_Command - The Tcl command executed when the menu will be torn off -- Title - The title of the torn off menu -- Menu_Type - The type of the menu. It can be set only during creation. -- Later even if this option is changed, the menu behavior is -- not. -- HISTORY -- 8.6.0 - Added -- SOURCE type Menu_Options is new Widget_Options with record Active_Background: Tcl_String := Null_Tcl_String; Active_Border_Width: Pixel_Data := Empty_Pixel_Data; Active_Foreground: Tcl_String := Null_Tcl_String; Background: Tcl_String := Null_Tcl_String; Border_Width: Pixel_Data := Empty_Pixel_Data; Disabled_Foreground: Tcl_String := Null_Tcl_String; Font: Tcl_String := Null_Tcl_String; Foreground: Tcl_String := Null_Tcl_String; Relief: Relief_Type := NONE; Post_Command: Tcl_String := Null_Tcl_String; Select_Color: Tcl_String := Null_Tcl_String; Tear_Off: Extended_Boolean := NONE; Tear_Off_Command: Tcl_String := Null_Tcl_String; Title: Tcl_String := Null_Tcl_String; Menu_Type: Menu_Types := NONE; end record; -- **** -- ****t* Menu/Menu.Menu_Item_Types -- FUNCTION -- Available types of menu items (entries) -- OPTIONS -- CASCADE - The item is a submenu with own entries -- CHECKBUTTON - The item is a checkbutton -- COMMAND - The standard menu item -- RADIOBUTTON - The item is a radiobutton -- SEPARATOR - The item is a separator line, no command associated with it -- HISTORY -- 8.6.0 - Added -- SOURCE type Menu_Item_Types is (CASCADE, CHECKBUTTON, COMMAND, RADIOBUTTON, SEPARATOR) with Default_Value => COMMAND; -- **** -- ****d* Menu/Menu.Default_Menu_Item -- FUNCTION -- Default type for Tk menu item -- HISTORY -- 8.6.0 - Added -- SOURCE Default_Menu_Item: constant Menu_Item_Types := COMMAND; -- **** -- ****s* Menu/Menu.Menu_Item_Options -- FUNCTION -- Data structure for all available options for the Tk menu entries (items). -- Available options depends on Item_Type of menu item. -- OPTIONS -- Item_Type - Type of item which options will be get or set. SEPARATOR -- menu item don't have any options. -- Active_Background - Background color when menu entry is active (mouse is -- over the menu) -- Active_Foreground - Foreground color when menu entry is active -- Accelerator - Text which will be show on the right side of the menu entry. -- The most often it is keyboard shortcut for the entry. -- Background - Normal background color of the menu entry -- Bitmap - Specifies bitmap to display instead of text on the menu entry -- Column_Break - If True, the menu entry appears on at the top of new column in -- menu. Otherwise it appears below the previous menu entry. -- Command - The Tcl command to execute when the menu entry is invoked -- Compound - Specifies if menu entry should display image and text and if -- so, where image will be placed relative to text -- Font - The Tk font which will be used for the menu entry -- Foreground - Normal foreground color of the menu entry -- Hide_Margin - If False, draw standard margin around the menu entry. Otherwise -- margins are hidden -- Image - Specifies Tk image to show on the menu entry -- Label - Specifies text which will be displayed on the menu entry -- State - The state of the menu entry. Disabled menu entries cannot be -- invoked. -- Underline - Index of the character in Label which will be underlined. Used -- mostly to indicate keyboard shortcut for the menu entry. -- Menu - The submenu of the menu entry. Available only for CASCADE -- Item_Type. -- Indicator_On - If True, show the menu entry indicator. Available only for -- RADIOBUTTON and CHECKBUTTON Item_Type. -- Select_Color - The color of indicator when the menu entry is selected. Available -- only for RADIOBUTTON and CHECKBUTTON Item_Type. -- Select_Image - The image displayed when the menu entry is selected. Available -- only for RADIOBUTTON and CHECKBUTTON Item_Type. -- Variable - The name of Tcl global variable which will be set when the menu -- entry is selected. Available only for RADIOBUTTON and CHECKBUTTON -- Item_Type -- Off_Value - The value of the associated Variable when the menu entry is not -- selected. Available only for CHECKBUTTON Item_Type. -- On_Value - The value of the associated Variable when the menu entry is -- selected. Available only for CHECKBUTTON Item_Type. -- Value - The value of the associated Variable when the menu entry is -- selected. Available only for RADIOBUTTON Item_Type. -- HISTORY -- 8.6.0 - Added -- SOURCE type Menu_Item_Options(Item_Type: Menu_Item_Types := COMMAND) is record case Item_Type is when CASCADE | CHECKBUTTON | COMMAND | RADIOBUTTON => Active_Background: Tcl_String := Null_Tcl_String; Active_Foreground: Tcl_String := Null_Tcl_String; Accelerator: Tcl_String := Null_Tcl_String; Background: Tcl_String := Null_Tcl_String; Bitmap: Tcl_String := Null_Tcl_String; Column_Break: Extended_Boolean := NONE; Command: Tcl_String := Null_Tcl_String; Compound: Place_Type := EMPTY; Font: Tcl_String := Null_Tcl_String; Foreground: Tcl_String := Null_Tcl_String; Hide_Margin: Extended_Boolean := NONE; Image: Tcl_String := Null_Tcl_String; Label: Tcl_String := Null_Tcl_String; State: State_Type := NONE; Underline: Extended_Natural := -1; case Item_Type is when CASCADE => Menu: Tk_Menu := Null_Widget; when CHECKBUTTON | RADIOBUTTON => Indicator_On: Extended_Boolean := NONE; Select_Color: Tcl_String := Null_Tcl_String; Select_Image: Tcl_String := Null_Tcl_String; Variable: Tcl_String := Null_Tcl_String; case Item_Type is when CHECKBUTTON => Off_Value: Tcl_String := Null_Tcl_String; On_Value: Tcl_String := Null_Tcl_String; when RADIOBUTTON => Value: Tcl_String := Null_Tcl_String; when others => null; end case; when others => null; end case; when SEPARATOR => null; end case; end record; -- **** -- ****d* Menu/Menu.Default_Menu_Item_Options -- FUNCTION -- Default values for options for Tk menu item -- HISTORY -- 8.6.0 - Added -- SOURCE Default_Menu_Item_Options: constant Menu_Item_Options := Menu_Item_Options'(others => <>); -- **** -- ****t* Menu/Menu.Menu_Item_Indexes -- FUNCTION -- Available types of menu entries indexes -- OPTIONS -- ACTIVE - The currently active menu entry. If no active entry, then -- the same as NONE -- MENU_END - The last entry in the menu -- LAST - The last entry in the menu (same as MENU_END) -- NONE - The none entry. Used mostly in resetting active state -- HISTORY -- 8.6.0 - Added -- SOURCE type Menu_Item_Indexes is (ACTIVE, MENU_END, LAST, NONE) with Default_Value => NONE; -- **** -- ****d* Menu/Menu.Empty_Menu_Item_Index -- FUNCTION -- Empty index type for menu item -- HISTORY -- 8.6.0 - Added -- SOURCE Empty_Menu_Item_Index: constant Menu_Item_Indexes := NONE; -- **** -- ****f* Menu/Menu.Create_(function) -- FUNCTION -- Create a new Tk menu widget with the selected pathname and options -- PARAMETERS -- Path_Name - Tk pathname for the newly created menu -- Options - Options for the newly created menu -- Interpreter - Tcl interpreter on which the menu will be created. Can -- be empty. Default value is the default Tcl interpreter -- RESULT -- The Tk identifier of the newly created menu widget or Null_Widget if -- the menu cannot be created -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Create the menu with pathname .mymenu with disabled tear off option -- My_Menu: constant Tk_Menu := Create(".mymenu", Menu_Options'(Tear_Off => False, others => <>)); -- SEE ALSO -- Menu.Create_(procedure) -- COMMANDS -- menu Path_Name Options -- SOURCE function Create (Path_Name: Tk_Path_String; Options: Menu_Options; Interpreter: Tcl_Interpreter := Get_Interpreter) return Tk_Menu with Pre'Class => Path_Name'Length > 0 and Interpreter /= Null_Interpreter, Test_Case => (Name => "Test_Create_Menu1", Mode => Nominal); -- **** -- ****f* Menu/Menu.Create_(procedure) -- FUNCTION -- Create a new Tk menu widget with the selected pathname and options -- PARAMETERS -- Menu_Widget - Tk_Menu identifier which will be returned -- Path_Name - Tk pathname for the newly created menu -- Options - Options for the newly created menu -- Interpreter - Tcl interpreter on which the menu will be created. Can -- be empty. Default value is the default Tcl interpreter -- OUTPUT -- The Menu_Widget parameter as Tk identifier of the newly created menu -- widget or Null_Widget if the menu cannot be created -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Create the menu with pathname .mymenu with disabled tear off option -- declare -- My_Menu: Tk_Menu; -- begin -- Create(My_Menu, ".mymenu", Menu_Options'(Tear_Off => False, others => <>)); -- end; -- SEE ALSO -- Menu.Create_(function) -- COMMANDS -- menu Path_Name Options -- SOURCE procedure Create (Menu_Widget: out Tk_Menu; Path_Name: Tk_Path_String; Options: Menu_Options; Interpreter: Tcl_Interpreter := Get_Interpreter) with Pre'Class => Path_Name'Length > 0 and Interpreter /= Null_Interpreter, Test_Case => (Name => "Test_Create_Menu2", Mode => Nominal); -- **** -- ****f* Menu/Menu.Activate -- FUNCTION -- Set the selected menu entry as active -- PARAMETERS -- Menu_Widget - Tk_Menu widget in which the menu entry will be set as active -- Menu_Index - The index of the menu entry to activate -- Is_Index - If True, Menu_Index is numerical index of the menu entry, -- otherwise it is Y coordinate of the menu entry -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Set active the last element of the menu My_Menu -- Activate(My_Menu, LAST); -- COMMANDS -- Menu_Widget activate Menu_Index -- SOURCE procedure Activate(Menu_Widget: Tk_Menu; Menu_Index: Tcl_String) with Pre => Menu_Widget /= Null_Widget and Length(Source => Menu_Index) > 0, Test_Case => (Name => "Test_Activate_Menu", Mode => Nominal); procedure Activate (Menu_Widget: Tk_Menu; Menu_Index: Natural; Is_Index: Boolean := True) with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_Activate_Menu2", Mode => Nominal); procedure Activate(Menu_Widget: Tk_Menu; Menu_Index: Menu_Item_Indexes) with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_Activate_Menu3", Mode => Nominal); -- **** -- ****f* Menu/Menu.Add -- FUNCTION -- Add a new menu entry to the selected menu -- PARAMETERS -- Menu_Widget - Tk_Menu widget in which the new entry will be added -- Options - The options for the newly added entry -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Add to menu My_Menu entry with label "Quit" and quit from the program on activate -- Add(My_Menu, Menu_Item_Options'(Label => To_Tcl_String("Quit"), Command => To_Tcl_String("exit"), -- others => <>)); -- COMMANDS -- Menu_Widget add Item_Type Options -- SEE ALSO -- Menu.Insert -- SOURCE procedure Add(Menu_Widget: Tk_Menu; Options: Menu_Item_Options) with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_Add_Menu", Mode => Nominal); -- **** -- ****f* Menu/Menu.Get_Options -- FUNCTION -- Get all values of Tk options of the selected menu -- PARAMETERS -- Menu_Widget - Tk_Menu which options' values will be taken -- RESULT -- Menu_Options record with values of the selected menu options -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Get all values of option of menu with pathname .mymenu -- My_Menu_Options: constant Menu_Options := Get_Options(Get_Widget(".mymenu")); -- SEE ALSO -- Menu.Configure -- COMMANDS -- Menu_Widget configure -- SOURCE function Get_Options(Menu_Widget: Tk_Menu) return Menu_Options with Pre'Class => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_Get_Options_Menu", Mode => Nominal); -- **** -- ****f* Menu/Menu.Configure -- FUNCTION -- Set the selected options for the selected menu -- PARAMETERS -- Menu_Widget - Tk_Menu which options will be set -- Options - The record with new values for the menu options -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Disable tear off for menu with pathname .mymenu -- Configure(Get_Widget(".mymenu"), (Tear_Off => False, others => <>)); -- SEE ALSO -- Menu.Get_Options -- COMMANDS -- Menu_Widget configure Options -- SOURCE procedure Configure(Menu_Widget: Tk_Menu; Options: Menu_Options) with Pre'Class => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_Configure_Menu", Mode => Nominal); -- **** -- ****d* Menu/Menu.Default_Menu_Options -- FUNCTION -- Default Tk menu options values -- HISTORY -- 8.6.0 - Added -- SOURCE Default_Menu_Options: constant Menu_Options := Menu_Options'(others => <>); -- **** -- ****f* Menu/Menu.Delete -- FUNCTION -- Delete the selected menu entries from the selected menu -- PARAMETERS -- Menu_Widget - Tk_Menu from which the menu entries will be deleted -- Index1 - The index of the first menu entry to delete -- Index2 - The index of the last menu entry to delete. If empty, delete -- only the Index1 menu entry. Default value is empty -- Is_Index1 - If true, Index1 is numerical index of the menu entry. -- Otherwise it is Y coordinate of the menu entry. -- Is_Index2 - If true, Index2 is numerical index of the menu entry. -- Otherwise it is Y coordinate of the menu entry. -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Delete the last menu entry in My_Menu menu -- Delete(My_Menu, To_Tcl_String("end")); -- COMMANDS -- Menu_Widget delete Index1 ?Index2? -- SOURCE procedure Delete (Menu_Widget: Tk_Menu; Index1: Tcl_String; Index2: Tcl_String := To_Tcl_String(Source => "")) with Pre => Menu_Widget /= Null_Widget and Length(Source => Index1) > 0, Test_Case => (Name => "Test_Delete_Menu", Mode => Nominal); procedure Delete (Menu_Widget: Tk_Menu; Index1: Natural; Index2: Extended_Natural := -1; Is_Index1, Is_Index2: Boolean := True) with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_Delete_Menu2", Mode => Nominal); procedure Delete (Menu_Widget: Tk_Menu; Index1: Menu_Item_Indexes; Index2: Menu_Item_Indexes := NONE) with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_Delete_Menu3", Mode => Nominal); -- **** -- ****f* Menu/Menu.Entry_Get_Options -- FUNCTION -- Get all options of the selected menu entry in the selected menu -- PARAMETERS -- Menu_Widget - Tk_Menu from which the options for the selected menu entry -- will be get -- Menu_Index - The index of the menu entry which options will be get -- Is_Index - If true, Menu_Index is numerical index of the menu entry. -- Otherwise it is Y coordinate of the menu entry -- RESULT -- Menu_Item_Options record with options of the selected menu entry -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Get the options of the third menu entry in My_Menu menu -- Item_Options: constant Menu_Item_Options := Entry_Get_Options(My_Menu, 2)); -- COMMANDS -- Menu_Widget entryconfigure Menu_Index -- SEE ALSO -- Menu.Entry_Configure -- SOURCE function Entry_Get_Options (Menu_Widget: Tk_Menu; Menu_Index: Tcl_String) return Menu_Item_Options with Pre => Menu_Widget /= Null_Widget and Length(Source => Menu_Index) > 0, Test_Case => (Name => "Test_Entry_Get_Options_Menu", Mode => Nominal); function Entry_Get_Options (Menu_Widget: Tk_Menu; Menu_Index: Natural; Is_Index: Boolean := True) return Menu_Item_Options with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_Entry_Get_Options_Menu2", Mode => Nominal); function Entry_Get_Options (Menu_Widget: Tk_Menu; Menu_Index: Menu_Item_Indexes) return Menu_Item_Options with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_Entry_Get_Options_Menu3", Mode => Nominal); -- **** -- ****f* Menu/Menu.Entry_Configure -- FUNCTION -- Set options of the selected menu entry in the selected menu -- PARAMETERS -- Menu_Widget - Tk_Menu in which the menu entry options will be set -- Menu_Index - The index of the menu entry which options will be set -- Options - The new values of options for the selected menu entry -- Is_Index - If true, Menu_Index is numerical index of the menu entry. -- Otherwise it is Y coordinate of the menu entry -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Set the label for the first menu entry in My_Menu menu to "First element" -- Entry_Configure(My_Menu, 0, Menu_Item_Options'(Label => To_Tcl_String("First element"))); -- COMMANDS -- Menu_Widget entryconfigure Menu_Index Options -- SEE ALSO -- Menu.Entry_Get_Options -- SOURCE procedure Entry_Configure (Menu_Widget: Tk_Menu; Menu_Index: Tcl_String; Options: Menu_Item_Options) with Pre => Menu_Widget /= Null_Widget and Length(Source => Menu_Index) > 0, Test_Case => (Name => "Test_Entry_Configure_Menu", Mode => Nominal); procedure Entry_Configure (Menu_Widget: Tk_Menu; Menu_Index: Natural; Options: Menu_Item_Options; Is_Index: Boolean := True) with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_Entry_Configure_Menu2", Mode => Nominal); procedure Entry_Configure (Menu_Widget: Tk_Menu; Menu_Index: Menu_Item_Indexes; Options: Menu_Item_Options) with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_Entry_Configure_Menu3", Mode => Nominal); -- **** -- ****f* Menu/Menu.Index -- FUNCTION -- Get the numerical index of the selected menu entry in the selected -- menu -- PARAMETERS -- Menu_Widget - Tk_Menu in which the numerical index of menu entry will be -- get -- Menu_Index - The index of the menu entry which numerical index will be get -- RESULT -- Numerical index of the selected menu entry or -1 if menu entry was -- specified as NONE or "none" -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Get the numerical index of the last menu entry in My_Menu menu -- Number: constant Extended_Natural := Index(My_Menu, MENU_END); -- COMMANDS -- Menu_Widget index Menu_Index -- SOURCE function Index (Menu_Widget: Tk_Menu; Menu_Index: Tcl_String) return Extended_Natural with Pre => Menu_Widget /= Null_Widget and Length(Source => Menu_Index) > 0, Test_Case => (Name => "Test_Index_Menu", Mode => Nominal); function Index (Menu_Widget: Tk_Menu; Menu_Index: Natural) return Extended_Natural with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_Index_Menu2", Mode => Nominal); function Index (Menu_Widget: Tk_Menu; Menu_Index: Menu_Item_Indexes) return Extended_Natural with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_Index_Menu3", Mode => Nominal); -- **** -- ****f* Menu/Menu.Insert -- FUNCTION -- Insert a new menu entry into selected position in the selected menu -- PARAMETERS -- Menu_Widget - Tk_Menu widget in which the new entry will be inserted -- Menu_Index - The index on which the new menu entry will be inserted -- Item_Type - The type of menu entry to insert -- Options - The options for the newly inserted entry -- Is_Index - If true, Menu_Index is numerical index of the menu entry. -- Otherwise it is Y coordinate of the menu entry -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Insert into menu My_Menu entry with label "Quit" and quit from the program on activate on last position -- Insert(My_Menu, MENU_END, COMMAND, Menu_Item_Options'(Label => To_Tcl_String("Quit"), -- Command => To_Tcl_String("exit"), -- others => <>)); -- COMMANDS -- Menu_Widget insert Menu_Index Item_Type Options -- SEE ALSO -- Menu.Add -- SOURCE procedure Insert (Menu_Widget: Tk_Menu; Menu_Index: Tcl_String; Item_Type: Menu_Item_Types; Options: Menu_Item_Options) with Pre => Menu_Widget /= Null_Widget and Length(Source => Menu_Index) > 0, Test_Case => (Name => "Test_Insert_Menu", Mode => Nominal); procedure Insert (Menu_Widget: Tk_Menu; Menu_Index: Natural; Item_Type: Menu_Item_Types; Options: Menu_Item_Options; Is_Index: Boolean := True) with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_Insert_Menu2", Mode => Nominal); procedure Insert (Menu_Widget: Tk_Menu; Menu_Index: Menu_Item_Indexes; Item_Type: Menu_Item_Types; Options: Menu_Item_Options) with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_Insert_Menu3", Mode => Nominal); -- **** -- ****f* Menu/Menu.Invoke_(procedure) -- FUNCTION -- Invoke the Tcl command related to the selected menu entry in the -- selected menu -- PARAMETERS -- Menu_Widget - Tk_Menu in which the menu entry command will be invoked -- Menu_Index - The index of the menu entry which command will be invoked -- Is_Index - If true, Menu_Index is numerical index of the menu entry. -- Otherwise it is Y coordinate of the menu entry -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Invoke the first menu entry in My_Menu menu -- Invoke(My_Menu, 0); -- COMMANDS -- Menu_Widget invoke Menu_Index -- SEE ALSO -- Menu.Invoke_(function) -- SOURCE procedure Invoke(Menu_Widget: Tk_Menu; Menu_Index: Tcl_String) with Pre => Menu_Widget /= Null_Widget and Length(Source => Menu_Index) > 0, Test_Case => (Name => "Test_Invoke_Menu1", Mode => Nominal); procedure Invoke (Menu_Widget: Tk_Menu; Menu_Index: Natural; Is_Index: Boolean := True) with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_Invoke_Menu3", Mode => Nominal); procedure Invoke(Menu_Widget: Tk_Menu; Menu_Index: Menu_Item_Indexes) with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_Invoke_Menu4", Mode => Nominal); -- **** -- ****f* Menu/Menu.Invoke_(function) -- FUNCTION -- Invoke the Tcl command related to the selected menu entry in the -- selected menu -- PARAMETERS -- Menu_Widget - Tk_Menu in which the menu entry command will be invoked -- Menu_Index - The index of the menu entry which command will be invoked -- Is_Index - If true, Menu_Index is numerical index of the menu entry. -- Otherwise it is Y coordinate of the menu entry -- RESULT -- String with value returned by the invoked Tcl command -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Invoke the second menu entry in My_Menu menu -- Result: constant String := Invoke(My_Menu, 1); -- COMMANDS -- Menu_Widget invoke Menu_Index -- SEE ALSO -- Menu.Invoke_(procedure) -- SOURCE function Invoke (Menu_Widget: Tk_Menu; Menu_Index: Tcl_String) return String with Pre => Menu_Widget /= Null_Widget and Length(Source => Menu_Index) > 0, Test_Case => (Name => "Test_Invoke_Menu2", Mode => Nominal); function Invoke (Menu_Widget: Tk_Menu; Menu_Index: Natural; Is_Index: Boolean := True) return String with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_Invoke_Menu5", Mode => Nominal); function Invoke (Menu_Widget: Tk_Menu; Menu_Index: Menu_Item_Indexes) return String with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_Invoke_Menu6", Mode => Nominal); -- **** -- ****f* Menu/Menu.Post_(procedure) -- FUNCTION -- Show the selected menu at the selected root-window coordinates -- PARAMETERS -- Menu_Widget - Tk_Menu to show -- X - X coordinate of root-window where upper left corner of menu -- will be -- Y - Y coordinate of root-window where upper left corner of menu -- will be -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Show the menu My_Menu at location (10, 24) of root-window -- Post(My_Menu, 10, 24); -- COMMANDS -- Menu_Widget post X Y -- SEE ALSO -- Menu.Post_(function) -- SOURCE procedure Post(Menu_Widget: Tk_Menu; X, Y: Natural) with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_Post_Menu1", Mode => Nominal); -- **** -- ****f* Menu/Menu.Post_(function) -- FUNCTION -- Show the selected menu at the selected root-window coordinates and get -- the value returned by Post_Command Tcl command of the menu -- PARAMETERS -- Menu_Widget - Tk_Menu to show -- X - X coordinate of root-window where upper left corner of menu -- will be -- Y - Y coordinate of root-window where upper left corner of menu -- will be -- RESULT -- The value returned by the Post_Command Tcl command of the menu. If no -- Post_Command specified, return empty String. -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Show the menu My_Menu at location (20, 44) of root-window -- Result : constant String := Post(My_Menu, 10, 24); -- COMMANDS -- Menu_Widget post X Y -- SEE ALSO -- Menu.Post_(procedure), Menu.Unpost -- SOURCE function Post(Menu_Widget: Tk_Menu; X, Y: Natural) return String with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_Post_Menu2", Mode => Nominal); -- **** -- ****f* Menu/Menu.Post_Cascade -- FUNCTION -- Post the submenu associated with the selected CASCADE menu entry and -- unpost the previous submenu if visible -- PARAMETERS -- Menu_Widget - Tk_Menu in which the submenu will be show -- Menu_Index - Index of menu entry which submenu will be show -- Is_Index - If true, Menu_Index is numerical index of the menu entry. -- Otherwise it is Y coordinate of the menu entry -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Show the submenu of the second item in My_Menu menu -- Post_Cascade(My_Menu, 1); -- COMMANDS -- Menu_Widget postcascade Menu_Index -- SOURCE procedure Post_Cascade(Menu_Widget: Tk_Menu; Menu_Index: Tcl_String) with Pre => Menu_Widget /= Null_Widget and Length(Source => Menu_Index) > 0, Test_Case => (Name => "Test_PostCascade_Menu", Mode => Nominal); procedure Post_Cascade (Menu_Widget: Tk_Menu; Menu_Index: Natural; Is_Index: Boolean := True) with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_PostCascade_Menu2", Mode => Nominal); procedure Post_Cascade (Menu_Widget: Tk_Menu; Menu_Index: Menu_Item_Indexes) with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_PostCascade_Menu3", Mode => Nominal); -- **** -- ****f* Menu/Menu.Get_Item_Type -- FUNCTION -- Get the type of the selected menu entry in the selected menu -- PARAMETERS -- Menu_Widget - Tk_Menu in which the menu item type will be get -- Menu_Index - The index of the menu entry which type will be get -- Is_Index - If true, Menu_Index is numerical index of the menu entry. -- Otherwise it is Y coordinate of the menu entry -- RESULT -- The type of the selected menu entry -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Get the type of menu entry with label Quit in My_Menu menu -- Item_Type: constant Menu_Item_Types := Get_Item_Type(My_Menu, To_Tcl_String("Quit")); -- COMMANDS -- Menu_Widget type Menu_Index -- SOURCE function Get_Item_Type (Menu_Widget: Tk_Menu; Menu_Index: Tcl_String) return Menu_Item_Types with Pre => Menu_Widget /= Null_Widget and Length(Source => Menu_Index) > 0, Test_Case => (Name => "Test_Get_Item_Type_Menu", Mode => Nominal); function Get_Item_Type (Menu_Widget: Tk_Menu; Menu_Index: Natural; Is_Index: Boolean := True) return Menu_Item_Types with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_Get_Item_Type_Menu2", Mode => Nominal); function Get_Item_Type (Menu_Widget: Tk_Menu; Menu_Index: Menu_Item_Indexes) return Menu_Item_Types with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_Get_Item_Type_Menu3", Mode => Nominal); -- **** -- ****f* Menu/Menu.Unpost -- FUNCTION -- Hide the selected menu -- PARAMETERS -- Menu_Widget - Tk_Menu to hide -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Hide menu My_Menu -- Unpost(My_Menu); -- COMMANDS -- Menu_Widget unpost -- SEE ALSO -- Menu.Post -- SOURCE procedure Unpost(Menu_Widget: Tk_Menu) with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_Unpost_Menu", Mode => Nominal); -- **** -- ****f* Menu/Menu.X_Position -- FUNCTION -- Get the X pixel coordinate of top left corner of the selected menu -- entry in the selected menu -- PARAMETERS -- Menu_Widget - Tk_Menu in which coordinate will be get -- Menu_Index - The index of the menu entry which coordinate will be get -- Is_Index - If true, Menu_Index is numerical index of the menu entry. -- Otherwise it is Y coordinate of the menu entry -- RESULT -- X coordinate for the pixel of the top left corner of the selected -- menu -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Get the X coordinate for the first menu entry in My_Menu -- X: constant Natural := X_Position(My_Menu, 0); -- COMMANDS -- Menu_Widget xposition Menu_Index -- SEE ALSO -- Menu.Y_Position -- SOURCE function X_Position (Menu_Widget: Tk_Menu; Menu_Index: Tcl_String) return Natural with Pre => Menu_Widget /= Null_Widget and Length(Source => Menu_Index) > 0, Test_Case => (Name => "Test_X_Position_Menu", Mode => Nominal); function X_Position (Menu_Widget: Tk_Menu; Menu_Index: Natural; Is_Index: Boolean := True) return Natural with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_X_Position_Menu2", Mode => Nominal); function X_Position (Menu_Widget: Tk_Menu; Menu_Index: Menu_Item_Indexes) return Natural with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_X_Position_Menu3", Mode => Nominal); -- **** -- ****f* Menu/Menu.Y_Position -- FUNCTION -- Get the Y pixel coordinate of top left corner of the selected menu -- entry in the selected menu -- PARAMETERS -- Menu_Widget - Tk_Menu in which coordinate will be get -- Menu_Index - The index of the menu entry which coordinate will be get -- Is_Index - If true, Menu_Index is numerical index of the menu entry. -- Otherwise it is Y coordinate of the menu entry -- RESULT -- Y coordinate for the pixel of the top left corner of the selected -- menu -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Get the Y coordinate for the first menu entry in My_Menu -- Y: constant Natural := Y_Position(My_Menu, 0); -- COMMANDS -- Menu_Widget yposition Menu_Index -- SEE ALSO -- Menu.X_Position -- SOURCE function Y_Position (Menu_Widget: Tk_Menu; Menu_Index: Tcl_String) return Natural with Pre => Menu_Widget /= Null_Widget and Length(Source => Menu_Index) > 0, Test_Case => (Name => "Test_Y_Position_Menu", Mode => Nominal); function Y_Position (Menu_Widget: Tk_Menu; Menu_Index: Natural; Is_Index: Boolean := True) return Natural with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_Y_Position_Menu2", Mode => Nominal); function Y_Position (Menu_Widget: Tk_Menu; Menu_Index: Menu_Item_Indexes) return Natural with Pre => Menu_Widget /= Null_Widget, Test_Case => (Name => "Test_Y_Position_Menu3", Mode => Nominal); -- **** --## rule on REDUCEABLE_SCOPE end Tk.Menu;
tools/uaflex/regular_expressions.adb
faelys/gela-asis
4
5925
<reponame>faelys/gela-asis ------------------------------------------------------------------------------ -- G E L A A S I S -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license at the end of this file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $ package body Regular_Expressions is ---------------- -- Add_To_DFA -- ---------------- procedure Add_To_DFA (Result : in out Automatons.DFA; Item : in Expression; Starting : in Positive) is use Symbols; use Positions; use Automatons; type Literal_Array is array (Position range <>) of Expression; type Set_Array is array (Position range <>) of Set; procedure Walk (Item : in Expression; First : in out Set; Last : in out Set; Pos : in out Position); procedure Add_To_Follow (First : in Set; Last : in Set); procedure Get_State (Automaton : in out DFA; S : out State; Pos : in out Set; Starting : in Natural := 0); function Get_Follow (Object : Set) return Set; function Get_Follow (Object : in Set; Symbol : in Symbol_Set) return Set; function Distinct (Element : Iterator) return Symbol_Set_Array; Count : constant Position := Position (Literal_Count (Item)); Literals : Literal_Array (1 .. Count); Follow : Set_Array (1 .. Count); First : Set; Last : Set; Temp : Position := 1; ------------------- -- Add_To_Follow -- ------------------- procedure Add_To_Follow (First : in Set; Last : in Set) is Element : Iterator := Start (Last); begin while Exist (Element) loop Add (Follow (+Element), First); Element := Next (Element); end loop; end Add_To_Follow; -------------- -- Distinct -- -------------- function Distinct (Element : Iterator) return Symbol_Set_Array is function Count return Natural is Iter : Iterator := Element; Result : Natural := 0; begin while Exist (Iter) loop Result := Result + 1; Iter := Next (Iter); end loop; return Result; end Count; Iter : Iterator := Element; Index : Natural := 1; Result : Symbol_Set_Array (1 .. Count); begin while Exist (Iter) loop Result (Index) := Literals (+Iter).Chars; Index := Index + 1; Iter := Next (Iter); end loop; return Distinct_Symbol_Sets (Result); end Distinct; ---------------- -- Get_Follow -- ---------------- function Get_Follow (Object : Set) return Set is Result : Set; Element : Iterator := Start (Object); begin while Exist (Element) loop Add (Result, Follow (+Element)); Element := Next (Element); end loop; return Result; end Get_Follow; ---------------- -- Get_Follow -- ---------------- function Get_Follow (Object : in Set; Symbol : in Symbol_Set) return Set is Result : Set; Element : Iterator := Start (Object); begin while Exist (Element) loop if Literals (+Element).Chars * Symbol then Add (Result, Follow (+Element)); end if; Element := Next (Element); end loop; return Result; end Get_Follow; --------------- -- Get_State -- --------------- procedure Get_State (Automaton : in out DFA; S : out State; Pos : in out Set; Starting : in Natural := 0) is Element : Iterator := Start (Pos); Target : Natural := 0; begin while Exist (Element) loop if Literals (+Element).Token > Target then Target := Literals (+Element).Token; end if; Element := Next (Element); end loop; Need_State (Automaton, S, Pos, Starting); Set_Token (Automaton, S, Token (Target)); end Get_State; ---------- -- Walk -- ---------- procedure Walk (Item : in Expression; First : in out Set; Last : in out Set; Pos : in out Position) is Result_First : Set; Result_Last : Set; begin case Item.Kind is when Literal => Literals (Pos) := Item; Add (First, Pos); Add (Last, Pos); Pos := Pos + 1; when Alternative => Walk (Item.Left, First, Last, Pos); Walk (Item.Right, First, Last, Pos); when Sequence => Walk (Item.Left, First, Result_Last, Pos); Walk (Item.Right, Result_First, Last, Pos); Add_To_Follow (Result_First, Result_Last); if Item.Left.Nullable then Add (First, Result_First); end if; if Item.Right.Nullable then Add (Last, Result_Last); end if; Clear (Result_First); Clear (Result_Last); when Iteration => Walk (Item.Item, Result_First, Result_Last, Pos); Add_To_Follow (Result_First, Result_Last); Add (First, Result_First); Add (Last, Result_Last); when Optional | Apply => Walk (Item.Child, First, Last, Pos); end case; end Walk; Current : State; begin Walk (Item, First, Last, Temp); Clear (Last); Clear_All_Sets (Result); Get_State (Result, Current, First, Starting); while Has_More (Result) loop Get_Next (Result, Current, First); declare Symbols : Symbol_Set_Array := Distinct (Start (First)); begin for I in Symbols'Range loop declare X : Set := Get_Follow (First, Symbols (I)); Next : State; Item : Iterator := Start (X); begin if Exist (Item) then Get_State (Result, Next, X); Add_Edge (Result, Current, Next, Symbols (I)); end if; end; end loop; end; end loop; end Add_To_DFA; ------------------- -- Literal_Count -- ------------------- function Literal_Count (Item : Expression) return Natural is begin case Item.Kind is when Literal => return 1; when Alternative | Sequence => return Literal_Count (Item.Left) + Literal_Count (Item.Right); when Iteration => return Literal_Count (Item.Item); when Optional | Apply => return Literal_Count (Item.Child); end case; end Literal_Count; --------------------- -- New_Alternative -- --------------------- function New_Alternative (Left : Expression; Right : Expression) return Expression is Result : Expression := new Expression_Node (Alternative); begin Result.Nullable := Left.Nullable or Right.Nullable; Result.Left := Left; Result.Right := Right; return Result; end New_Alternative; --------------- -- New_Apply -- --------------- function New_Apply (Item : Expression) return Expression is Result : Expression := new Expression_Node (Apply); begin Result.Nullable := Item.Nullable; Result.Child := Item; return Result; end New_Apply; ------------------- -- New_Iteration -- ------------------- function New_Iteration (Item : Expression; Allow_Zero : Boolean := True) return Expression is Result : Expression := new Expression_Node (Iteration); begin Result.Nullable := Item.Nullable or Allow_Zero; Result.Item := Item; Result.Allow_Zero := Allow_Zero; return Result; end New_Iteration; ----------------- -- New_Literal -- ----------------- function New_Literal (S : Symbol_Set) return Expression is Result : Expression := new Expression_Node (Literal); begin Result.Nullable := False; Result.Chars := S; return Result; end New_Literal; ------------------ -- New_Optional -- ------------------ function New_Optional (Item : Expression) return Expression is Result : Expression := new Expression_Node (Optional); begin Result.Nullable := True; Result.Child := Item; return Result; end New_Optional; -------------- -- New_Rule -- -------------- function New_Rule (Item : Expression; Token : Natural) return Expression is Result : Expression := new Expression_Node (Literal); begin Result.Nullable := False; Result.Chars := To_Range (Not_A_Symbol); Result.Token := Token; return New_Sequence (Item, Result); end New_Rule; ------------------ -- New_Sequence -- ------------------ function New_Sequence (Left : Expression; Right : Expression) return Expression is Result : Expression := new Expression_Node (Sequence); begin Result.Nullable := Left.Nullable and Right.Nullable; Result.Left := Left; Result.Right := Right; return Result; end New_Sequence; end Regular_Expressions; ------------------------------------------------------------------------------ -- Copyright (c) 2006-2013, <NAME> -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, -- this list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- * Neither the name of the <NAME>, IE nor the names of its -- contributors may be used to endorse or promote products derived from -- this software without specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------
src/arch/x86_64/long_mode_init.asm
mkroening/toyos-rs
69
95100
<filename>src/arch/x86_64/long_mode_init.asm ;;; Based on http://blog.phil-opp.com/rust-os/entering-longmode.html ;;; and http://blog.phil-opp.com/rust-os/setup-rust.html ;;; ;;; Once we've run all our 32-bit setup code, we jump here and enter 64-bit ;;; mode. ;;; ;;; To generate yellow 4-letter debug text values, you can run: ;;; ;;; "INT!".chars.map {|c| sprintf("2f%02x", c.ord) }.reverse.join %include 'common.inc' global long_mode_start extern rust_main section .text bits 64 long_mode_start: call setup_SSE call rust_main ;; Display "OKAY". mov rax, 0x2f592f412f4b2f4f mov qword [SCREEN_BASE], rax hlt ;;; Print "ERROR: " and an error code. ;;; ;;; a1: Error code. error: mov rbx, 0x4f4f4f524f524f45 mov [SCREEN_BASE], rbx mov rbx, 0x4f204f204f3a4f52 mov [SCREEN_BASE + 8], rbx mov byte [SCREEN_BASE + 0xe], al hlt ;;; Check for SSE and enable it, or display an error. ;;; ;;; Copied from http://blog.phil-opp.com/rust-os/setup-rust.html, which got ;;; it from http://wiki.osdev.org/SSE#Checking_for_SSE. setup_SSE: ;; Check for SSE. mov rax, 0x1 cpuid test edx, 1<<25 jz .no_SSE ;; Enable SSE. mov rax, cr0 and ax, 0xFFFB ; Clear coprocessor emulation CR0.EM. or ax, 0x2 ; Set coprocessor monitoring CR0.MP. mov cr0, rax mov rax, cr4 or ax, 3 << 9 ; Set CR4.OSFXSR and CR4.OSXMMEXCPT. mov cr4, rax ret .no_SSE: mov al, "S" jmp error
alloy4fun_models/trashltl/models/13/fzeQGshrs2oWf9hnN.als
Kaixi26/org.alloytools.alloy
0
4966
open main pred idfzeQGshrs2oWf9hnN_prop14 { all f:File | f in Protected&Trash implies after (f in Trash) } pred __repair { idfzeQGshrs2oWf9hnN_prop14 } check __repair { idfzeQGshrs2oWf9hnN_prop14 <=> prop14o }
tools-src/gnu/gcc/gcc/ada/a-caldel.adb
enfoTek/tomato.linksys.e2000.nvram-mod
80
2071
<filename>tools-src/gnu/gcc/gcc/ada/a-caldel.adb ------------------------------------------------------------------------------ -- -- -- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- A D A . C A L E N D A R . D E L A Y S -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1991-2001 Florida State University -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNARL; 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. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. It is -- -- now maintained by Ada Core Technologies Inc. in cooperation with Florida -- -- State University (http://www.gnat.com). -- -- -- ------------------------------------------------------------------------------ with System.OS_Primitives; -- Used for Delay_Modes -- Max_Sensible_Delay with System.Soft_Links; -- Used for Timed_Delay package body Ada.Calendar.Delays is package OSP renames System.OS_Primitives; package SSL renames System.Soft_Links; use type SSL.Timed_Delay_Call; -- Earlier, the following operations were implemented using -- System.Time_Operations. The idea was to avoid sucking in the tasking -- packages. This did not work. Logically, we can't have it both ways. -- There is no way to implement time delays that will have correct task -- semantics without reference to the tasking run-time system. -- To achieve this goal, we now use soft links. ----------------------- -- Local Subprograms -- ----------------------- procedure Timed_Delay_NT (Time : Duration; Mode : Integer); -- Timed delay procedure used when no tasking is active --------------- -- Delay_For -- --------------- procedure Delay_For (D : Duration) is begin SSL.Timed_Delay.all (Duration'Min (D, OSP.Max_Sensible_Delay), OSP.Relative); end Delay_For; ----------------- -- Delay_Until -- ----------------- procedure Delay_Until (T : Time) is begin SSL.Timed_Delay.all (To_Duration (T), OSP.Absolute_Calendar); end Delay_Until; -------------------- -- Timed_Delay_NT -- -------------------- procedure Timed_Delay_NT (Time : Duration; Mode : Integer) is begin OSP.Timed_Delay (Time, Mode); end Timed_Delay_NT; ----------------- -- To_Duration -- ----------------- function To_Duration (T : Time) return Duration is begin return Duration (T); end To_Duration; begin -- Set up the Timed_Delay soft link to the non tasking version -- if it has not been already set. -- If tasking is present, Timed_Delay has already set this soft -- link, or this will be overriden during the elaboration of -- System.Tasking.Initialization if SSL.Timed_Delay = null then SSL.Timed_Delay := Timed_Delay_NT'Access; end if; end Ada.Calendar.Delays;
ada_gui-gnoga-colors.ads
jrcarter/Ada_GUI
19
30129
-- Ada_GUI implementation based on Gnoga. Adapted 2021 -- -- -- GNOGA - The GNU Omnificent GUI for Ada -- -- -- -- G N O G A . T Y P E S . C O L O R S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2015 <NAME> -- -- -- -- 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 -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are -- -- granted additional permissions described in the GCC Runtime Library -- -- Exception, version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- 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. -- -- -- -- For more information please go to http://www.gnoga.com -- ------------------------------------------------------------------------------ package Ada_GUI.Gnoga.Colors is type Color_Enumeration is (Alice_Blue, Antique_White, Aqua, Aquamarine, Azure, Beige, Bisque, Black, Blanched_Almond, Blue, Blue_Violet, Brown, Burly_Wood, Cadet_Blue, Chartreuse, Chocolate, Coral, Cornflower_Blue, Cornsilk, Crimson, Cyan, Dark_Blue, Dark_Cyan, Dark_Golden_Rod, Dark_Gray, Dark_Green, Dark_Grey, Dark_Khaki, Dark_Magenta, Dark_Olive_Green, Dark_Orange, Dark_Orchid, Dark_Red, Dark_Salmon, Dark_Sea_Green, Dark_Slate_Blue, Dark_Slate_Gray, Dark_Slate_Grey, Dark_Turquoise, Dark_Violet, DeepPink, Deep_Sky_Blue, Dim_Gray, Dim_Grey, Dodger_Blue, Fire_Brick, Floral_White, Forest_Green, Fuchsia, Gainsboro, Ghost_White, Gold_Deep_Sky_Blue, Golden_Rod, Gray, Green, Green_Yellow, Grey, Honey_Dew, Hot_Pink, Indian_Red, Indigo, Ivory, Khaki, Lavender, Lavender_Blush, Lawn_Green, Lemon_Chiffon, Light_Blue, Light_Coral, Light_Cyan, Light_Golden_Rod_Yellow, Light_Gray, Light_Green, Light_Grey, Light_Pink, Light_Salmon, Light_Sea_Green, Light_Sky_Blue, Light_Slate_Gray, Light_Slate_Grey, Light_Steel_Blue, Light_Yellow, Lime, Lime_Green, Linen, Magenta, Maroon, Medium_Aqua_Marine, Medium_Blue, Medium_Orchid, Medium_Purple, Medium_Sea_Green, Medium_Slate_Blue, Medium_Spring_Green, Medium_Turquoise, Medium_Violet_Red, Midnight_Blue, Mint_Cream, Misty_Rose, Moccasin, Navajo_White, Navy, Old_Lace, Olive, Olive_Drab, Orange, Orange_Red, Orchid, Pale_Golden_Rod, Pale_Green, Pale_Turquoise, Pale_Violet_Red, Papaya_Whip, Peach_Puff, Peru, Pink, Plum, Powder_Blue, Purple, Red, Rosy_Brown, Royal_Blue, Saddle_Brown, Salmon, Sandy_Brown, Sea_Green, Sea_Shell, Sienna, Silver, Sky_Blue, Slate_Blue, Slate_Gray, Slate_Grey, Snow, Spring_Green, Steel_Blue, Tan, Teal, Thistle, Tomato, Turquoise, Violet, Wheat, White, White_Smoke, Yellow, Yellow_Green); Color_Error : exception; function To_String (Value : Color_Enumeration) return String; -- Returns color name function To_RGBA (Value : Color_Enumeration) return RGBA_Type; -- Returns color RGBA_Type function To_Color_Enumeration (Value : RGBA_Type) return Color_Enumeration; -- Returns Color_Enumeration if it exists else raises Color_Error exception function To_Color_Enumeration (Value : String) return Color_Enumeration; -- Returns Color_Enumeration if it exists else raises Color_Error exception end Ada_GUI.Gnoga.Colors;
antlr/grulev2.g4
vlean/grule-rule-engine
0
6080
<filename>antlr/grulev2.g4 grammar grulev2; // PARSER HERE grl : ruleEntry* EOF ; ruleEntry : RULE ruleName ruleDescription? salience? LR_BRACE whenScope thenScope RR_BRACE ; salience : SALIENCE decimalLiteral ; ruleName : SIMPLENAME ; ruleDescription : DQUOTA_STRING | SQUOTA_STRING ; whenScope : WHEN expression ; thenScope : THEN thenExpressionList ; thenExpressionList : thenExpression+ ; thenExpression : assignment SEMICOLON | functionCall SEMICOLON | variable SEMICOLON ; assignment : variable ASSIGN expression ; expression : expression mulDivOperators expression | expression addMinusOperators expression | expression comparisonOperator expression | expression andLogicOperator expression | expression orLogicOperator expression | LR_BRACKET expression RR_BRACKET | expressionAtom ; mulDivOperators : MUL | DIV | MOD ; addMinusOperators : PLUS | MINUS | BITAND | BITOR ; comparisonOperator : GT | LT | GTE | LTE | EQUALS | NOTEQUALS ; andLogicOperator : AND ; orLogicOperator : OR ; expressionAtom : variable | functionCall ; arrayMapSelector : LS_BRACKET expression RS_BRACKET ; functionCall : SIMPLENAME '(' argumentList? ')' ; argumentList : expression ( ',' expression )* ; variable : SIMPLENAME | constant | variable DOT functionCall | variable DOT SIMPLENAME | variable arrayMapSelector ; constant : stringLiteral | decimalLiteral | booleanLiteral | realLiteral | NOT? NULL_LITERAL ; decimalLiteral : MINUS? DECIMAL_LITERAL ; realLiteral : MINUS? REAL_LITERAL ; stringLiteral : DQUOTA_STRING | SQUOTA_STRING ; booleanLiteral : TRUE | FALSE; // LEXER HERE fragment DEC_DIGIT : [0-9]; fragment A : [aA] ; fragment B : [bB] ; fragment C : [cC] ; fragment D : [dD] ; fragment E : [eE] ; fragment F : [fF] ; fragment G : [gG] ; fragment H : [hH] ; fragment I : [iI] ; fragment J : [jJ] ; fragment K : [kK] ; fragment L : [lL] ; fragment M : [mM] ; fragment N : [nN] ; fragment O : [oO] ; fragment P : [pP] ; fragment Q : [qQ] ; fragment R : [rR] ; fragment S : [sS] ; fragment T : [tT] ; fragment U : [uU] ; fragment V : [vV] ; fragment W : [wW] ; fragment X : [xX] ; fragment Y : [yY] ; fragment Z : [zZ] ; fragment EXPONENT_NUM_PART : 'E' '-'? DEC_DIGIT+; RULE : R U L E ; WHEN : W H E N ; THEN : T H E N ; AND : '&&' ; OR : '||' ; TRUE : T R U E ; FALSE : F A L S E ; NULL_LITERAL : N U L L ; NOT : N O T ; SALIENCE : S A L I E N C E ; SIMPLENAME : [a-zA-Z] [a-zA-Z0-9]* ; PLUS : '+' ; MINUS : '-' ; DIV : '/' ; MUL : '*' ; MOD : '%' ; EQUALS : '==' ; ASSIGN : '=' ; GT : '>' ; LT : '<' ; GTE : '>=' ; LTE : '<=' ; NOTEQUALS : '!=' ; BITAND : '&'; BITOR : '|'; SEMICOLON : ';' ; LR_BRACE : '{'; RR_BRACE : '}'; LR_BRACKET : '('; RR_BRACKET : ')'; LS_BRACKET : '['; RS_BRACKET : ']'; DOT : '.' ; DQUOTA_STRING : '"' ( '\\'. | '""' | ~('"'| '\\') )* '"'; SQUOTA_STRING : '\'' ('\\'. | '\'\'' | ~('\'' | '\\'))* '\''; DECIMAL_LITERAL : DEC_DIGIT+; REAL_LITERAL : (DEC_DIGIT+)? '.' DEC_DIGIT+ | DEC_DIGIT+ '.' EXPONENT_NUM_PART | (DEC_DIGIT+)? '.' (DEC_DIGIT+ EXPONENT_NUM_PART) | DEC_DIGIT+ EXPONENT_NUM_PART ; SPACE : [ \t\r\n]+ {l.Skip()} ; COMMENT : '/*' .*? '*/' {l.Skip()} ; LINE_COMMENT : '//' ~[\r\n]* {l.Skip()} ;
Pi/Properties.agda
DreamLinuxer/popl21-artifact
5
12054
<reponame>DreamLinuxer/popl21-artifact module Pi.Properties where open import Data.Empty open import Data.Unit open import Data.Sum open import Data.Product open import Relation.Binary.PropositionalEquality open import Pi.Syntax open import Pi.Opsem open import Pi.NoRepeat open import Pi.Invariants open import Pi.Eval open import Pi.Interp -- Forward evaluation is deterministic deterministic-eval : ∀ {A B} → (c : A ↔ B) (v : ⟦ A ⟧) (v₁ v₂ : ⟦ B ⟧) → ⟨ c ∣ v ∣ ☐ ⟩ ↦* [ c ∣ v₁ ∣ ☐ ] → ⟨ c ∣ v ∣ ☐ ⟩ ↦* [ c ∣ v₂ ∣ ☐ ] → v₁ ≡ v₂ deterministic-eval c v v₁ v₂ ↦*₁ ↦*₂ with deterministic* ↦*₁ ↦*₂ (λ ()) (λ ()) ... | refl = refl -- Backward evaluation is deterministic deterministic-evalᵣₑᵥ : ∀ {A B} → (c : A ↔ B) (v : ⟦ B ⟧) (v₁ v₂ : ⟦ A ⟧) → [ c ∣ v ∣ ☐ ] ↦ᵣₑᵥ* ⟨ c ∣ v₁ ∣ ☐ ⟩ → [ c ∣ v ∣ ☐ ] ↦ᵣₑᵥ* ⟨ c ∣ v₂ ∣ ☐ ⟩ → v₁ ≡ v₂ deterministic-evalᵣₑᵥ c v v₁ v₂ ↦ᵣₑᵥ*₁ ↦ᵣₑᵥ*₂ with deterministicᵣₑᵥ* ↦ᵣₑᵥ*₁ ↦ᵣₑᵥ*₂ (λ ()) (λ ()) ... | refl = refl -- Forward evaluator is reversible evalIsRev : ∀ {A B} → (c : A ↔ B) (v₁ : ⟦ A ⟧) (v₂ : ⟦ B ⟧) → eval c v₁ ≡ v₂ → evalᵣₑᵥ c v₂ ≡ v₁ evalIsRev c v₁ v₂ eq with ev {κ = ☐} c v₁ ... | v₂' , c↦* with eq ... | refl with evᵣₑᵥ {κ = ☐} c v₂ ... | v₁' , c↦*ᵣₑᵥ with deterministicᵣₑᵥ* c↦*ᵣₑᵥ (Rev↦ c↦*) (λ ()) (λ ()) ... | refl = refl -- Backward evaluator is reversible evalᵣₑᵥIsRev : ∀ {A B} → (c : A ↔ B) (v₁ : ⟦ B ⟧) (v₂ : ⟦ A ⟧) → evalᵣₑᵥ c v₁ ≡ v₂ → eval c v₂ ≡ v₁ evalᵣₑᵥIsRev c v₁ v₂ eq with evᵣₑᵥ {κ = ☐} c v₁ ... | v₂' , c↦ᵣₑᵥ* with eq ... | refl with ev {κ = ☐} c v₂ ... | v₁' , c↦* with deterministic* c↦* (Rev↦ᵣₑᵥ c↦ᵣₑᵥ*) (λ ()) (λ ()) ... | refl = refl -- The abstract machine semantics is equivalent to the big-step semantics eval≡interp : ∀ {A B} → (c : A ↔ B) → (v : ⟦ A ⟧) → eval c v ≡ interp c v eval≡interp unite₊l (inj₂ y) = refl eval≡interp uniti₊l v = refl eval≡interp swap₊ (inj₁ x) = refl eval≡interp swap₊ (inj₂ y) = refl eval≡interp assocl₊ (inj₁ x) = refl eval≡interp assocl₊ (inj₂ (inj₁ y)) = refl eval≡interp assocl₊ (inj₂ (inj₂ z)) = refl eval≡interp assocr₊ (inj₁ (inj₁ x)) = refl eval≡interp assocr₊ (inj₁ (inj₂ y)) = refl eval≡interp assocr₊ (inj₂ z) = refl eval≡interp unite⋆l (tt , v) = refl eval≡interp uniti⋆l v = refl eval≡interp swap⋆ (x , y) = refl eval≡interp assocl⋆ (x , (y , z)) = refl eval≡interp assocr⋆ ((x , y) , z) = refl eval≡interp dist (inj₁ x , z) = refl eval≡interp dist (inj₂ y , z) = refl eval≡interp factor (inj₁ (x , z)) = refl eval≡interp factor (inj₂ (y , z)) = refl eval≡interp id↔ v = refl eval≡interp (c₁ ⨾ c₂) v with ev {κ = ☐} c₁ v | inspect (ev {κ = ☐} c₁) v ... | (v' , rs) | [ eq ] with ev {κ = ☐} c₂ v' | inspect (ev {κ = ☐} c₂) v' ... | (v'' , rs') | [ eq' ] with ev {κ = ☐} (c₁ ⨾ c₂) v | inspect (ev {κ = ☐} (c₁ ⨾ c₂)) v ... | (u , rs'') | [ refl ] rewrite (sym (eval≡interp c₁ v)) | eq | (sym (eval≡interp c₂ v')) | eq' with deterministic* ((↦₃ ∷ ◾) ++↦ appendκ↦* rs refl (☐⨾ c₂ • ☐) ++↦ (↦₇ ∷ ◾) ++↦ appendκ↦* rs' refl (c₁ ⨾☐• ☐) ++↦ (↦₁₀ ∷ ◾)) rs'' (λ ()) (λ ()) ... | refl = refl eval≡interp (c₁ ⊕ c₂) (inj₁ x) with ev {κ = ☐} c₁ x | inspect (ev {κ = ☐} c₁) x ... | (x' , rs) | [ eq ] with ev {κ = ☐} (c₁ ⊕ c₂) (inj₁ x) | inspect (ev {κ = ☐} (c₁ ⊕ c₂)) (inj₁ x) ... | (v , rs') | [ refl ] rewrite (sym (eval≡interp c₁ x)) | eq with deterministic* ((↦₄ ∷ ◾) ++↦ appendκ↦* rs refl (☐⊕ c₂ • ☐) ++↦ (↦₁₁ ∷ ◾)) rs' (λ ()) (λ ()) ... | refl = refl eval≡interp (c₁ ⊕ c₂) (inj₂ y) with ev {κ = ☐} c₂ y | inspect (ev {κ = ☐} c₂) y ... | (x' , rs) | [ eq ] with ev {κ = ☐} (c₁ ⊕ c₂) (inj₂ y) | inspect (ev {κ = ☐} (c₁ ⊕ c₂)) (inj₂ y) ... | (v , rs') | [ refl ] rewrite (sym (eval≡interp c₂ y)) | eq with deterministic* ((↦₅ ∷ ◾) ++↦ appendκ↦* rs refl (c₁ ⊕☐• ☐) ++↦ (↦₁₂ ∷ ◾)) rs' (λ ()) (λ ()) ... | refl = refl eval≡interp (c₁ ⊗ c₂) (x , y) with ev {κ = ☐} c₁ x | inspect (ev {κ = ☐} c₁) x ... | (x' , rs) | [ eq ] with ev {κ = ☐} c₂ y | inspect (ev {κ = ☐} c₂) y ... | (y' , rs') | [ eq' ] with ev {κ = ☐} (c₁ ⊗ c₂) (x , y) | inspect (ev {κ = ☐} (c₁ ⊗ c₂)) (x , y) ... | (_ , rs'') | [ refl ] rewrite (sym (eval≡interp c₁ x)) | eq | (sym (eval≡interp c₂ y)) | eq' with deterministic* (((↦₆ ∷ ◾) ++↦ appendκ↦* rs refl (☐⊗[ c₂ , y ]• ☐)) ++↦ (↦₈ ∷ ◾) ++↦ appendκ↦* rs' refl ([ c₁ , x' ]⊗☐• ☐) ++↦ (↦₉ ∷ ◾)) rs'' (λ ()) (λ ()) ... | refl = refl c⨾!c≡id↔ : ∀ {A B} (c : A ↔ B) → (x : ⟦ A ⟧) → interp (c ⨾ ! c) x ≡ interp id↔ x c⨾!c≡id↔ unite₊l (inj₂ y) = refl c⨾!c≡id↔ uniti₊l x = refl c⨾!c≡id↔ swap₊ (inj₁ x) = refl c⨾!c≡id↔ swap₊ (inj₂ y) = refl c⨾!c≡id↔ assocl₊ (inj₁ x) = refl c⨾!c≡id↔ assocl₊ (inj₂ (inj₁ y)) = refl c⨾!c≡id↔ assocl₊ (inj₂ (inj₂ z)) = refl c⨾!c≡id↔ assocr₊ (inj₁ (inj₁ x)) = refl c⨾!c≡id↔ assocr₊ (inj₁ (inj₂ y)) = refl c⨾!c≡id↔ assocr₊ (inj₂ z) = refl c⨾!c≡id↔ unite⋆l (tt , x) = refl c⨾!c≡id↔ uniti⋆l x = refl c⨾!c≡id↔ swap⋆ (x , y) = refl c⨾!c≡id↔ assocl⋆ (x , (y , z)) = refl c⨾!c≡id↔ assocr⋆ ((x , y) , z) = refl c⨾!c≡id↔ dist (inj₁ x , z) = refl c⨾!c≡id↔ dist (inj₂ y , z) = refl c⨾!c≡id↔ factor (inj₁ (x , z)) = refl c⨾!c≡id↔ factor (inj₂ (y , z)) = refl c⨾!c≡id↔ id↔ x = refl c⨾!c≡id↔ (c₁ ⨾ c₂) x rewrite c⨾!c≡id↔ c₂ (interp c₁ x) = c⨾!c≡id↔ c₁ x c⨾!c≡id↔ (c₁ ⊕ c₂) (inj₁ x) rewrite c⨾!c≡id↔ c₁ x = refl c⨾!c≡id↔ (c₁ ⊕ c₂) (inj₂ y) rewrite c⨾!c≡id↔ c₂ y = refl c⨾!c≡id↔ (c₁ ⊗ c₂) (x , y) rewrite c⨾!c≡id↔ c₁ x | c⨾!c≡id↔ c₂ y = refl !!c≡c : ∀ {A B} (c : A ↔ B) → ! (! c) ≡ c !!c≡c unite₊l = refl !!c≡c uniti₊l = refl !!c≡c swap₊ = refl !!c≡c assocl₊ = refl !!c≡c assocr₊ = refl !!c≡c unite⋆l = refl !!c≡c uniti⋆l = refl !!c≡c swap⋆ = refl !!c≡c assocl⋆ = refl !!c≡c assocr⋆ = refl !!c≡c absorbr = refl !!c≡c factorzl = refl !!c≡c dist = refl !!c≡c factor = refl !!c≡c id↔ = refl !!c≡c (c₁ ⨾ c₂) rewrite !!c≡c c₁ | !!c≡c c₂ = refl !!c≡c (c₁ ⊕ c₂) rewrite !!c≡c c₁ | !!c≡c c₂ = refl !!c≡c (c₁ ⊗ c₂) rewrite !!c≡c c₁ | !!c≡c c₂ = refl !c⨾c≡id↔ : ∀ {A B} (c : A ↔ B) → (x : ⟦ B ⟧) → interp (! c ⨾ c) x ≡ interp id↔ x !c⨾c≡id↔ c x = trans (cong (λ c' → interp c' (interp (! c) x)) (sym (!!c≡c c))) (c⨾!c≡id↔ (! c) x)
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_1270.asm
ljhsiun2/medusa
9
88825
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r8 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0x7b0d, %rsi lea addresses_WT_ht+0x4b4d, %rdi nop dec %rbx mov $118, %rcx rep movsl nop nop xor %r10, %r10 lea addresses_WC_ht+0x12b4d, %rsi lea addresses_D_ht+0x1954d, %rdi clflush (%rdi) nop nop and %rdx, %rdx mov $14, %rcx rep movsq nop nop nop sub $2645, %rsi lea addresses_normal_ht+0x214d, %rcx nop nop nop add $26200, %r8 mov $0x6162636465666768, %rsi movq %rsi, (%rcx) nop and $9755, %rsi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r8 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r15 push %rax push %rcx push %rdi push %rdx // Store lea addresses_UC+0x881c, %rdi nop nop sub $26703, %rax mov $0x5152535455565758, %rcx movq %rcx, %xmm5 movups %xmm5, (%rdi) nop nop nop and $50148, %rcx // Load lea addresses_UC+0x1054d, %r13 nop nop nop nop sub $34801, %rdx mov (%r13), %edi nop and $21713, %r15 // Faulty Load lea addresses_UC+0x1054d, %r13 nop nop nop xor %rcx, %rcx movups (%r13), %xmm0 vpextrq $0, %xmm0, %r10 lea oracles, %rdi and $0xff, %r10 shlq $12, %r10 mov (%rdi,%r10,1), %r10 pop %rdx pop %rdi pop %rcx pop %rax pop %r15 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_UC', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_UC', 'size': 16, 'AVXalign': False}} {'src': {'same': True, 'congruent': 0, 'NT': True, 'type': 'addresses_UC', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_UC', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}} {'src': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False}} {'37': 21829} 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 */
src/main/fragment/mos6502-common/vwsm1=vwsm1_ror_vbuyy.asm
jbrandwood/kickc
2
169954
cpy #0 beq !e+ !: lda {m1}+1 cmp #$80 ror {m1}+1 ror {m1} dey bne !- !e:
KR2/main_2.asm
Winterpuma/bmstu_MDPL
14
102764
EXTRN SCAN : NEAR EXTRN UB : NEAR EXTRN UD : NEAR EXTRN UH : NEAR SSTACK SEGMENT PARA STACK 'STACK' ; DB 64 DUP('STACK___') SSTACK ENDS DSEG SEGMENT PARA PUBLIC 'DATA' X DW 10 ; default number, if nothing eentered ENTER DB '> $' ; signal that we should enter something, to the user: this symbols are on the screen NEW_LINE DB 10, 13, '$'; DSEG ENDS CSEG SEGMENT PARA PUBLIC 'CODE' ASSUME CS:CSEG, DS:DSEG, SS:SSTACK BEGIN: MOV AX, DSEG MOV DS, AX INPUT_NUMBER: CALL SCAN MOV X, AX PUSH X PUSH SI CALL UD EXIT: MOV AH, 4CH ; close programa XOR AL, AL INT 21H CSEG ENDS END BEGIN
oeis/266/A266754.asm
neoneye/loda-programs
11
25365
<reponame>neoneye/loda-programs<filename>oeis/266/A266754.asm ; A266754: Triangle read by rows giving successive states of cellular automaton generated by "Rule 165" initiated with a single ON (black) cell. ; Submitted by <NAME> ; 1,0,1,0,0,1,1,1,0,0,1,0,1,0,1,0,0,1,1,1,1,1,1,1,0,0,1,0,1,1,1,1,1,0,1,0,0,1,1,1,0,1,1,1,0,1,1,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0 lpb $0 add $1,1 sub $0,$1 mov $2,$1 add $1,1 lpe bin $1,$0 add $2,$1 mov $0,$2 mod $0,2
attic/asis/find_entities/adam-assist-query-find_entities-context_processing.adb
charlie5/aIDE
3
19650
with Ada.Wide_Text_IO, Ada.Characters.Handling, Ada.Exceptions, Asis.Compilation_Units, Asis.Exceptions, Asis.Errors, Asis.Implementation, AdaM.Assist.Query.find_Entities.unit_Processing; package body AdaM.Assist.Query.find_Entities.context_Processing is function Get_Unit_From_File_Name (Ada_File_Name : String; The_Context : Asis.Context) return Asis.Compilation_Unit is begin return Asis.Nil_Compilation_Unit; end Get_Unit_From_File_Name; procedure Process_Context (The_Context : Asis.Context; Trace : Boolean := False) is Units : constant Asis.Compilation_Unit_List := Asis.Compilation_Units.Compilation_Units (The_Context); Next_Unit : Asis.Compilation_Unit := Asis.Nil_Compilation_Unit; Next_Unit_Origin : Asis.Unit_Origins := Asis.Not_An_Origin; Next_Unit_Class : Asis.Unit_Classes := Asis.Not_A_Class; begin for J in Units'Range loop Next_Unit := Units (J); Next_Unit_Class := Asis.Compilation_Units.Unit_Class (Next_Unit); Next_Unit_Origin := Asis.Compilation_Units.Unit_Origin (Next_Unit); case Next_Unit_Origin is when Asis.An_Application_Unit | Asis.A_Predefined_Unit => AdaM.Assist.Query.find_Entities.unit_Processing.Process_Unit (Next_Unit); -- This is the call to the procedure which performs the -- analysis of a particular unit when Asis.An_Implementation_Unit => if Trace then Ada.Wide_Text_IO.Put ("Skipped as an implementation-defined unit"); end if; when Asis.Not_An_Origin => if Trace then Ada.Wide_Text_IO.Put ("Skipped as nonexistent unit"); end if; end case; end loop; exception -- The exception handling in this procedure is somewhat redundant and -- may need some reconsidering when using this procedure as a template -- for a real ASIS tool when Ex : Asis.Exceptions.ASIS_Inappropriate_Context | Asis.Exceptions.ASIS_Inappropriate_Container | Asis.Exceptions.ASIS_Inappropriate_Compilation_Unit | Asis.Exceptions.ASIS_Inappropriate_Element | Asis.Exceptions.ASIS_Inappropriate_Line | Asis.Exceptions.ASIS_Inappropriate_Line_Number | Asis.Exceptions.ASIS_Failed => Ada.Wide_Text_IO.Put ("Process_Context : ASIS exception ("); Ada.Wide_Text_IO.Put (Ada.Characters.Handling.To_Wide_String ( Ada.Exceptions.Exception_Name (Ex))); Ada.Wide_Text_IO.Put (") is raised when processing unit "); Ada.Wide_Text_IO.Put (Asis.Compilation_Units.Unit_Full_Name (Next_Unit)); Ada.Wide_Text_IO.New_Line; Ada.Wide_Text_IO.Put ("ASIS Error Status is "); Ada.Wide_Text_IO.Put (Asis.Errors.Error_Kinds'Wide_Image (Asis.Implementation.Status)); Ada.Wide_Text_IO.New_Line; Ada.Wide_Text_IO.Put ("ASIS Diagnosis is "); Ada.Wide_Text_IO.New_Line; Ada.Wide_Text_IO.Put (Asis.Implementation.Diagnosis); Ada.Wide_Text_IO.New_Line; Asis.Implementation.Set_Status; when Ex : others => Ada.Wide_Text_IO.Put ("Process_Context : "); Ada.Wide_Text_IO.Put (Ada.Characters.Handling.To_Wide_String ( Ada.Exceptions.Exception_Name (Ex))); Ada.Wide_Text_IO.Put (" is raised ("); Ada.Wide_Text_IO.Put (Ada.Characters.Handling.To_Wide_String ( Ada.Exceptions.Exception_Information (Ex))); Ada.Wide_Text_IO.Put (")"); Ada.Wide_Text_IO.New_Line; Ada.Wide_Text_IO.Put ("when processing unit"); Ada.Wide_Text_IO.Put (Asis.Compilation_Units.Unit_Full_Name (Next_Unit)); Ada.Wide_Text_IO.New_Line; end Process_Context; end AdaM.Assist.Query.find_Entities.context_Processing;
libsrc/_DEVELOPMENT/math/float/math48/lm/c/sdcc_iy/cos.asm
meesokim/z88dk
0
240992
SECTION code_fp_math48 PUBLIC _cos EXTERN cm48_sdcciy_cos defc _cos = cm48_sdcciy_cos
aql/AQL.g4
helipilot50/language-parsers
4
4194
<reponame>helipilot50/language-parsers<filename>aql/AQL.g4<gh_stars>1-10 /* CONNECTION CONNECT <host name> <port> [<timeout>] DISCONNECT <host name> address of a cluster node <port> port for connection - default 3000 <timeout> client timeout DDL CREATE INDEX <index> ON <ns>[.<set>] (<bin>) NUMERIC|STRING DROP INDEX <ns>[.<set>] <index> REPAIR INDEX <index> ON <ns>[.<set>] DROP SET <ns>[.<set>] <ns> is the namespace for the index. <set> is the set name for the index. <index> is the name of the index. Examples: CREATE INDEX idx_foo ON test.demo (foo) NUMERIC DROP INDEX test.demo idx_foo REPAIR INDEX idx_foo ON test.demo DML INSERT INTO <ns>[.<set>] (PK, <bins>) VALUES (<key>, <values>) DELETE FROM <ns>[.<set>] WHERE PK = <key> DELETE FROM <ns>[.<set>] WHERE PK = <key> AND GENERATION = <generation> UPDATE <ns>[.<demo>] SET <bin name> = <bin value>, ... WHERE PK = <key> UPDATE <ns>[.<demo>] SET TTL = <ttl>, <bin name> = <bin value>, ... WHERE PK = <key> AND GENERATION = <generation> OPERATE <operation function>[.<bin name>[,<value>]] ON <ns>[.<set>] WHERE PK = <key> AND GENERATION = <generation> <ns> is the namespace for the record. <set> is the set name for the record. <key> is the record's primary key. <key> is the record's primary key. <bins> is a comma-separated list of bin names. <values> is comma-separated list of bin values. Keep it NULL (case insensitive & w/o quotes) to delete the bin <bin name> is the name of the bin to be updated <bin value> is the value <generation> is the expected generation value <ttl> is the time to live in seconds <operation function> is ADD, PUT, APPEND, PREPEND, GET, TOUCH, HEADER Examples: INSERT INTO test.demo (PK, foo, bar) VALUES ('key1', 123, 'abc') DELETE FROM test.demo WHERE PK = 'key1' UPDATE test.demo SET bn2 = 6, bn3 = '22', bn4 = 22 where pk = '6' UPDATE test.cats SET bob = 23, sue = 'abc' WHER PK = '1234' AND GENERATION = 98765 QUERY SELECT <bins> FROM <ns>[.<set>] SELECT <bins> FROM <ns>[.<set>] WHERE <bin> = <value> SELECT <bins> FROM <ns>[.<set>] WHERE <bin> BETWEEN <lower> AND <upper> SELECT <bins> FROM <ns>[.<set>] WHERE PK = <key> <ns> is the namespace for the records to be queried. <set> is the set name for the record to be queried. <key> is the record's primary key. <bin> is the name of a bin. <value> is the value of a bin. <bins> can be either a wildcard (*) or a comma-separated list of bin names. <lower> is the lower bound for a numeric range query. <upper> is the lower bound for a numeric range query. Examples: SELECT * FROM test.demo SELECT * FROM test.demo WHERE PK = 'key1' SELECT foo, bar FROM test.demo WHERE PK = 'key1' SELECT foo, bar FROM test.demo WHERE foo = 123 SELECT foo, bar FROM test.demo WHERE foo BETWEEN 0 AND 999 MANAGE UDFS REGISTER MODULE '<filepath>' SHOW MODULES REMOVE MODULE <module name> DROP MODULE <module name> DESC MODULE <module name> <filepath> is file path to the UDF module(in single quotes). <module name> is file name of the UDF module. Examples: REGISTER MODULE '~/test.lua' SHOW MODULES DESC MODULE test.lua REMOVE MODULE test.lua INVOKING UDFS EXECUTE <module>.<function>(<args>) ON <ns>[.<set>] EXECUTE <module>.<function>(<args>) ON <ns>[.<set>] WHERE PK = <key> AGGREGATE <module>.<function>(<args>) ON <ns>[.<set>] WHERE <bin> = <value> AGGREGATE <module>.<function>(<args>) ON <ns>[.<set>] WHERE <bin> BETWEEN <lower> AND <upper> <module> is UDF module containing the function to invoke. <function> is UDF to invoke. <args> is a comma-separated list of argument values for the UDF. <ns> is the namespace for the records to be queried. <set> is the set name for the record to be queried. <key> is the record's primary key. <bin> is the name of a bin. <value> is the value of a bin. <lower> is the lower bound for a numeric range query. <upper> is the lower bound for a numeric range query. Examples: EXECUTE myudfs.udf1(2) ON test.demo EXECUTE myudfs.udf1(2) ON test.demo WHERE PK = 'key1' AGGREGATE myudfs.udf2(2) ON test.demo WHERE foo = 123 AGGREGATE myudfs.udf2(2) ON test.demo WHERE foo BETWEEN 0 AND 999 INFO SHOW NAMESPACES | SETS | BINS | INDEXES SHOW SCANS | QUERIES STAT NAMESPACE <ns> | INDEX <ns> <indexname> STAT SYSTEM JOB MANAGEMENT KILL QUERY <transaction_id> KILL SCAN <scan_id> USER ADMINISTRATION CREATE USER <user> PASSWORD <password> ROLE[S] <role1>,<role2>... roles: read|read-write|sys-admin|user-admin DROP USER <user> SET PASSWORD <password> [FOR <user>] GRANT ROLE[S] <role1>,<role2>... TO <user>] REVOKE ROLE[S] <role1>,<role2>... FROM <user>] SHOW USER [<user>] SHOW USERS SETTINGS TIMEOUT (time in ms, default: 1000 ms) TTL (time in ms, default: 0 ms) VERBOSE (true | false, default false) ECHO (true | false, default false) FAIL_ON_CLUSTER_CHANGE (true | false, default true, policy applies to scans) OUTPUT (table | json, default table) LUA_USERPATH <path>, default : /opt/aerospike/usr/udf/lua To get the value of a setting, run: aql> GET <setting> To set the value of a setting, run: aql> SET <setting> <value> OTHER RUN <filepath> HELP QUIT|EXIT|Q */ grammar AQL; options { language=Java; } @header { package com.aerospike.aql.grammar; import java.util.Set; import java.util.HashSet; } @members { public enum VariableDefinition { RECORD, RECORD_SET, RESULT_SET, WRITE_POLICY, READ_POLICY, QUERY_POLICY, SCAN_POLICY, INFO_POLICY, STMT, UDF_FILE, REGISTER_TASK, INDEX_TASK, INFO_STRING, ADMIN_POLICY; } public Set<VariableDefinition> definitions = new HashSet<VariableDefinition>(); } /** A whole qql file */ aql : statements EOF ; statements : statement* ; /** The supported aql statements */ statement locals [String source, String nameSpace, String setName] : connect //generator exec | disconnect //generator exec | create //generator exec | drop //generator exec | repair | grant | revoke | remove //generator exec | insert //generator exec | update //generator exec | delete //generator exec | select //generator exec | register //generator exec | execute //generator exec | aggregate //generator exec | operate //generator exec | show //generator exec | desc //generator exec | stat //generator exec | set //generator exec | get //generator exec | run //generator | kill //generator | quit //exec | help | print //generator ; /** CONNECTION CONNECT <host name> <port> [<timeout>] DISCONNECT <host name> address of a cluster node <port> port for connection - default 3000 <timeout> client timeout */ connect : CONNECT hostName=STRINGLITERAL port=INTLITERAL (timeout=INTLITERAL)? ; disconnect : DISCONNECT ; /** CREATE INDEX <index> ON <ns>[.<set>] (<bin>) NUMERIC|STRING */ create : CREATE (INDEX index_name ON nameSet '(' binName=bin ')' iType=(NUMERIC | STRING) {definitions.add(VariableDefinition.INDEX_TASK);} | USER user PASSWORD password (ROLE role | ROLES roles*) {definitions.add(VariableDefinition.ADMIN_POLICY);} ) { definitions.add(VariableDefinition.WRITE_POLICY); } ; /** * DROP INDEX <ns>[.<set>] <index> * DROP MODULE modulename.extension * DROP SET <ns>[.<set>] * DROP USER <username> */ drop : DROP ( INDEX nameSet index_name | MODULE moduleName | SET nameSet | USER user {definitions.add(VariableDefinition.ADMIN_POLICY);} ) ; /** * REPAIR INDEX <index> ON <ns>[.<set>] */ repair : REPAIR INDEX index_name ON nameSet ; grant : GRANT (ROLES roles | ROLE role ) TO user {definitions.add(VariableDefinition.ADMIN_POLICY);} ; revoke : REVOKE (ROLES roles | ROLE role ) FROM user {definitions.add(VariableDefinition.ADMIN_POLICY);} ; user : IDENTIFIER ; password : IDENTIFIER ; roles : role (',' role)* ; role : 'read' | 'read-write' | 'sys-admin' | 'user-admin' ; remove : REMOVE MODULE moduleName ; operate : OPERATE operateFunction (',' operateFunction)* ON nameSet WHERE primaryKeyPredicate (AND generationPredicate)? { definitions.add(VariableDefinition.WRITE_POLICY); definitions.add(VariableDefinition.READ_POLICY); definitions.add(VariableDefinition.RECORD); } ; /* DML: INSERT INTO namespace[.setname] (PK,binnames,,,) VALUES ('pk',nnn,'xxx',,) DELETE FROM namespace[.setname] WHERE PK = 'x' */ /** INSERT INTO namespace[.setname] (PK,binnames,,,) VALUES ('pk',nnn,'xxx',,) */ insert : INSERT INTO nameSet '(' PK (',' binNameList) ')' VALUES '(' primaryKey[$statement::nameSpace, $statement::setName] (',' valueList) ')' { definitions.add(VariableDefinition.WRITE_POLICY); } ; /** * UPDATE <name space>[.<set name>] SET <bin name> = <value>, ... WHERE PK = <value> [AND generation = <value>] */ update : UPDATE nameSet SET updateList WHERE primaryKeyPredicate (AND generationPredicate)? { definitions.add(VariableDefinition.WRITE_POLICY); } ; updateList : (ttlValue | binValue) (',' binValue)* ; /** DELETE FROM namespace[.setname] WHERE PK = 'x' */ delete : DELETE FROM nameSet WHERE primaryKeyPredicate (AND generationPredicate)? { definitions.add(VariableDefinition.WRITE_POLICY); } ; /** SELECT *|bin,,, FROM namespace[.setname] SELECT *|bin,,, FROM namespace[.setname] ORDER BY xxx SELECT *|bin,,, FROM namespace[.setname] WHERE bin = nnn SELECT *|bin,,, FROM namespace[.setname] WHERE bin = 'xxx' SELECT *|bin,,, FROM namespace[.setname] WHERE bin BETWEEN nnn AND mmm SELECT *|bin,,, FROM namespace[.setname] WHERE PK = 'x' Note:SELECT...WHERE bin ... needs an INDEX on bin. Use CREATE INDEX first. */ select : SELECT ( STAR | binNameList) FROM nameSet where? { definitions.add(VariableDefinition.READ_POLICY); definitions.add(VariableDefinition.SCAN_POLICY); definitions.add(VariableDefinition.RECORD); definitions.add(VariableDefinition.STMT); } ; where : WHERE predicate ; operateFunction : ADD '(' bin ',' value ')' | PUT '(' bin ',' value ')' | APPEND '(' bin ',' value ')' | PREPEND '(' bin ',' value ')' | GET ('(' bin ')')? | TOUCH | HEADER ; nameSet locals [String namespaceName, String setName] @after{ $statement::nameSpace = $namespaceName; $statement::setName = $setName; } : namespace_name {$namespaceName = $namespace_name.text;} ('.' set_name {$setName = $set_name.text;})? ; /* UDF: REGISTER MODULE 'filepath' REMOVE MODULE pkgname.extension EXECUTE pkgname.funcname(arg1,arg2,,) ON namespace[.setname] EXECUTE pkgname.funcname(arg1,arg2,,) ON namespace[.setname] WHERE PK = 'X' AGGREGATE pkgname.funcname(arg1,arg2,,) ON namespace[.setname] WHERE bin = nnn AGGREGATE pkgname.funcname(arg1,arg2,,) ON namespace[.setname] WHERE bin BETWEEN nnn AND mmm UDF */ // clinfo -v udf-list // clinfo -v udf-get:filename=<filename> --> Base64 encoded /** REGISTER MODULE 'filepath' */ register : REGISTER MODULE filepath=filePath { definitions.add(VariableDefinition.READ_POLICY); definitions.add(VariableDefinition.REGISTER_TASK); definitions.add(VariableDefinition.UDF_FILE); } ; /** EXECUTE pkgname.funcname(arg1,arg2,,) ON namespace[.setname] EXECUTE pkgname.funcname(arg1,arg2,,) ON namespace[.setname] WHERE PK = 'X' */ execute : EXECUTE moduleFunction '(' valueList? ')' ON nameSet (where)? { definitions.add(VariableDefinition.READ_POLICY); } ; /** AGGREGATE pkgname.funcname(arg1,arg2,,) ON namespace[.setname] WHERE bin = nnn AGGREGATE pkgname.funcname(arg1,arg2,,) ON namespace[.setname] WHERE bin BETWEEN nnn AND mmm */ aggregate : AGGREGATE moduleFunction ('(' (valueList)? ')')? ON nameSet (where)? { definitions.add(VariableDefinition.QUERY_POLICY); definitions.add(VariableDefinition.RESULT_SET); definitions.add(VariableDefinition.STMT); } ; moduleFunction : packageName=(IDENTIFIER | LLIST | LMAP) '.' functionName=(IDENTIFIER | ADD | SCAN | 'find' | 'size' | 'remove' | 'destroy' | 'get_config' | 'get_capacity' | 'put' | 'get') ; binNameList : (TTL|bin) (',' bin)* ; valueList : value (',' value )* ; predicate : (primaryKeyPredicate | filterPredicate) ; primaryKeyPredicate : PK EQ primaryKey[$statement::nameSpace, $statement::setName] ; generationPredicate : 'generation' EQ INTLITERAL ; filterPredicate : (equalityFilter | rangeFilter) { definitions.add(VariableDefinition.QUERY_POLICY); definitions.add(VariableDefinition.RECORD_SET); } ; equalityFilter : binValue ; ttlValue : TTL EQ integerValue ; binValue : bin EQ value ; rangeFilter : bin BETWEEN low=integerValue AND high=integerValue ; /* INFO: SHOW MODULES SHOW NAMESPACES|SETS|BINS SHOW SCANS|QUERIES SHOW INDEXES [namespace[.set]] DESC INDEX namespace indexname DESC MODULE pkgname.extension STAT INDEX namespace indexname STAT QUERY STAT SYSTEM */ /** SHOW MODULES SHOW NAMESPACES|SETS|BINS SHOW SCANS|QUERIES SHOW INDEXES [namespace[.set]] */ show : SHOW ( INDEXES nameSet? | SCANS | NAMESPACES | SETS | BINS | QUERIES | MODULES | USER user {definitions.add(VariableDefinition.ADMIN_POLICY);} | USERS {definitions.add(VariableDefinition.ADMIN_POLICY);} ) { definitions.add(VariableDefinition.INFO_POLICY); definitions.add(VariableDefinition.INFO_STRING); } ; /** DESC INDEX namespace indexname DESC MODULE pkgname.extension */ desc : DESC ( MODULE moduleName | INDEX namespace_name index_name ) { definitions.add(VariableDefinition.INFO_POLICY); definitions.add(VariableDefinition.INFO_STRING); } ; /** STAT INDEX namespace indexname STAT QUERY STAT SYSTEM */ stat : STAT (INDEX namespace_name index_name | QUERY | SYSTEM ) { definitions.add(VariableDefinition.INFO_POLICY); definitions.add(VariableDefinition.INFO_STRING); } ; /* ADMIN: # text_string - comment in script, line skipped. NOTE: Do not specify value with GET. eg: SET ECHO true, GET ECHO Note: These are client side paths for lua files. KILL_QUERY transaction_id KILL_SCAN scan_id RUN 'filename' (Each line in the file contains an asql command) HELP QUIT|EXIT|Q */ /* Settings SET|GET VIEW JSON|TABLE [default at startup - TABLE] @@ SET|GET VERBOSE true|false [default false] SET|GET ECHO true|false [default false] SET|GET TIMEOUT timeout_ms [default 1000] SET|GET RECORD_TTL record_ttl_sec [default 0 - never expire] SET|GET LUA_USERPATH 'path' [default /opt/citrusleaf/usr/udf/lua] SET|GET LUA_SYSPATH 'path' [default /opt/citrusleaf/sys/udf/lua] */ set : SET (TIMEOUT timeOut=INTLITERAL {definitions.add(VariableDefinition.READ_POLICY);definitions.add(VariableDefinition.WRITE_POLICY);} | VERBOSE verboseOn=booleanLiteral | ECHO echoOn=booleanLiteral | TTL ttl=INTLITERAL | OUTPUT viewType | LUA_USER_PATH luaUserPath=STRINGLITERAL | FAIL_ON_CLUSTER_CHANGE | PASSWORD password FOR user {definitions.add(VariableDefinition.ADMIN_POLICY);} ) ; get : GET ( TIMEOUT | VERBOSE | ECHO | TTL | OUTPUT | LUA_USER_PATH | FAIL_ON_CLUSTER_CHANGE ) ; viewType : 'json'|'table'|'nosql'|'lua' ; /** RUN 'filename' (Each line in the file contains an asql command) */ run : RUN STRINGLITERAL ; /** PRINT text_string */ print : PRINT STRINGLITERAL? ; kill : KILL ( QUERY | SCAN ) INTLITERAL ; /** KILL_QUERY transaction_id */ kill_query : KILL_QUERY INTLITERAL ; /** KILL_SCAN scan_id */ kill_scan : KILL_SCAN INTLITERAL ; /** QUIT|EXIT|Q */ quit : QUIT | EXIT | 'q' ; /** HELP */ help : 'help' ; primaryKey [String nameSpace, String setName] : key=(STRINGLITERAL | INTLITERAL) ; package_name : IDENTIFIER ; index_name : IDENTIFIER ; namespace_name : IDENTIFIER ; set_name : setName= IDENTIFIER { if ($setName.text.length() > 63) notifyErrorListeners("Set name exceeds 63 characters"); } ; bin : binName=IDENTIFIER { if ($binName.text.length() > 14) notifyErrorListeners("Bin name exceeds 14 characters"); } ; value //Generate : integerValue | textValue ; textValue //Generate : STRINGLITERAL ; integerValue //Generate : INTLITERAL ; booleanLiteral : TRUE | FALSE ; moduleName : IDENTIFIER '.' ('lua'|'so') ; filePath : STRINGLITERAL // : '/'? IDENTIFIER ('/' IDENTIFIER)* ('.' IDENTIFIER)? // | '\\'? IDENTIFIER ('\\' IDENTIFIER)* ('.' IDENTIFIER)? ; TRUE : 'true' ; FALSE : 'false' ; // real nodes CONNECT: 'connect'; DISCONNECT: 'disconnect'; DESC: 'desc'; INSERT: 'insert'; SELECT: 'select'; DELETE : 'delete' ; CREATE : 'create' ; INDEX : 'index' ; EXECUTE : 'execute' ; WHERE : 'where' ; SHOW : 'show' ; DROP : 'drop' ; INDEXES : 'indexes' ; VALUES : 'values' ; SET : 'set' ; GET : 'get' ; MODULE : 'module' ; ON : 'on' ; OPERATE : 'operate' ; OUTPUT : 'output' ; PACKAGES : 'packages' ; INTO : 'into' ; FUNCTION : 'function' ; FROM : 'from' ; BY : 'by' ; AND : 'and' ; BETWEEN : 'between' ; RUN : 'run' ; STAT : 'stat' ; QUERY : 'query' ; SCAN : 'scan' ; TIMEOUT : 'timeout' ; QUIT : 'quit' ; EXIT : 'exit' ; KILL : 'kill' ; KILL_QUERY : 'kill_query' ; KILL_SCAN : 'kill_scan' ; PK : 'pk' ; STRING : 'string' ; NUMERIC : 'numeric' ; EQ : '=' ; STAR : '*' ; REGISTER : 'register' ; REMOVE : 'remove' ; AGGREGATE : 'aggregate' ; MODULES : 'modules' ; NAMESPACES : 'namespaces' ; SETS : 'sets' ; BINS : 'bins' ; SCANS : 'scans' ; QUERIES : 'queries' ; SYSTEM : 'system' ; ORDER : 'order' ; PRINT : 'print'; UPDATE : 'update'; VERBOSE : 'verbose'; ECHO : 'echo'; TTL : 'ttl'; USE_SMD : 'use_smd'; LUA_USER_PATH : 'lua_userpath'; LUA_SYSTEM_PATH : 'lua_syspath'; ADD : 'add'; PUT : 'put'; APPEND : 'append'; PREPEND : 'prepend'; TOUCH : 'touch'; HEADER : 'header'; LLIST: 'llist'; LSTACK: 'lstack'; LSET: 'lset'; LMAP: 'lmap'; USER: 'user'; USERS: 'users'; PASSWORD: 'password'; ROLE: 'role'; ROLES: 'roles'; GRANT: 'grant'; REVOKE: 'revoke'; TO: 'to'; FAIL_ON_CLUSTER_CHANGE: 'FAIL_ON_CLUSTER_CHANGE'; REPAIR: 'repair'; FOR: 'for'; IDENTIFIER : ( LETTER | UNDERSCORE )( LETTER| DIGIT | UNDERSCORE | HYPHEN)*; /** Single quote delimited string e.g. 'cats' or 'cat\'s' */ STRINGLITERAL : '\'' ( EscapeSequence | ~('\\'|'\'') )* '\'' ; FLOATLITERAL : ('+'|'-')? IntegerNumber '.' IntegerNumber? ; INTLITERAL : ('+'|'-')? IntegerNumber 'L'? ; HEXLITERAL : HexPrefix HexDigit HexDigit ; //PATHSEGMENT // : (LETTER | DIGIT | '.' | '_')+ // ; fragment IntegerNumber : '0' | '1'..'9' ('0'..'9')* | '0' ('0'..'7')+ ; fragment HexPrefix : '\\x' | '\\X' ; fragment HexDigit : (DIGIT|'a'..'f'|'A'..'F') ; fragment LETTER : ('a'..'z' | 'A'..'Z') ; fragment DIGIT : '0'..'9'; fragment UNDERSCORE : '_'; fragment HYPHEN : '-'; fragment SEMICOLON : ';'; fragment EscapeSequence : '\\' ('b'|'t'|'n'|'f'|'r'|'\''|'\\') ; NEWLINE: '\r'? '\n' -> channel(HIDDEN); // return newlines to parser (end-statement signal) WS: [ \r\t\u000C\n]+ -> channel(HIDDEN); /** # text_string - comment in script, line skipped. */ COMMENT : '#' ~[\r\n]* '\r'? '\n' -> channel(HIDDEN) ;
programs/oeis/322/A322534.asm
karttu/loda
0
164192
; A322534: Position of 2/3^n in the sequence of all numbers 1/2^m, 1/3^m, 2/3^m arranged in decreasing order. ; 1,5,8,12,15,19,23,26,30,33,37,41,44,48,51,55,58,62,66,69,73,76,80,84,87,91,94,98,101,105,109,112,116,119,123,127,130,134,137,141,144,148,152,155,159,162,166,170,173,177,180,184,188,191,195,198,202,205,209,213,216,220,223,227,231,234,238,241,245,248,252,256,259,263,266,270,274,277,281,284,288,291,295,299,302,306,309,313,317,320,324,327,331,334,338,342,345,349,352,356,360,363,367,370,374,378,381,385,388,392,395,399,403,406,410,413,417,421,424,428,431,435,438,442,446,449,453,456,460,464,467,471,474,478,481,485,489,492,496,499,503,507,510,514,517,521,524,528,532,535,539,542,546,550,553,557,560,564,568,571,575,578,582,585,589,593,596,600,603,607,611,614,618,621,625,628,632,636,639,643,646,650,654,657,661,664,668,671,675,679,682,686,689,693,697,700,704,707,711,714,718,722,725,729,732,736,740,743,747,750,754,758,761,765,768,772,775,779,783,786,790,793,797,801,804,808,811,815,818,822,826,829,833,836,840,844,847,851,854,858,861,865,869,872,876,879,883,887,890,894 add $0,1 mul $0,3 mov $3,$0 mov $4,123 mov $5,5038 lpb $0,1 mov $0,0 add $2,2 mul $2,17 add $4,1 mul $5,$3 div $5,$4 div $5,$2 mov $1,$5 add $1,41 lpe sub $1,43
src/utilities/logger.ads
SKNZ/BoiteMaker
0
10550
with ada.text_io; use ada.text_io; package logger is -- Log le message passé en débug procedure debug(output : string); -- Initialise le loggeur procedure initialize(console : boolean; file : string); -- Ferme le loggeur procedure close; private -- Afficher le debug sur la console show_debug : boolean := false; -- Fichier de log log_file : file_type; end logger;
oeis/292/A292632.asm
neoneye/loda-programs
11
174298
<gh_stars>10-100 ; A292632: a(n) = n! * [x^n] exp((n+2)*x)*(BesselI(0,2*x) - BesselI(1,2*x)). ; Submitted by <NAME> ; 1,2,10,77,798,10392,162996,2991340,62893270,1490758022,39334017996,1143492521437,36318168041260,1251270023475864,46481870133666792,1852054390616046345,78792796381529620710,3564894013016856836190,170921756533520140861020,8657018996674423681277455,461881087606113071895396420 mov $1,1 mov $2,1 mov $3,$0 add $3,1 add $3,$0 mov $4,1 lpb $3 mul $1,$4 sub $3,1 mul $1,$3 sub $3,1 add $5,1 add $5,$4 div $1,$5 mul $2,$0 add $2,$1 add $4,2 lpe mov $0,$2
oeis/129/A129346.asm
neoneye/loda-programs
11
25569
; A129346: a(2n) = A100525(n), a(2n+1) = A001653(n+1); a Pellian-related sequence. ; Submitted by <NAME> ; 4,5,22,29,128,169,746,985,4348,5741,25342,33461,147704,195025,860882,1136689,5017588,6625109,29244646,38613965,170450288,225058681,993457082,1311738121,5790292204,7645370045,33748296142,44560482149,196699484648,259717522849,1146448611746,1513744654945,6681992185828,8822750406821,38945504503222,51422757785981,226991034833504,299713796309065,1323000704497802,1746860020068409,7711013192153308,10181446324101389,44943078448422046,59341817924539925,261947457498378968,345869461223138161 add $0,1 lpb $0 sub $0,1 add $1,1 add $1,$3 sub $3,$2 sub $4,$3 add $4,$2 sub $2,1 add $4,3 mov $5,$4 mov $4,$2 mov $2,$3 add $4,$1 add $5,$4 mov $3,$5 lpe mov $0,$3 add $0,1
Lab4/lab4.adb
albinjal/ada_basic
3
20622
with Date_Package; use Date_Package; with Ada.Text_IO; use Ada.Text_IO; procedure Lab4 is type Dates is array (1..10) of Date_Type; procedure Sort(Arrayen_Med_Talen: in out Dates) is procedure Swap(Tal_1,Tal_2: in out Date_Type) is Tal_B : Date_Type; -- Temporary buffer begin Tal_B := Tal_1; Tal_1 := Tal_2; Tal_2 := Tal_B; -- DEBUG New_Line; Put("SWAP IS RUNNING! INDEXES INPUT: "); Put(Tal_1); Put("+"); Put(Tal_2); New_Line; end Swap; Minsta_Talet: Date_Type; Minsta_Talet_Index: Integer; begin --Minsta_Talet.Year := 0; --Minsta_Talet.Month := 0; --Minsta_Talet.Day := 0; -- -- Loopa antalet gånger som arrayens längd for IOuter in Arrayen_Med_Talen'Range loop -- -- DEBUG Put("> "); Put(IOuter); Put(" <"); New_Line; -- -- Loopa arrayen med start från yttra loopens värde varje gång. 1..20, 2..20, ... , 20..20 for I in IOuter..Arrayen_Med_Talen'Last loop -- --DEBUG Put(">>>"); Put(I); New_Line; if I = IOuter or Arrayen_Med_Talen(I) < Minsta_Talet then Minsta_Talet := Arrayen_Med_Talen(I); Minsta_Talet_Index := I; end if; end loop; -- Swap(Arrayen_Med_Talen(IOuter), Arrayen_Med_Talen(Minsta_Talet_Index)); -- --DEBUG New_Line; Put("Vi swappar "); Put(Iouter); Put(" och "); Put(Minsta_Talet_Index); New_Line; end loop; end Sort; procedure Test_Get(Date: out Date_Type) is begin loop begin Get(Date); exit; exception when YEAR_ERROR => Put_Line("FEL: YEAR_ERROR"); when MONTH_ERROR => Put_Line("FEL: MONTH_ERROR"); when DAY_ERROR => Put_Line("FEL: DAY_ERROR"); when FORMAT_ERROR => Put_Line("FEL: FORMAT_ERROR"); end; end loop; end Test_Get; Date: Date_Type; Date2: Date_Type; Dates_Array: Dates; begin Test_Get(Date); Test_Get(Date2); Put(Date); New_Line; Put(Date2); New_Line; for I in Dates'Range loop Get(Dates_Array(I)); end loop; for I in Dates'Range loop Put(Dates_Array(I)); New_Line; end loop; Sort(Dates_Array); New_Line; for I in Dates'Range loop Put(Dates_Array(I)); New_Line; end loop; Get(Date); Get(Date2); Put(Date); New_Line; Put(Date2); New_Line; if Date = Date2 then Put("Lika"); New_Line; else Put("Olika"); New_Line; end if; if Date > Date2 then Put(Date); Put(" > "); Put(Date2); New_Line; else Put(Date); Put(" !!> "); Put(Date2); New_Line; end if; if Date < Date2 then Put(Date); Put(" < "); Put(Date2); New_Line; else Put(Date); Put(" !!< "); Put(Date2); New_Line; end if; -- Date := Previous_Date(Date); -- Put(Date); New_Line; -- Date := Next_Date(Date); -- Put(Date); New_Line; --for I in 1..368 loop -- Date := Previous_Date(Date); -- Put(Date); New_Line; --end loop; --Test_Leap_Years; end Lab4;
oeis/265/A265155.asm
neoneye/loda-programs
11
24634
<reponame>neoneye/loda-programs<filename>oeis/265/A265155.asm ; A265155: Integers which are unique starting points for the algorithm described in A090566. ; Submitted by <NAME> ; 1,2,4,8,10,11,14,15,16,17,18,19,21,22,23 mov $4,$0 add $4,1 mov $7,$0 lpb $4 mov $0,$7 sub $4,1 sub $0,$4 mov $9,2 mov $10,0 mov $11,$0 lpb $9 mov $0,$11 mov $2,0 sub $9,1 add $0,$9 sub $0,1 mov $1,1 mov $3,$0 mul $3,4 sub $3,6 lpb $3 mul $1,$3 add $1,$3 mov $5,$0 cmp $5,0 add $0,$5 div $1,$0 add $2,$1 mul $1,$2 div $3,$0 sub $3,1 lpe sub $2,$3 add $2,1 div $1,$2 mov $0,$1 mov $8,$9 mul $8,$1 add $10,$8 lpe min $11,1 mul $11,$0 mov $0,$10 sub $0,$11 add $0,1 add $6,$0 lpe mov $0,$6
data/pokemon/dex_entries/wooper.asm
Dev727/ancientplatinum
28
242122
db "WATER FISH@" ; species name dw 104, 190 ; height, weight db "A mucous" next "membrane covers" next "its body. Touching" page "it barehanded will" next "cause a shooting" next "pain.@"
SubstTheory.agda
msullivan/godels-t
4
8607
<gh_stars>1-10 module SubstTheory where open import Prelude open import T -- I originally used postulated extensional equality to reason about -- identical substitutions. As it turns out, it's actually somewhat -- cleaner to appeal to a proof that using identically performing subst -- functions produce the same outputs. ---- (Lots of theory. *Lots*. Too much. Sigh.) module SubstTheory where Ren≡ : ∀ {Γ Γ'}(f g : TRen Γ Γ') → Set Ren≡ f g = ∀ {A} x → f {A} x ≡ g {A} x -- Some theorems about renamings wkeq : ∀{Γ Γ' A} {f g : TRen Γ Γ'} → Ren≡ f g → Ren≡ (wk {A = A} f) (wk g) wkeq eq Z = Refl wkeq eq (S n) = resp S (eq n) -- Prove that applying equal renamings produces equal outputs reneq : ∀{Γ Γ' A} {f g : TRen Γ Γ'} → Ren≡ f g → (e : TExp Γ A) → ren f e ≡ ren g e reneq eq (var x) = resp var (eq x) reneq eq (Λ e) = resp Λ (reneq (wkeq eq) e) reneq eq (e₁ $ e₂) = resp2 _$_ (reneq eq e₁) (reneq eq e₂) reneq eq zero = Refl reneq eq (suc e) = resp suc (reneq eq e) reneq eq (rec e e₀ es) = resp3 rec (reneq eq e) (reneq eq e₀) (reneq (wkeq eq) es) wkid : ∀{Γ A C} (x : A ∈ C :: Γ) → wk renId x ≡ renId x wkid Z = Refl wkid (S n) = Refl renid : ∀{Γ A} (e : TExp Γ A) → ren renId e ≡ id _ e renid (var x) = Refl renid (Λ e) = resp Λ (reneq wkid e ≡≡ renid e) renid (e₁ $ e₂) = resp2 _$_ (renid e₁) (renid e₂) renid zero = Refl renid (suc e) = resp suc (renid e) renid (rec e e₀ es) = resp3 rec (renid e) (renid e₀) (reneq wkid es ≡≡ renid es) wkcomp : ∀ {B Γ Γ'}(f : TRen Γ Γ')(g : TRen B Γ) {C A} (x : A ∈ (C :: B)) → wk (renComp f g) x ≡ (wk f o wk g) x wkcomp f g Z = Refl wkcomp f g (S n) = Refl rencomp : ∀ {B Γ Γ'}(f : TRen Γ Γ')(g : TRen B Γ) {A} (e : TExp B A) → ren (renComp f g) e ≡ (ren f o ren g) e rencomp f g (var x) = Refl rencomp f g (Λ e) = resp Λ (reneq (wkcomp f g) e ≡≡ (rencomp (wk f) (wk g) e)) rencomp f g (e₁ $ e₂) = resp2 _$_ (rencomp f g e₁) (rencomp f g e₂) rencomp f g zero = Refl rencomp f g (suc e) = resp suc (rencomp f g e) rencomp f g (rec e e₀ es) = resp3 rec (rencomp f g e) (rencomp f g e₀) (reneq (wkcomp f g) es ≡≡ (rencomp (wk f) (wk g) es)) Sub≡ : ∀ {Γ Γ'}(f g : TSubst Γ Γ') → Set Sub≡ f g = ∀ {A} x → f {A} x ≡ g {A} x lifteq : ∀{Γ Γ' A} {f g : TSubst Γ Γ'} → Sub≡ f g → Sub≡ (liftγ {A = A} f) (liftγ g) lifteq eq Z = Refl lifteq eq (S n) = resp (λ x → ren S x) (eq n) -- Prove that applying equal substs produces equal outputs subeq : ∀{Γ Γ' A} {f g : TSubst Γ Γ'} → Sub≡ f g → (e : TExp Γ A) → ssubst f e ≡ ssubst g e subeq eq (var x) = eq x subeq eq (Λ e) = resp Λ (subeq (lifteq eq) e) subeq eq (e₁ $ e₂) = resp2 _$_ (subeq eq e₁) (subeq eq e₂) subeq eq zero = Refl subeq eq (suc e) = resp suc (subeq eq e) subeq eq (rec e e₀ es) = resp3 rec (subeq eq e) (subeq eq e₀) (subeq (lifteq eq) es) -- Theorems about renaming and substitution renwklift : ∀{K Γ Δ C}(f : TRen Γ Δ)(g : TSubst K Γ){A}(x : A ∈ (C :: K)) → (ren (wk f) o (liftγ g)) x ≡ liftγ (ren f o g) x renwklift f g Z = Refl renwklift f g (S n) = symm (rencomp (wk f) S (g n)) ≡≡ rencomp S f (g n) rensub : ∀{B Γ Δ}(f : TRen Γ Δ)(g : TSubst B Γ){A}(e : TExp B A) → (ren f o ssubst g) e ≡ ssubst (ren f o g) e rensub f g (var x) = Refl rensub f g (Λ e) = resp Λ ((rensub (wk f) (liftγ g) e) ≡≡ subeq (renwklift f g) e) rensub f g (e₁ $ e₂) = resp2 _$_ (rensub f g e₁) (rensub f g e₂) rensub f g zero = Refl rensub f g (suc e) = resp suc (rensub f g e) rensub f g (rec e e₀ es) = resp3 rec (rensub f g e) (rensub f g e₀) ((rensub (wk f) (liftγ g) es) ≡≡ subeq (renwklift f g) es) liftwk : ∀{K Γ Δ C}(f : TSubst Γ Δ)(g : TRen K Γ){A}(x : A ∈ (C :: K)) → (liftγ f o wk g) x ≡ liftγ (f o g) x liftwk f g Z = Refl liftwk f g (S n) = Refl subren : ∀{B Γ Δ}(f : TSubst Γ Δ)(g : TRen B Γ){A}(e : TExp B A) → (ssubst f o ren g) e ≡ ssubst (f o g) e subren f g (var x) = Refl subren f g (Λ e) = resp Λ ((subren (liftγ f) (wk g) e) ≡≡ subeq (liftwk f g) e) subren f g (e₁ $ e₂) = resp2 _$_ (subren f g e₁) (subren f g e₂) subren f g zero = Refl subren f g (suc e) = resp suc (subren f g e) subren f g (rec e e₀ es) = resp3 rec (subren f g e) (subren f g e₀) ((subren (liftγ f) (wk g) es) ≡≡ subeq (liftwk f g) es) -- first monad law, the second holds definitionally liftid : ∀{Γ A C} (x : A ∈ C :: Γ) → liftγ emptyγ x ≡ emptyγ x liftid Z = Refl liftid (S n) = Refl subid : ∀{Γ}{A} (e : TExp Γ A) → ssubst emptyγ e ≡ id _ e subid (var x) = Refl subid (Λ e) = resp Λ (subeq liftid e ≡≡ subid e) subid (e₁ $ e₂) = resp2 _$_ (subid e₁) (subid e₂) subid zero = Refl subid (suc e) = resp suc (subid e) subid (rec e e₀ es) = resp3 rec (subid e) (subid e₀) (subeq liftid es ≡≡ subid es) -- third monad law liftcomp : ∀ {B Γ Γ'}(f : TSubst Γ Γ')(g : TSubst B Γ) {C A} (x : A ∈ (C :: B)) → liftγ (subComp f g) x ≡ (ssubst (liftγ f) o liftγ g) x liftcomp f g Z = Refl liftcomp f g (S n) = rensub S f (g n) ≡≡ symm (subren (liftγ f) S (g n)) subcomp : ∀{B Γ Γ'}(f : TSubst Γ Γ')(g : TSubst B Γ){A}(t : TExp B A) → ssubst (subComp f g) t ≡ (ssubst f o ssubst g) t subcomp f g (var x) = Refl subcomp f g (Λ e) = resp Λ (subeq (liftcomp f g) e ≡≡ (subcomp (liftγ f) (liftγ g) e)) subcomp f g (e₁ $ e₂) = resp2 _$_ (subcomp f g e₁) (subcomp f g e₂) subcomp f g zero = Refl subcomp f g (suc e) = resp suc (subcomp f g e) subcomp f g (rec e e₀ es) = resp3 rec (subcomp f g e) (subcomp f g e₀) (subeq (liftcomp f g) es ≡≡ (subcomp (liftγ f) (liftγ g) es)) -- The lemma about combining substitutions that we are actually -- going to need. Being able to prove this lemma was the cause -- of most of the grief during this proof. combine-subst-noob : ∀ {Γ A C} → (γ : TSubst Γ []) → (e : TExp (A :: Γ) C) → (e' : TCExp A) → ssubst (extendγ γ e') e ≡ ssubst (singγ e') (ssubst (liftγ γ) e) combine-subst-noob γ e e' = subcomp (singγ e') (liftγ γ) e -- A lemma we need to define our relations on substs that respect relns extend-nofail-s : ∀{Γ Γ' A B} → (γ : TSubst Γ Γ') → (e : TExp Γ' A) → (n : B ∈ Γ) → γ n ≡ (extendγ γ e) (S n) extend-nofail-s γ e n = symm (subren (singγ e) S (γ n) ≡≡ subid (γ n)) -- A closed subst is the identity closed-is-empty-ren : (γ : TRen [] []) → Ren≡ γ renId closed-is-empty-ren γ () closed-is-empty : (γ : TSubst [] []) → Sub≡ γ emptyγ closed-is-empty γ () -- A substitution made on a closed term is the identity substitution closed-ren : ∀{A} → (γ : TRen [] []) → (e : TCExp A) → ren γ e ≡ e closed-ren γ e = reneq (closed-is-empty-ren γ) e ≡≡ renid e closed-subst : ∀{A} → (γ : TSubst [] []) → (e : TCExp A) → ssubst γ e ≡ e closed-subst γ e = subeq (closed-is-empty γ) e ≡≡ subid e -- lift of a closed subst, also identity - feel like there is a nicer way to do this lift-closed-is-empty : ∀{A} (γ : TSubst [] []) → Sub≡ (liftγ {A = A} γ) emptyγ lift-closed-is-empty γ Z = Refl lift-closed-is-empty γ (S x) = resp (ren _) (closed-is-empty γ x) lift-closed-subst : ∀{A B} → (γ : TSubst [] []) → (e : TExp (B :: []) A) → ssubst (liftγ γ) e ≡ e lift-closed-subst γ e = subeq (lift-closed-is-empty γ) e ≡≡ subid e compose-subst-noob : ∀{Γ} {C} → (γ : TSubst Γ []) → (e : TExp Γ C) → {A : TTp} → (x : A ∈ C :: Γ) → subComp (singγ (ssubst γ e)) (liftγ γ) x ≡ subComp γ (singγ e) x compose-subst-noob γ e Z = Refl compose-subst-noob γ e (S x) = subren (singγ (ssubst γ e)) (λ y → S y) (γ x) ≡≡ subid (γ x) drop-fix : ∀{Γ A} → (γ : TSubst (A :: Γ) []) → Sub≡ γ (subComp (singγ (γ Z)) (liftγ (dropγ γ))) drop-fix γ Z = Refl drop-fix γ (S x) = symm (subren (singγ (γ Z)) S (γ (S x)) ≡≡ subid (γ (S x))) open SubstTheory public
ada/src/sarge.ads
irieger/Sarge
0
15839
<filename>ada/src/sarge.ads -- sarge.ads - Specification file for the Sarge command line argument parser project. -- Revision 0 -- Notes: -- - -- 2019/04/10, <NAME> with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Containers.Vectors; with Ada.Containers.Indefinite_Ordered_Maps; use Ada.Containers; package Sarge is type Argument is record arg_short: Unbounded_String; arg_long: Unbounded_String; description: Unbounded_String; hasValue: boolean := False; value: Unbounded_String; parsed: boolean := False; end record; type Argument_Access is access all Argument; procedure setArgument(arg_short: in Unbounded_String; arg_long: in Unbounded_String; desc: in Unbounded_String; hasVal: in boolean); procedure setDescription(desc: in Unbounded_String); procedure setUsage(usage: in Unbounded_String); function parseArguments return boolean; function getFlag(arg_flag: in Unbounded_String; arg_value: out Unbounded_String) return boolean; function exists(arg_flag: in Unbounded_String) return boolean; procedure printHelp; function flagCount return integer; function executableName return Unbounded_String; private function "+"(S : in String) return Unbounded_String renames Ada.Strings.Unbounded.To_Unbounded_String; package arg_vector is new Vectors(Natural, Argument); args: arg_vector.vector; package argNames_map is new Indefinite_Ordered_Maps(Unbounded_String, Argument_Access); argNames: argNames_map.map; parsed: boolean; flagCounter: Integer := 0; execName: Unbounded_String; description: Unbounded_String; usageStr: Unbounded_String; end Sarge;
base/crts/fpw32/tran/i386/atan.asm
npocmaka/Windows-Server-2003
17
96454
<filename>base/crts/fpw32/tran/i386/atan.asm ;*** ; ; Copyright (c) 1984-2001, Microsoft Corporation. All rights reserved. ; ;Purpose: ; support for atan() function ; ;Revision History: ; 01-26-01 PML Pentium4 merge. ; ;******************************************************************************* .xlist include cruntime.inc include elem87.inc .list _FUNC_ equ <atan> _FUNC_DEF_ equ <_atan_default> _FUNC_P4_ equ <_atan_pentium4> _FUNC_P4_EXTERN_ equ 1 include disp_pentium4.inc _FUNC_ equ <_CIatan> _FUNC_DEF_ equ <_CIatan_default> _FUNC_P4_ equ <_CIatan_pentium4> include disp_pentium4.inc .data _NAME_ db 'atan',0,0,0,0 extrn _indefinite:tbyte extrn __fastflag:dword extrn _piby2:tbyte extrn _DEFAULT_CW_in_mem:word CODESEG extrn _startOneArgErrorHandling:near extrn _fload_withFB:near extrn _convertTOStoQNaN:near extrn _checkTOS_withFB:near extrn _math_exit:near extrn _fast_exit:near ; arg ErrorType result ;------------------------------------------- ;+infinity - pi/2 ;-infinity - -pi/2 ;QNaN DOMAIN_QNAN QNaN | ? to distinguish them??? ;SNaN DOMAIN indefinite | ? it costs 14 bytes per function ;indefinite is like QNaN ;denormal fld converts it to normal (80 bits) public _atan_default,_CIatan_default _CIatan_default proc sub esp,DBLSIZE+4 ; for argument fst qword ptr [esp] call _checkTOS_withFB call start add esp, DBLSIZE+4 ret _atan_default label proc lea edx, [esp+4] call _fload_withFB start: push edx ; allocate space for Control Word fstcw [esp] ; store Control Word ; at this point we have on stack: cw(4), ret_addr(4), arg1(8bytes) jz inf_or_nan cmp word ptr[esp], default_CW je CW_is_set_to_default ; fpatan is not affected by precision bits. So we may ignore user's CW fldcw _DEFAULT_CW_in_mem CW_is_set_to_default: fld1 ; load 1.0 fpatan ; fpatan(x,1.0) exit: cmp __fastflag, 0 jnz _fast_exit ; prepare in registers arguments for math_exit mov edx,OP_ATAN lea ecx,[_NAME_] jmp _math_exit not_infinity: call _convertTOStoQNaN ; eax MUST contain high dword jmp _Error_handling ; eax=error number inf_or_nan: test eax, 000fffffh jnz not_infinity cmp dword ptr[esp+8], 0 jne not_infinity fstp st(0) fld [_piby2] test eax,80000000H jz exit ; return pi/2 fchs jmp exit ; return -pi/2 mov eax,DOMAIN _Error_handling: cmp __fastflag, 0 jnz _fast_exit mov edx,OP_ATAN lea ecx,[_NAME_] call _startOneArgErrorHandling pop edx ; remove saved CW from stack ret _CIatan_default endp end
_inc/Debug list - LZ.asm
NatsumiFox/AMPS-Sonic-1-2005
2
240699
<filename>_inc/Debug list - LZ.asm ; --------------------------------------------------------------------------- ; Debug list - Labyrinth ; --------------------------------------------------------------------------- dc.w $19 dc.l Map_obj25+$25000000 dc.b 0, 0, $27, $B2 dc.l Map_obj26+$26000000 dc.b 0, 0, 6, $80 dc.l Map_obj41+$41000000 dc.b 0, 0, 5, $23 dc.l Map_obj2C+$2C000000 dc.b 8, 0, $24, $86 dc.l Map_obj2D+$2D000000 dc.b 0, 2, $84, $A6 dc.l Map_obj16+$16000000 dc.b 0, 0, 3, $CC dc.l Map_obj16+$16000000 dc.b 2, 3, 3, $CC dc.l Map_obj33+$33000000 dc.b 0, 0, $43, $DE dc.l Map_obj32+$32000000 dc.b 0, 0, 5, $13 dc.l Map_obj36+$36000000 dc.b 0, 0, 5, $1B dc.l Map_obj52a+$52000000 dc.b 4, 0, $43, $BC dc.l Map_obj61+$61000000 dc.b 1, 0, $43, $E6 dc.l Map_obj61+$61000000 dc.b $13, 1, $43, $E6 dc.l Map_obj61+$61000000 dc.b 5, 0, $43, $E6 dc.l Map_obj62+$62000000 dc.b 0, 0, $44, $3E dc.l Map_obj61+$61000000 dc.b $27, 2, $43, $E6 dc.l Map_obj61+$61000000 dc.b $30, 3, $43, $E6 dc.l Map_obj63+$63000000 dc.b $7F, 0, 3, $F6 dc.l Map_obj60+$60000000 dc.b 0, 0, 4, $67 dc.l Map_obj64+$64000000 dc.b $84, $13, $83, $48 dc.l Map_obj65+$65000000 dc.b 2, 2, $C2, $59 dc.l Map_obj65+$65000000 dc.b 9, 9, $C2, $59 dc.l Map_obj0B+$B000000 dc.b 0, 0, $43, $DE dc.l Map_obj0C+$C000000 dc.b 2, 0, $43, $28 dc.l Map_obj79+$79000000 dc.b 1, 0, 7, $A0 even
Task/Catamorphism/Ada/catamorphism.ada
LaudateCorpus1/RosettaCodeData
1
6163
<filename>Task/Catamorphism/Ada/catamorphism.ada with Ada.Text_IO; procedure Catamorphism is type Fun is access function (Left, Right: Natural) return Natural; type Arr is array(Natural range <>) of Natural; function Fold_Left (F: Fun; A: Arr) return Natural is Result: Natural := A(A'First); begin for I in A'First+1 .. A'Last loop Result := F(Result, A(I)); end loop; return Result; end Fold_Left; function Max (L, R: Natural) return Natural is (if L > R then L else R); function Min (L, R: Natural) return Natural is (if L < R then L else R); function Add (Left, Right: Natural) return Natural is (Left + Right); function Mul (Left, Right: Natural) return Natural is (Left * Right); package NIO is new Ada.Text_IO.Integer_IO(Natural); begin NIO.Put(Fold_Left(Min'Access, (1,2,3,4)), Width => 3); NIO.Put(Fold_Left(Max'Access, (1,2,3,4)), Width => 3); NIO.Put(Fold_Left(Add'Access, (1,2,3,4)), Width => 3); NIO.Put(Fold_Left(Mul'Access, (1,2,3,4)), Width => 3); end Catamorphism;
Lab 7 - Odd, Even, Positive and Negative Numbers/7b.asm
SathyasriS27/ARM7-Thumb-Programming
0
171500
<filename>Lab 7 - Odd, Even, Positive and Negative Numbers/7b.asm AREA SBCS, CODE, READONLY ENTRY LDR R0, =0X40000000; LDR R1, [R0], #04 ; LOAD DIVISION IN R1 LDR R2, [R0], #04 ; LOAD DIVIDEND INTO R2, HOLDS REMINDER MOV R6, #00 ; QUOTIENT LO SUBS R2, R1, R2 ; R2=R2-R1=-1; R2>R1 ADDCS R6, R6, #1 ; COUNT NUMBER OF LOOPS BCS LO ; STAY IN LOOP IF BORROW IS ZER0 ADD R2, R2, R1 STR R2, [R0], #04 STR R6, [R0], #04 UP B UP END
Snippets/Quotes.applescript
rogues-gallery/applescript
360
1776
set qwote to "\""
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_1639.asm
ljhsiun2/medusa
9
21592
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r12 push %r15 push %rax push %rcx push %rdi push %rsi lea addresses_D_ht+0x14c3e, %r10 nop add %rax, %rax mov (%r10), %rsi nop nop nop nop add %r12, %r12 lea addresses_A_ht+0x1bfde, %rsi lea addresses_WC_ht+0x15f2d, %rdi nop nop nop nop and $56297, %r15 mov $48, %rcx rep movsl sub %rsi, %rsi lea addresses_normal_ht+0x4464, %rax nop nop sub $47006, %rsi movw $0x6162, (%rax) nop nop nop nop xor $34841, %r15 lea addresses_WC_ht+0x1ab3e, %rsi nop nop nop nop add %r15, %r15 mov $0x6162636465666768, %rax movq %rax, %xmm2 movups %xmm2, (%rsi) nop nop nop nop nop cmp $58760, %rdi lea addresses_WC_ht+0x1456, %rsi lea addresses_WT_ht+0x15962, %rdi nop nop add $61611, %rax mov $25, %rcx rep movsl nop nop nop sub %rax, %rax lea addresses_normal_ht+0x50be, %rsi lea addresses_D_ht+0x1143e, %rdi nop nop nop add $42276, %r11 mov $61, %rcx rep movsb nop nop nop nop nop inc %rax lea addresses_WC_ht+0x1c5be, %rsi nop nop and $56063, %r10 vmovups (%rsi), %ymm6 vextracti128 $0, %ymm6, %xmm6 vpextrq $1, %xmm6, %rdi inc %r11 lea addresses_A_ht+0x15d8e, %rdi nop nop nop nop xor $28593, %r11 movb (%rdi), %r12b nop nop nop and %r12, %r12 lea addresses_WT_ht+0x363e, %rax add $59888, %r10 movb $0x61, (%rax) xor $62262, %rdi lea addresses_D_ht+0xc4de, %rcx nop add %r15, %r15 movb $0x61, (%rcx) nop nop and $57299, %rcx lea addresses_WT_ht+0x18c3e, %r12 nop nop nop add $36842, %rcx vmovups (%r12), %ymm2 vextracti128 $0, %ymm2, %xmm2 vpextrq $0, %xmm2, %rdi nop nop nop nop nop dec %rsi lea addresses_normal_ht+0xac3e, %rsi lea addresses_normal_ht+0x1613e, %rdi nop nop nop nop xor $27736, %rax mov $37, %rcx rep movsq nop nop nop add %r10, %r10 lea addresses_UC_ht+0x4c3e, %rax nop nop nop inc %rsi mov $0x6162636465666768, %r10 movq %r10, %xmm3 movups %xmm3, (%rax) nop nop nop nop and %r11, %r11 lea addresses_D_ht+0x1be62, %r11 nop nop nop add %r12, %r12 mov $0x6162636465666768, %rsi movq %rsi, %xmm3 vmovups %ymm3, (%r11) nop nop nop cmp %rax, %rax pop %rsi pop %rdi pop %rcx pop %rax pop %r15 pop %r12 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r14 push %r15 push %r8 push %rdi push %rsi // Faulty Load lea addresses_normal+0x7c3e, %r15 nop nop nop nop dec %rsi vmovups (%r15), %ymm6 vextracti128 $1, %ymm6, %xmm6 vpextrq $0, %xmm6, %rdi lea oracles, %r14 and $0xff, %rdi shlq $12, %rdi mov (%r14,%rdi,1), %rdi pop %rsi pop %rdi pop %r8 pop %r15 pop %r14 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': False, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_normal', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 11}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 2}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 1}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 7}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 2}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 1}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 7}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 8}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 6}} {'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_WT_ht', 'same': True, 'AVXalign': False, 'congruent': 5}} {'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 5}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 10}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 10}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 7}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 11}} {'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 2}} {'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 */
target/cos_117/disasm/iop_overlay1/UCCLS.asm
jrrk2/cray-sim
49
17319
0x0000 (0x000000) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0001 (0x000002) 0x291A- f:00024 d: 282 | OR[282] = A 0x0002 (0x000004) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0003 (0x000006) 0x291B- f:00024 d: 283 | OR[283] = A 0x0004 (0x000008) 0x7540- f:00072 d: 320 | R = P + 320 (0x0144) 0x0005 (0x00000A) 0x2118- f:00020 d: 280 | A = OR[280] 0x0006 (0x00000C) 0x1417- f:00012 d: 23 | A = A + 23 (0x0017) 0x0007 (0x00000E) 0x2908- f:00024 d: 264 | OR[264] = A 0x0008 (0x000010) 0x211B- f:00020 d: 283 | A = OR[283] 0x0009 (0x000012) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x000A (0x000014) 0x2118- f:00020 d: 280 | A = OR[280] 0x000B (0x000016) 0x1418- f:00012 d: 24 | A = A + 24 (0x0018) 0x000C (0x000018) 0x2908- f:00024 d: 264 | OR[264] = A 0x000D (0x00001A) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x000E (0x00001C) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x000F (0x00001E) 0x2118- f:00020 d: 280 | A = OR[280] 0x0010 (0x000020) 0x1419- f:00012 d: 25 | A = A + 25 (0x0019) 0x0011 (0x000022) 0x2908- f:00024 d: 264 | OR[264] = A 0x0012 (0x000024) 0x2119- f:00020 d: 281 | A = OR[281] 0x0013 (0x000026) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x0014 (0x000028) 0x1004- f:00010 d: 4 | A = 4 (0x0004) 0x0015 (0x00002A) 0x291C- f:00024 d: 284 | OR[284] = A 0x0016 (0x00002C) 0x3118- f:00030 d: 280 | A = (OR[280]) 0x0017 (0x00002E) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008) 0x0018 (0x000030) 0x2913- f:00024 d: 275 | OR[275] = A 0x0019 (0x000032) 0x0400- f:00002 d: 0 | I = 0 0x001A (0x000034) 0x0000- f:00000 d: 0 | PASS 0x001B (0x000036) 0x1034- f:00010 d: 52 | A = 52 (0x0034) 0x001C (0x000038) 0x29C3- f:00024 d: 451 | OR[451] = A 0x001D (0x00003A) 0x2113- f:00020 d: 275 | A = OR[275] 0x001E (0x00003C) 0x29C4- f:00024 d: 452 | OR[452] = A 0x001F (0x00003E) 0x2118- f:00020 d: 280 | A = OR[280] 0x0020 (0x000040) 0x29C5- f:00024 d: 453 | OR[453] = A 0x0021 (0x000042) 0x211C- f:00020 d: 284 | A = OR[284] 0x0022 (0x000044) 0x29C6- f:00024 d: 454 | OR[454] = A 0x0023 (0x000046) 0x211B- f:00020 d: 283 | A = OR[283] 0x0024 (0x000048) 0x29C7- f:00024 d: 455 | OR[455] = A 0x0025 (0x00004A) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0026 (0x00004C) 0x29C8- f:00024 d: 456 | OR[456] = A 0x0027 (0x00004E) 0x7DC2- f:00076 d: 450 | R = OR[450] 0x0028 (0x000050) 0x2118- f:00020 d: 280 | A = OR[280] 0x0029 (0x000052) 0x1414- f:00012 d: 20 | A = A + 20 (0x0014) 0x002A (0x000054) 0x290D- f:00024 d: 269 | OR[269] = A 0x002B (0x000056) 0x211C- f:00020 d: 284 | A = OR[284] 0x002C (0x000058) 0x390D- f:00034 d: 269 | (OR[269]) = A 0x002D (0x00005A) 0x2D0D- f:00026 d: 269 | OR[269] = OR[269] + 1 0x002E (0x00005C) 0x310D- f:00030 d: 269 | A = (OR[269]) 0x002F (0x00005E) 0x840B- f:00102 d: 11 | P = P + 11 (0x003A), A = 0 0x0030 (0x000060) 0x1002- f:00010 d: 2 | A = 2 (0x0002) 0x0031 (0x000062) 0x2924- f:00024 d: 292 | OR[292] = A 0x0032 (0x000064) 0x210D- f:00020 d: 269 | A = OR[269] 0x0033 (0x000066) 0x2925- f:00024 d: 293 | OR[293] = A 0x0034 (0x000068) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0035 (0x00006A) 0x2926- f:00024 d: 294 | OR[294] = A 0x0036 (0x00006C) 0x1124- f:00010 d: 292 | A = 292 (0x0124) 0x0037 (0x00006E) 0x5800- f:00054 d: 0 | B = A 0x0038 (0x000070) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0039 (0x000072) 0x7C09- f:00076 d: 9 | R = OR[9] 0x003A (0x000074) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x003B (0x000076) 0x290D- f:00024 d: 269 | OR[269] = A 0x003C (0x000078) 0x2118- f:00020 d: 280 | A = OR[280] 0x003D (0x00007A) 0x141C- f:00012 d: 28 | A = A + 28 (0x001C) 0x003E (0x00007C) 0x2908- f:00024 d: 264 | OR[264] = A 0x003F (0x00007E) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x0040 (0x000080) 0x8613- f:00103 d: 19 | P = P + 19 (0x0053), A # 0 0x0041 (0x000082) 0x1001- f:00010 d: 1 | A = 1 (0x0001) 0x0042 (0x000084) 0x2924- f:00024 d: 292 | OR[292] = A 0x0043 (0x000086) 0x2118- f:00020 d: 280 | A = OR[280] 0x0044 (0x000088) 0x141C- f:00012 d: 28 | A = A + 28 (0x001C) 0x0045 (0x00008A) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001) 0x0046 (0x00008C) 0x2925- f:00024 d: 293 | OR[293] = A 0x0047 (0x00008E) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0048 (0x000090) 0x2926- f:00024 d: 294 | OR[294] = A 0x0049 (0x000092) 0x1124- f:00010 d: 292 | A = 292 (0x0124) 0x004A (0x000094) 0x5800- f:00054 d: 0 | B = A 0x004B (0x000096) 0x1800-0x1918 f:00014 d: 0 | A = 6424 (0x1918) 0x004D (0x00009A) 0x7C09- f:00076 d: 9 | R = OR[9] 0x004E (0x00009C) 0x2006- f:00020 d: 6 | A = OR[6] 0x004F (0x00009E) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B) 0x0050 (0x0000A0) 0x2908- f:00024 d: 264 | OR[264] = A 0x0051 (0x0000A2) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x0052 (0x0000A4) 0x290D- f:00024 d: 269 | OR[269] = A 0x0053 (0x0000A6) 0x2118- f:00020 d: 280 | A = OR[280] 0x0054 (0x0000A8) 0x141C- f:00012 d: 28 | A = A + 28 (0x001C) 0x0055 (0x0000AA) 0x2908- f:00024 d: 264 | OR[264] = A 0x0056 (0x0000AC) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x0057 (0x0000AE) 0x291A- f:00024 d: 282 | OR[282] = A 0x0058 (0x0000B0) 0x2118- f:00020 d: 280 | A = OR[280] 0x0059 (0x0000B2) 0x141C- f:00012 d: 28 | A = A + 28 (0x001C) 0x005A (0x0000B4) 0x2908- f:00024 d: 264 | OR[264] = A 0x005B (0x0000B6) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x005C (0x0000B8) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x005D (0x0000BA) 0x210D- f:00020 d: 269 | A = OR[269] 0x005E (0x0000BC) 0x3118- f:00030 d: 280 | A = (OR[280]) 0x005F (0x0000BE) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008) 0x0060 (0x0000C0) 0x2913- f:00024 d: 275 | OR[275] = A 0x0061 (0x0000C2) 0x0400- f:00002 d: 0 | I = 0 0x0062 (0x0000C4) 0x0000- f:00000 d: 0 | PASS 0x0063 (0x0000C6) 0x1035- f:00010 d: 53 | A = 53 (0x0035) 0x0064 (0x0000C8) 0x29C3- f:00024 d: 451 | OR[451] = A 0x0065 (0x0000CA) 0x2113- f:00020 d: 275 | A = OR[275] 0x0066 (0x0000CC) 0x29C4- f:00024 d: 452 | OR[452] = A 0x0067 (0x0000CE) 0x2118- f:00020 d: 280 | A = OR[280] 0x0068 (0x0000D0) 0x29C5- f:00024 d: 453 | OR[453] = A 0x0069 (0x0000D2) 0x211A- f:00020 d: 282 | A = OR[282] 0x006A (0x0000D4) 0x29C6- f:00024 d: 454 | OR[454] = A 0x006B (0x0000D6) 0x211B- f:00020 d: 283 | A = OR[283] 0x006C (0x0000D8) 0x29C7- f:00024 d: 455 | OR[455] = A 0x006D (0x0000DA) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x006E (0x0000DC) 0x29C8- f:00024 d: 456 | OR[456] = A 0x006F (0x0000DE) 0x7DC2- f:00076 d: 450 | R = OR[450] 0x0070 (0x0000E0) 0x7513- f:00072 d: 275 | R = P + 275 (0x0183) 0x0071 (0x0000E2) 0x211A- f:00020 d: 282 | A = OR[282] 0x0072 (0x0000E4) 0x8602- f:00103 d: 2 | P = P + 2 (0x0074), A # 0 0x0073 (0x0000E6) 0x7003- f:00070 d: 3 | P = P + 3 (0x0076) 0x0074 (0x0000E8) 0x7064- f:00070 d: 100 | P = P + 100 (0x00D8) 0x0075 (0x0000EA) 0x7009- f:00070 d: 9 | P = P + 9 (0x007E) 0x0076 (0x0000EC) 0x2118- f:00020 d: 280 | A = OR[280] 0x0077 (0x0000EE) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001) 0x0078 (0x0000F0) 0x2908- f:00024 d: 264 | OR[264] = A 0x0079 (0x0000F2) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x007A (0x0000F4) 0x1A00-0xFF00 f:00015 d: 0 | A = A & 65280 (0xFF00) 0x007C (0x0000F8) 0x1404- f:00012 d: 4 | A = A + 4 (0x0004) 0x007D (0x0000FA) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x007E (0x0000FC) 0x2118- f:00020 d: 280 | A = OR[280] 0x007F (0x0000FE) 0x1408- f:00012 d: 8 | A = A + 8 (0x0008) 0x0080 (0x000100) 0x2908- f:00024 d: 264 | OR[264] = A 0x0081 (0x000102) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x0082 (0x000104) 0x291D- f:00024 d: 285 | OR[285] = A 0x0083 (0x000106) 0x2118- f:00020 d: 280 | A = OR[280] 0x0084 (0x000108) 0x1409- f:00012 d: 9 | A = A + 9 (0x0009) 0x0085 (0x00010A) 0x2908- f:00024 d: 264 | OR[264] = A 0x0086 (0x00010C) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x0087 (0x00010E) 0x291E- f:00024 d: 286 | OR[286] = A 0x0088 (0x000110) 0x211D- f:00020 d: 285 | A = OR[285] 0x0089 (0x000112) 0x8404- f:00102 d: 4 | P = P + 4 (0x008D), A = 0 0x008A (0x000114) 0x211E- f:00020 d: 286 | A = OR[286] 0x008B (0x000116) 0x8402- f:00102 d: 2 | P = P + 2 (0x008D), A = 0 0x008C (0x000118) 0x7003- f:00070 d: 3 | P = P + 3 (0x008F) 0x008D (0x00011A) 0x7C34- f:00076 d: 52 | R = OR[52] 0x008E (0x00011C) 0x0000- f:00000 d: 0 | PASS 0x008F (0x00011E) 0x211E- f:00020 d: 286 | A = OR[286] 0x0090 (0x000120) 0x1408- f:00012 d: 8 | A = A + 8 (0x0008) 0x0091 (0x000122) 0x2908- f:00024 d: 264 | OR[264] = A 0x0092 (0x000124) 0x1002- f:00010 d: 2 | A = 2 (0x0002) 0x0093 (0x000126) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x0094 (0x000128) 0x100E- f:00010 d: 14 | A = 14 (0x000E) 0x0095 (0x00012A) 0x2924- f:00024 d: 292 | OR[292] = A 0x0096 (0x00012C) 0x1001- f:00010 d: 1 | A = 1 (0x0001) 0x0097 (0x00012E) 0x2925- f:00024 d: 293 | OR[293] = A 0x0098 (0x000130) 0x211D- f:00020 d: 285 | A = OR[285] 0x0099 (0x000132) 0x2926- f:00024 d: 294 | OR[294] = A 0x009A (0x000134) 0x211E- f:00020 d: 286 | A = OR[286] 0x009B (0x000136) 0x2927- f:00024 d: 295 | OR[295] = A 0x009C (0x000138) 0x1124- f:00010 d: 292 | A = 292 (0x0124) 0x009D (0x00013A) 0x5800- f:00054 d: 0 | B = A 0x009E (0x00013C) 0x1800-0x1918 f:00014 d: 0 | A = 6424 (0x1918) 0x00A0 (0x000140) 0x7C09- f:00076 d: 9 | R = OR[9] 0x00A1 (0x000142) 0x2006- f:00020 d: 6 | A = OR[6] 0x00A2 (0x000144) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B) 0x00A3 (0x000146) 0x2908- f:00024 d: 264 | OR[264] = A 0x00A4 (0x000148) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x00A5 (0x00014A) 0x74C0- f:00072 d: 192 | R = P + 192 (0x0165) 0x00A6 (0x00014C) 0x2118- f:00020 d: 280 | A = OR[280] 0x00A7 (0x00014E) 0x1408- f:00012 d: 8 | A = A + 8 (0x0008) 0x00A8 (0x000150) 0x2908- f:00024 d: 264 | OR[264] = A 0x00A9 (0x000152) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x00AA (0x000154) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x00AB (0x000156) 0x2118- f:00020 d: 280 | A = OR[280] 0x00AC (0x000158) 0x1409- f:00012 d: 9 | A = A + 9 (0x0009) 0x00AD (0x00015A) 0x2908- f:00024 d: 264 | OR[264] = A 0x00AE (0x00015C) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x00AF (0x00015E) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x00B0 (0x000160) 0x7434- f:00072 d: 52 | R = P + 52 (0x00E4) 0x00B1 (0x000162) 0x2118- f:00020 d: 280 | A = OR[280] 0x00B2 (0x000164) 0x140A- f:00012 d: 10 | A = A + 10 (0x000A) 0x00B3 (0x000166) 0x2908- f:00024 d: 264 | OR[264] = A 0x00B4 (0x000168) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x00B5 (0x00016A) 0x291F- f:00024 d: 287 | OR[287] = A 0x00B6 (0x00016C) 0x2118- f:00020 d: 280 | A = OR[280] 0x00B7 (0x00016E) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B) 0x00B8 (0x000170) 0x2908- f:00024 d: 264 | OR[264] = A 0x00B9 (0x000172) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x00BA (0x000174) 0x2920- f:00024 d: 288 | OR[288] = A 0x00BB (0x000176) 0x74B6- f:00072 d: 182 | R = P + 182 (0x0171) 0x00BC (0x000178) 0x2118- f:00020 d: 280 | A = OR[280] 0x00BD (0x00017A) 0x140A- f:00012 d: 10 | A = A + 10 (0x000A) 0x00BE (0x00017C) 0x2908- f:00024 d: 264 | OR[264] = A 0x00BF (0x00017E) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x00C0 (0x000180) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x00C1 (0x000182) 0x2118- f:00020 d: 280 | A = OR[280] 0x00C2 (0x000184) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B) 0x00C3 (0x000186) 0x2908- f:00024 d: 264 | OR[264] = A 0x00C4 (0x000188) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x00C5 (0x00018A) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x00C6 (0x00018C) 0x2118- f:00020 d: 280 | A = OR[280] 0x00C7 (0x00018E) 0x140C- f:00012 d: 12 | A = A + 12 (0x000C) 0x00C8 (0x000190) 0x2908- f:00024 d: 264 | OR[264] = A 0x00C9 (0x000192) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x00CA (0x000194) 0x2921- f:00024 d: 289 | OR[289] = A 0x00CB (0x000196) 0x1019- f:00010 d: 25 | A = 25 (0x0019) 0x00CC (0x000198) 0x2924- f:00024 d: 292 | OR[292] = A 0x00CD (0x00019A) 0x2121- f:00020 d: 289 | A = OR[289] 0x00CE (0x00019C) 0x2925- f:00024 d: 293 | OR[293] = A 0x00CF (0x00019E) 0x1124- f:00010 d: 292 | A = 292 (0x0124) 0x00D0 (0x0001A0) 0x5800- f:00054 d: 0 | B = A 0x00D1 (0x0001A2) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x00D2 (0x0001A4) 0x7C09- f:00076 d: 9 | R = OR[9] 0x00D3 (0x0001A6) 0x2118- f:00020 d: 280 | A = OR[280] 0x00D4 (0x0001A8) 0x140C- f:00012 d: 12 | A = A + 12 (0x000C) 0x00D5 (0x0001AA) 0x2908- f:00024 d: 264 | OR[264] = A 0x00D6 (0x0001AC) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x00D7 (0x0001AE) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x00D8 (0x0001B0) 0x7481- f:00072 d: 129 | R = P + 129 (0x0159) 0x00D9 (0x0001B2) 0x2005- f:00020 d: 5 | A = OR[5] 0x00DA (0x0001B4) 0x1406- f:00012 d: 6 | A = A + 6 (0x0006) 0x00DB (0x0001B6) 0x2908- f:00024 d: 264 | OR[264] = A 0x00DC (0x0001B8) 0x211A- f:00020 d: 282 | A = OR[282] 0x00DD (0x0001BA) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x00DE (0x0001BC) 0x102A- f:00010 d: 42 | A = 42 (0x002A) 0x00DF (0x0001BE) 0x2924- f:00024 d: 292 | OR[292] = A 0x00E0 (0x0001C0) 0x1124- f:00010 d: 292 | A = 292 (0x0124) 0x00E1 (0x0001C2) 0x5800- f:00054 d: 0 | B = A 0x00E2 (0x0001C4) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x00E3 (0x0001C6) 0x7C09- f:00076 d: 9 | R = OR[9] 0x00E4 (0x0001C8) 0x2118- f:00020 d: 280 | A = OR[280] 0x00E5 (0x0001CA) 0x140A- f:00012 d: 10 | A = A + 10 (0x000A) 0x00E6 (0x0001CC) 0x2908- f:00024 d: 264 | OR[264] = A 0x00E7 (0x0001CE) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x00E8 (0x0001D0) 0x291F- f:00024 d: 287 | OR[287] = A 0x00E9 (0x0001D2) 0x2118- f:00020 d: 280 | A = OR[280] 0x00EA (0x0001D4) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B) 0x00EB (0x0001D6) 0x2908- f:00024 d: 264 | OR[264] = A 0x00EC (0x0001D8) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x00ED (0x0001DA) 0x2920- f:00024 d: 288 | OR[288] = A 0x00EE (0x0001DC) 0x211F- f:00020 d: 287 | A = OR[287] 0x00EF (0x0001DE) 0x8402- f:00102 d: 2 | P = P + 2 (0x00F1), A = 0 0x00F0 (0x0001E0) 0x7006- f:00070 d: 6 | P = P + 6 (0x00F6) 0x00F1 (0x0001E2) 0x2120- f:00020 d: 288 | A = OR[288] 0x00F2 (0x0001E4) 0x8402- f:00102 d: 2 | P = P + 2 (0x00F4), A = 0 0x00F3 (0x0001E6) 0x7003- f:00070 d: 3 | P = P + 3 (0x00F6) 0x00F4 (0x0001E8) 0x7C34- f:00076 d: 52 | R = OR[52] 0x00F5 (0x0001EA) 0x0000- f:00000 d: 0 | PASS 0x00F6 (0x0001EC) 0x1026- f:00010 d: 38 | A = 38 (0x0026) 0x00F7 (0x0001EE) 0x2924- f:00024 d: 292 | OR[292] = A 0x00F8 (0x0001F0) 0x211F- f:00020 d: 287 | A = OR[287] 0x00F9 (0x0001F2) 0x2925- f:00024 d: 293 | OR[293] = A 0x00FA (0x0001F4) 0x2120- f:00020 d: 288 | A = OR[288] 0x00FB (0x0001F6) 0x2926- f:00024 d: 294 | OR[294] = A 0x00FC (0x0001F8) 0x211B- f:00020 d: 283 | A = OR[283] 0x00FD (0x0001FA) 0x2927- f:00024 d: 295 | OR[295] = A 0x00FE (0x0001FC) 0x1800-0x0200 f:00014 d: 0 | A = 512 (0x0200) 0x0100 (0x000200) 0x2928- f:00024 d: 296 | OR[296] = A 0x0101 (0x000202) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0102 (0x000204) 0x2929- f:00024 d: 297 | OR[297] = A 0x0103 (0x000206) 0x1124- f:00010 d: 292 | A = 292 (0x0124) 0x0104 (0x000208) 0x5800- f:00054 d: 0 | B = A 0x0105 (0x00020A) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0106 (0x00020C) 0x7C09- f:00076 d: 9 | R = OR[9] 0x0107 (0x00020E) 0x2118- f:00020 d: 280 | A = OR[280] 0x0108 (0x000210) 0x140C- f:00012 d: 12 | A = A + 12 (0x000C) 0x0109 (0x000212) 0x2908- f:00024 d: 264 | OR[264] = A 0x010A (0x000214) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x010B (0x000216) 0x2921- f:00024 d: 289 | OR[289] = A 0x010C (0x000218) 0x2121- f:00020 d: 289 | A = OR[289] 0x010D (0x00021A) 0xB434- f:00132 d: 52 | R = OR[52], A = 0 0x010E (0x00021C) 0x0000- f:00000 d: 0 | PASS 0x010F (0x00021E) 0x2121- f:00020 d: 289 | A = OR[289] 0x0110 (0x000220) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001) 0x0111 (0x000222) 0x2908- f:00024 d: 264 | OR[264] = A 0x0112 (0x000224) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x0113 (0x000226) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008) 0x0114 (0x000228) 0x2922- f:00024 d: 290 | OR[290] = A 0x0115 (0x00022A) 0x211B- f:00020 d: 283 | A = OR[283] 0x0116 (0x00022C) 0x2923- f:00024 d: 291 | OR[291] = A 0x0117 (0x00022E) 0x2122- f:00020 d: 290 | A = OR[290] 0x0118 (0x000230) 0x841A- f:00102 d: 26 | P = P + 26 (0x0132), A = 0 0x0119 (0x000232) 0x2123- f:00020 d: 291 | A = OR[291] 0x011A (0x000234) 0x1402- f:00012 d: 2 | A = A + 2 (0x0002) 0x011B (0x000236) 0x2908- f:00024 d: 264 | OR[264] = A 0x011C (0x000238) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x011D (0x00023A) 0x291F- f:00024 d: 287 | OR[287] = A 0x011E (0x00023C) 0x2123- f:00020 d: 291 | A = OR[291] 0x011F (0x00023E) 0x1403- f:00012 d: 3 | A = A + 3 (0x0003) 0x0120 (0x000240) 0x2908- f:00024 d: 264 | OR[264] = A 0x0121 (0x000242) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x0122 (0x000244) 0x2920- f:00024 d: 288 | OR[288] = A 0x0123 (0x000246) 0x744E- f:00072 d: 78 | R = P + 78 (0x0171) 0x0124 (0x000248) 0x2123- f:00020 d: 291 | A = OR[291] 0x0125 (0x00024A) 0x1402- f:00012 d: 2 | A = A + 2 (0x0002) 0x0126 (0x00024C) 0x2908- f:00024 d: 264 | OR[264] = A 0x0127 (0x00024E) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0128 (0x000250) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x0129 (0x000252) 0x2123- f:00020 d: 291 | A = OR[291] 0x012A (0x000254) 0x1403- f:00012 d: 3 | A = A + 3 (0x0003) 0x012B (0x000256) 0x2908- f:00024 d: 264 | OR[264] = A 0x012C (0x000258) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x012D (0x00025A) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x012E (0x00025C) 0x1004- f:00010 d: 4 | A = 4 (0x0004) 0x012F (0x00025E) 0x2B23- f:00025 d: 291 | OR[291] = A + OR[291] 0x0130 (0x000260) 0x2F22- f:00027 d: 290 | OR[290] = OR[290] - 1 0x0131 (0x000262) 0x721A- f:00071 d: 26 | P = P - 26 (0x0117) 0x0132 (0x000264) 0x1027- f:00010 d: 39 | A = 39 (0x0027) 0x0133 (0x000266) 0x2924- f:00024 d: 292 | OR[292] = A 0x0134 (0x000268) 0x211F- f:00020 d: 287 | A = OR[287] 0x0135 (0x00026A) 0x2925- f:00024 d: 293 | OR[293] = A 0x0136 (0x00026C) 0x2120- f:00020 d: 288 | A = OR[288] 0x0137 (0x00026E) 0x2926- f:00024 d: 294 | OR[294] = A 0x0138 (0x000270) 0x211B- f:00020 d: 283 | A = OR[283] 0x0139 (0x000272) 0x2927- f:00024 d: 295 | OR[295] = A 0x013A (0x000274) 0x1800-0x0200 f:00014 d: 0 | A = 512 (0x0200) 0x013C (0x000278) 0x2928- f:00024 d: 296 | OR[296] = A 0x013D (0x00027A) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x013E (0x00027C) 0x2929- f:00024 d: 297 | OR[297] = A 0x013F (0x00027E) 0x1124- f:00010 d: 292 | A = 292 (0x0124) 0x0140 (0x000280) 0x5800- f:00054 d: 0 | B = A 0x0141 (0x000282) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0142 (0x000284) 0x7C09- f:00076 d: 9 | R = OR[9] 0x0143 (0x000286) 0x0200- f:00001 d: 0 | EXIT 0x0144 (0x000288) 0x101A- f:00010 d: 26 | A = 26 (0x001A) 0x0145 (0x00028A) 0x2924- f:00024 d: 292 | OR[292] = A 0x0146 (0x00028C) 0x111B- f:00010 d: 283 | A = 283 (0x011B) 0x0147 (0x00028E) 0x2925- f:00024 d: 293 | OR[293] = A 0x0148 (0x000290) 0x1124- f:00010 d: 292 | A = 292 (0x0124) 0x0149 (0x000292) 0x5800- f:00054 d: 0 | B = A 0x014A (0x000294) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x014B (0x000296) 0x7C09- f:00076 d: 9 | R = OR[9] 0x014C (0x000298) 0x8602- f:00103 d: 2 | P = P + 2 (0x014E), A # 0 0x014D (0x00029A) 0x700B- f:00070 d: 11 | P = P + 11 (0x0158) 0x014E (0x00029C) 0x1007- f:00010 d: 7 | A = 7 (0x0007) 0x014F (0x00029E) 0x2924- f:00024 d: 292 | OR[292] = A 0x0150 (0x0002A0) 0x1001- f:00010 d: 1 | A = 1 (0x0001) 0x0151 (0x0002A2) 0x2925- f:00024 d: 293 | OR[293] = A 0x0152 (0x0002A4) 0x1124- f:00010 d: 292 | A = 292 (0x0124) 0x0153 (0x0002A6) 0x5800- f:00054 d: 0 | B = A 0x0154 (0x0002A8) 0x1800-0x1918 f:00014 d: 0 | A = 6424 (0x1918) 0x0156 (0x0002AC) 0x7C09- f:00076 d: 9 | R = OR[9] 0x0157 (0x0002AE) 0x7213- f:00071 d: 19 | P = P - 19 (0x0144) 0x0158 (0x0002B0) 0x0200- f:00001 d: 0 | EXIT 0x0159 (0x0002B2) 0x211B- f:00020 d: 283 | A = OR[283] 0x015A (0x0002B4) 0x8602- f:00103 d: 2 | P = P + 2 (0x015C), A # 0 0x015B (0x0002B6) 0x7009- f:00070 d: 9 | P = P + 9 (0x0164) 0x015C (0x0002B8) 0x101B- f:00010 d: 27 | A = 27 (0x001B) 0x015D (0x0002BA) 0x2924- f:00024 d: 292 | OR[292] = A 0x015E (0x0002BC) 0x211B- f:00020 d: 283 | A = OR[283] 0x015F (0x0002BE) 0x2925- f:00024 d: 293 | OR[293] = A 0x0160 (0x0002C0) 0x1124- f:00010 d: 292 | A = 292 (0x0124) 0x0161 (0x0002C2) 0x5800- f:00054 d: 0 | B = A 0x0162 (0x0002C4) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0163 (0x0002C6) 0x7C09- f:00076 d: 9 | R = OR[9] 0x0164 (0x0002C8) 0x0200- f:00001 d: 0 | EXIT 0x0165 (0x0002CA) 0x211E- f:00020 d: 286 | A = OR[286] 0x0166 (0x0002CC) 0x8602- f:00103 d: 2 | P = P + 2 (0x0168), A # 0 0x0167 (0x0002CE) 0x7009- f:00070 d: 9 | P = P + 9 (0x0170) 0x0168 (0x0002D0) 0x1017- f:00010 d: 23 | A = 23 (0x0017) 0x0169 (0x0002D2) 0x2924- f:00024 d: 292 | OR[292] = A 0x016A (0x0002D4) 0x211E- f:00020 d: 286 | A = OR[286] 0x016B (0x0002D6) 0x2925- f:00024 d: 293 | OR[293] = A 0x016C (0x0002D8) 0x1124- f:00010 d: 292 | A = 292 (0x0124) 0x016D (0x0002DA) 0x5800- f:00054 d: 0 | B = A 0x016E (0x0002DC) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x016F (0x0002DE) 0x7C09- f:00076 d: 9 | R = OR[9] 0x0170 (0x0002E0) 0x0200- f:00001 d: 0 | EXIT 0x0171 (0x0002E2) 0x211F- f:00020 d: 287 | A = OR[287] 0x0172 (0x0002E4) 0x8604- f:00103 d: 4 | P = P + 4 (0x0176), A # 0 0x0173 (0x0002E6) 0x2120- f:00020 d: 288 | A = OR[288] 0x0174 (0x0002E8) 0x8602- f:00103 d: 2 | P = P + 2 (0x0176), A # 0 0x0175 (0x0002EA) 0x700D- f:00070 d: 13 | P = P + 13 (0x0182) 0x0176 (0x0002EC) 0x101E- f:00010 d: 30 | A = 30 (0x001E) 0x0177 (0x0002EE) 0x2924- f:00024 d: 292 | OR[292] = A 0x0178 (0x0002F0) 0x211F- f:00020 d: 287 | A = OR[287] 0x0179 (0x0002F2) 0x2925- f:00024 d: 293 | OR[293] = A 0x017A (0x0002F4) 0x2120- f:00020 d: 288 | A = OR[288] 0x017B (0x0002F6) 0x2926- f:00024 d: 294 | OR[294] = A 0x017C (0x0002F8) 0x1001- f:00010 d: 1 | A = 1 (0x0001) 0x017D (0x0002FA) 0x2927- f:00024 d: 295 | OR[295] = A 0x017E (0x0002FC) 0x1124- f:00010 d: 292 | A = 292 (0x0124) 0x017F (0x0002FE) 0x5800- f:00054 d: 0 | B = A 0x0180 (0x000300) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0181 (0x000302) 0x7C09- f:00076 d: 9 | R = OR[9] 0x0182 (0x000304) 0x0200- f:00001 d: 0 | EXIT 0x0183 (0x000306) 0x3118- f:00030 d: 280 | A = (OR[280]) 0x0184 (0x000308) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008) 0x0185 (0x00030A) 0x2913- f:00024 d: 275 | OR[275] = A 0x0186 (0x00030C) 0x2118- f:00020 d: 280 | A = OR[280] 0x0187 (0x00030E) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001) 0x0188 (0x000310) 0x2908- f:00024 d: 264 | OR[264] = A 0x0189 (0x000312) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x018A (0x000314) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF) 0x018B (0x000316) 0x2914- f:00024 d: 276 | OR[276] = A 0x018C (0x000318) 0x0400- f:00002 d: 0 | I = 0 0x018D (0x00031A) 0x0000- f:00000 d: 0 | PASS 0x018E (0x00031C) 0x1031- f:00010 d: 49 | A = 49 (0x0031) 0x018F (0x00031E) 0x29C3- f:00024 d: 451 | OR[451] = A 0x0190 (0x000320) 0x2113- f:00020 d: 275 | A = OR[275] 0x0191 (0x000322) 0x29C4- f:00024 d: 452 | OR[452] = A 0x0192 (0x000324) 0x2118- f:00020 d: 280 | A = OR[280] 0x0193 (0x000326) 0x29C5- f:00024 d: 453 | OR[453] = A 0x0194 (0x000328) 0x2114- f:00020 d: 276 | A = OR[276] 0x0195 (0x00032A) 0x29C6- f:00024 d: 454 | OR[454] = A 0x0196 (0x00032C) 0x2119- f:00020 d: 281 | A = OR[281] 0x0197 (0x00032E) 0x29C7- f:00024 d: 455 | OR[455] = A 0x0198 (0x000330) 0x211A- f:00020 d: 282 | A = OR[282] 0x0199 (0x000332) 0x29C8- f:00024 d: 456 | OR[456] = A 0x019A (0x000334) 0x7DC2- f:00076 d: 450 | R = OR[450] 0x019B (0x000336) 0x2119- f:00020 d: 281 | A = OR[281] 0x019C (0x000338) 0x1408- f:00012 d: 8 | A = A + 8 (0x0008) 0x019D (0x00033A) 0x2908- f:00024 d: 264 | OR[264] = A 0x019E (0x00033C) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x019F (0x00033E) 0x2913- f:00024 d: 275 | OR[275] = A 0x01A0 (0x000340) 0x2119- f:00020 d: 281 | A = OR[281] 0x01A1 (0x000342) 0x1409- f:00012 d: 9 | A = A + 9 (0x0009) 0x01A2 (0x000344) 0x2908- f:00024 d: 264 | OR[264] = A 0x01A3 (0x000346) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x01A4 (0x000348) 0x2914- f:00024 d: 276 | OR[276] = A 0x01A5 (0x00034A) 0x2119- f:00020 d: 281 | A = OR[281] 0x01A6 (0x00034C) 0x1408- f:00012 d: 8 | A = A + 8 (0x0008) 0x01A7 (0x00034E) 0x2908- f:00024 d: 264 | OR[264] = A 0x01A8 (0x000350) 0x2114- f:00020 d: 276 | A = OR[276] 0x01A9 (0x000352) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x01AA (0x000354) 0x2119- f:00020 d: 281 | A = OR[281] 0x01AB (0x000356) 0x1409- f:00012 d: 9 | A = A + 9 (0x0009) 0x01AC (0x000358) 0x2908- f:00024 d: 264 | OR[264] = A 0x01AD (0x00035A) 0x2113- f:00020 d: 275 | A = OR[275] 0x01AE (0x00035C) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x01AF (0x00035E) 0x211A- f:00020 d: 282 | A = OR[282] 0x01B0 (0x000360) 0x127F- f:00011 d: 127 | A = A & 127 (0x007F) 0x01B1 (0x000362) 0x291A- f:00024 d: 282 | OR[282] = A 0x01B2 (0x000364) 0x2119- f:00020 d: 281 | A = OR[281] 0x01B3 (0x000366) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B) 0x01B4 (0x000368) 0x2908- f:00024 d: 264 | OR[264] = A 0x01B5 (0x00036A) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x01B6 (0x00036C) 0x1A00-0xFF80 f:00015 d: 0 | A = A & 65408 (0xFF80) 0x01B8 (0x000370) 0x251A- f:00022 d: 282 | A = A + OR[282] 0x01B9 (0x000372) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x01BA (0x000374) 0x101C- f:00010 d: 28 | A = 28 (0x001C) 0x01BB (0x000376) 0x2924- f:00024 d: 292 | OR[292] = A 0x01BC (0x000378) 0x2119- f:00020 d: 281 | A = OR[281] 0x01BD (0x00037A) 0x2925- f:00024 d: 293 | OR[293] = A 0x01BE (0x00037C) 0x1124- f:00010 d: 292 | A = 292 (0x0124) 0x01BF (0x00037E) 0x5800- f:00054 d: 0 | B = A 0x01C0 (0x000380) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x01C1 (0x000382) 0x7C09- f:00076 d: 9 | R = OR[9] 0x01C2 (0x000384) 0x2006- f:00020 d: 6 | A = OR[6] 0x01C3 (0x000386) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B) 0x01C4 (0x000388) 0x2908- f:00024 d: 264 | OR[264] = A 0x01C5 (0x00038A) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x01C6 (0x00038C) 0x0200- f:00001 d: 0 | EXIT 0x01C7 (0x00038E) 0x0000- f:00000 d: 0 | PASS 0x01C8 (0x000390) 0x0000- f:00000 d: 0 | PASS 0x01C9 (0x000392) 0x0000- f:00000 d: 0 | PASS 0x01CA (0x000394) 0x0000- f:00000 d: 0 | PASS 0x01CB (0x000396) 0x0000- f:00000 d: 0 | PASS
programs/oeis/246/A246142.asm
neoneye/loda
22
17868
<reponame>neoneye/loda ; A246142: Limiting block extension of A004539 (base-2 representation of sqrt(2)) with first term as initial block. ; 1,1,1,0,0,1,1,0,1,0,0,1,1,0,1,1,0,0,1,0,1,1,0,0 mov $1,8 add $1,$0 pow $1,8 add $1,6 div $1,7 trn $1,16777222 gcd $1,3 mul $1,2 div $1,4 mov $0,$1
programs/oeis/070/A070396.asm
karttu/loda
0
240780
; A070396: a(n) = 6^n mod 23. ; 1,6,13,9,8,2,12,3,18,16,4,1,6,13,9,8,2,12,3,18,16,4,1,6,13,9,8,2,12,3,18,16,4,1,6,13,9,8,2,12,3,18,16,4,1,6,13,9,8,2,12,3,18,16,4,1,6,13,9,8,2,12,3,18,16,4,1,6,13,9,8,2,12,3,18,16,4,1,6,13,9,8,2,12,3,18,16,4,1,6,13,9,8,2,12,3,18,16,4,1,6,13,9,8,2,12,3,18,16,4,1,6,13,9,8,2,12,3,18,16,4,1,6,13,9,8,2,12,3,18,16,4,1,6,13,9,8,2,12,3,18,16,4,1,6,13,9,8,2,12,3,18,16,4,1,6,13,9,8,2,12,3,18,16,4,1,6,13,9,8,2,12,3,18,16,4,1,6,13,9,8,2,12,3,18,16,4,1,6,13,9,8,2,12,3,18,16,4,1,6,13,9,8,2,12,3,18,16,4,1,6,13,9,8,2,12,3,18,16,4,1,6,13,9,8,2,12,3,18,16,4,1,6,13,9,8,2,12,3,18,16,4,1,6,13,9,8,2,12,3 mov $1,1 mov $2,$0 lpb $2,1 mul $1,6 mod $1,23 sub $2,1 lpe
programs/oeis/016/A016935.asm
neoneye/loda
22
103031
; A016935: a(n) = (6*n + 2)^3. ; 8,512,2744,8000,17576,32768,54872,85184,125000,175616,238328,314432,405224,512000,636056,778688,941192,1124864,1331000,1560896,1815848,2097152,2406104,2744000,3112136,3511808,3944312,4410944,4913000,5451776,6028568,6644672,7301384,8000000,8741816,9528128,10360232,11239424,12167000,13144256,14172488,15252992,16387064,17576000,18821096,20123648,21484952,22906304,24389000,25934336,27543608,29218112,30959144,32768000,34645976,36594368,38614472,40707584,42875000,45118016,47437928,49836032,52313624,54872000,57512456,60236288,63044792,65939264,68921000,71991296,75151448,78402752,81746504,85184000,88716536,92345408,96071912,99897344,103823000,107850176,111980168,116214272,120553784,125000000,129554216,134217728,138991832,143877824,148877000,153990656,159220088,164566592,170031464,175616000,181321496,187149248,193100552,199176704,205379000,211708736 mul $0,6 mov $1,2 add $1,$0 pow $1,3 mov $0,$1
Transynther/x86/_processed/AVXALIGN/_ht_st_zr_/i9-9900K_12_0xca_notsx.log_45_952.asm
ljhsiun2/medusa
9
7350
<filename>Transynther/x86/_processed/AVXALIGN/_ht_st_zr_/i9-9900K_12_0xca_notsx.log_45_952.asm .global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %rax push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0x12cba, %rax nop nop sub $42710, %rbp movb (%rax), %r11b nop nop nop nop nop xor %rax, %rax lea addresses_D_ht+0xdfba, %rsi lea addresses_WT_ht+0x1e286, %rdi clflush (%rsi) nop nop nop nop nop cmp $22106, %rax mov $29, %rcx rep movsq nop nop nop nop nop and %rdi, %rdi lea addresses_D_ht+0xab3a, %rsi nop nop nop nop nop xor $47617, %r10 movb (%rsi), %al nop nop nop nop nop dec %rcx lea addresses_D_ht+0x11dba, %rsi lea addresses_WC_ht+0x42b0, %rdi nop nop nop nop nop cmp $27813, %rdx mov $33, %rcx rep movsw nop nop nop nop nop and $24709, %rcx lea addresses_WT_ht+0xd5fa, %r10 nop and %rax, %rax movb $0x61, (%r10) nop nop nop nop cmp $26903, %r11 lea addresses_A_ht+0x49ba, %rsi lea addresses_normal_ht+0x15eba, %rdi nop nop inc %rdx mov $43, %rcx rep movsb nop nop nop inc %rax lea addresses_A_ht+0x101ba, %rax clflush (%rax) nop dec %rcx movups (%rax), %xmm7 vpextrq $1, %xmm7, %r11 nop nop nop and %rcx, %rcx lea addresses_UC_ht+0x62bc, %rdi nop nop inc %rcx movb (%rdi), %dl nop nop nop nop sub $30456, %rdx lea addresses_WT_ht+0x5bba, %rsi lea addresses_WT_ht+0x4e02, %rdi nop nop nop add %r11, %r11 mov $84, %rcx rep movsb nop nop nop nop xor %rbp, %rbp lea addresses_normal_ht+0x16aea, %rdx nop xor %rsi, %rsi mov (%rdx), %bp nop and $19240, %rax lea addresses_A_ht+0xd27a, %rdi nop nop nop inc %rsi movl $0x61626364, (%rdi) nop xor %rdx, %rdx lea addresses_WT_ht+0x146fa, %rsi lea addresses_normal_ht+0x121ba, %rdi nop and %r10, %r10 mov $13, %rcx rep movsl and %rcx, %rcx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %rax pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r15 push %r8 push %rcx push %rdi push %rdx push %rsi // Load lea addresses_PSE+0xb1ba, %r13 sub $64374, %rcx mov (%r13), %r11d nop nop nop xor %rdx, %rdx // Store lea addresses_WT+0x7dba, %r13 clflush (%r13) nop nop nop nop nop inc %r15 mov $0x5152535455565758, %r11 movq %r11, (%r13) nop nop nop nop nop and %r13, %r13 // Store lea addresses_PSE+0x1f2b2, %r8 clflush (%r8) nop nop add %rdx, %rdx movb $0x51, (%r8) nop sub %r13, %r13 // REPMOV lea addresses_WT+0x1874a, %rsi lea addresses_WT+0x7dba, %rdi nop xor %r8, %r8 mov $19, %rcx rep movsq nop nop nop sub $46369, %r15 // Store mov $0x5afe1f0000000131, %rsi nop nop nop sub $5930, %r13 movw $0x5152, (%rsi) nop nop nop nop nop xor %rdi, %rdi // Faulty Load lea addresses_WT+0x7dba, %rdi nop nop nop add $63820, %rsi vmovntdqa (%rdi), %ymm2 vextracti128 $0, %ymm2, %xmm2 vpextrq $1, %xmm2, %r13 lea oracles, %r8 and $0xff, %r13 shlq $12, %r13 mov (%r8,%r13,1), %r13 pop %rsi pop %rdx pop %rdi pop %rcx pop %r8 pop %r15 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 10}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 2}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_WT'}, 'dst': {'same': True, 'congruent': 0, 'type': 'addresses_WT'}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_WT', 'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 8}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_WT_ht'}} {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 7}} {'OP': 'REPM', 'src': {'same': True, 'congruent': 9, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_WC_ht'}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 5}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_normal_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 10}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 1}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_WT_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 4}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 6}} {'OP': 'REPM', 'src': {'same': True, 'congruent': 6, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}} {'46': 5, '00': 25, '45': 14, '39': 1} 00 45 00 46 45 00 00 00 00 45 46 00 46 00 45 46 00 00 00 39 00 00 45 00 45 45 00 46 00 45 00 45 00 45 00 45 00 00 45 00 00 45 00 45 00 */
parser/EcaruleLexer.g4
abu-lang/goabu
1
4585
// this lexer grammar was obtained by slightly MODIFYING the grulev3 grammar // of the Grule Rule Engine which is released under the following license: // Copyright hyperjumptech/grule-rule-engine Authors // // 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. // source: "https://github.com/hyperjumptech/grule-rule-engine/blob/e63c3f6444865c7b76ed5c19e97dc2a4ed62810d/antlr/grulev3.g4" lexer grammar EcaruleLexer; options {tokenVocab=EcaruleLexer;} fragment A : [aA] ; fragment B : [bB] ; fragment C : [cC] ; fragment D : [dD] ; fragment E : [eE] ; fragment F : [fF] ; fragment G : [gG] ; fragment H : [hH] ; fragment I : [iI] ; fragment J : [jJ] ; fragment K : [kK] ; fragment L : [lL] ; fragment M : [mM] ; fragment N : [nN] ; fragment O : [oO] ; fragment P : [pP] ; fragment Q : [qQ] ; fragment R : [rR] ; fragment S : [sS] ; fragment T : [tT] ; fragment U : [uU] ; fragment V : [vV] ; fragment W : [wW] ; fragment X : [xX] ; fragment Y : [yY] ; fragment Z : [zZ] ; fragment ISC : 'A' .. 'Z' | 'a' .. 'z' | '\u00C0' .. '\u00D6' | '\u00D8' .. '\u00F6' | '\u00F8' .. '\u02FF' | '\u0370' .. '\u037D' | '\u037F' .. '\u1FFF' | '\u200C' .. '\u200D' | '\u2070' .. '\u218F' | '\u2C00' .. '\u2FEF' | '\u3001' .. '\uD7FF' | '\uF900' .. '\uFDCF' | '\uFDF0' .. '\uFFFD' ; fragment IC : ISC | '0' .. '9' | '_' | '\u00B7' | '\u0300' .. '\u036F' | '\u203F' .. '\u2040' ; T__0 : ',' ; PLUS : '+' ; MINUS : '-' ; DIV : '/' ; MUL : '*' ; MOD : '%' ; DOT : '.' ; SEMICOLON : ';' ; LR_BRACE : '{'; RR_BRACE : '}'; LR_BRACKET : '('; RR_BRACKET : ')'; LS_BRACKET : '['; RS_BRACKET : ']'; RULE : R U L E ; WHEN : W H E N ; THEN : T H E N ; AND : '&&' ; OR : '||' ; TRUE : T R U E ; FALSE : F A L S E ; NIL_LITERAL : N I L ; NEGATION : '!' ; SALIENCE : S A L I E N C E ; EQUALS : '==' ; ASSIGN : '=' ; PLUS_ASIGN : '+=' ; MINUS_ASIGN : '-=' ; DIV_ASIGN : '/=' ; MUL_ASIGN : '*=' ; GT : '>' ; LT : '<' ; GTE : '>=' ; LTE : '<=' ; NOTEQUALS : '!=' ; BITAND : '&'; BITOR : '|'; // START EcaruleParser UNSHARED TOKENS ON : O N ; DEFAULT : D E F A U L T ; FOR : F O R ; ALL : A L L ; DO : D O ; // END EcaruleParser UNSHARED TOKENS SIMPLENAME : ISC IC*; DQUOTA_STRING : '"' ( '\\'. | '""' | ~('"'| '\\') )* '"'; SQUOTA_STRING : '\'' ('\\'. | '\'\'' | ~('\'' | '\\'))* '\''; DECIMAL_FLOAT_LIT : DEC_LIT DOT DEC_DIGITS DECIMAL_EXPONENT? | DEC_LIT DECIMAL_EXPONENT | DOT DEC_DIGITS DECIMAL_EXPONENT? ; DECIMAL_EXPONENT : E (PLUS|MINUS)? DEC_DIGITS; HEX_FLOAT_LIT : '0' X HEX_MANTISA HEX_EXPONENT ; fragment HEX_MANTISA : HEX_DIGITS DOT HEX_DIGITS? | HEX_DIGITS | DOT HEX_DIGITS ; HEX_EXPONENT : P (PLUS|MINUS)? DEC_DIGITS ; DEC_LIT : '0' | [1-9] DEC_DIGITS? ; HEX_LIT : '0' X HEX_DIGITS; OCT_LIT : '0' OCT_DIGITS; fragment HEX_DIGITS : HEX_DIGIT+; fragment DEC_DIGITS : DEC_DIGIT+; fragment OCT_DIGITS : OCT_DIGIT+; fragment DEC_DIGIT : [0-9]; fragment OCT_DIGIT : [0-7]; fragment HEX_DIGIT : [0-9a-fA-F]; // IGNORED TOKENS SPACE : [ \t\r\n]+ -> skip; COMMENT : '/*' .*? '*/' -> skip; LINE_COMMENT : '//' ~[\r\n]* -> skip;
oeis/343/A343395.asm
neoneye/loda-programs
11
87749
<reponame>neoneye/loda-programs<gh_stars>10-100 ; A343395: a(n) = Sum_{i=1..n} gcd(n^(n-i),n-i). ; Submitted by <NAME> ; 1,2,3,5,5,12,7,13,13,26,11,39,13,36,37,33,17,74,19,69,57,68,23,103,41,82,55,97,29,226,31,81,109,130,103,207,37,140,129,193,41,324,43,177,183,164,47,281,85,266,163,213,53,340,175,287,201,210,59,621,61,220,289 sub $1,$0 seq $0,343114 ; a(n) = Sum_{i=1..n} gcd(n^i,i). add $1,$0 mov $0,$1
libsrc/target/gb/stdio/fgetc_cons.asm
Frodevan/z88dk
640
93694
<reponame>Frodevan/z88dk SECTION code_driver PUBLIC fgetc_cons PUBLIC _fgetc_cons GLOBAL __mode GLOBAL tmode_inout GLOBAL asm_getchar INCLUDE "target/gb/def/gb_globals.def" fgetc_cons: _fgetc_cons: LD A,(__mode) CP T_MODE_INOUT JR Z,getchar_1 PUSH BC CALL tmode_inout POP BC getchar_1: CALL asm_getchar LD E,A ld d,0 ld l,a ld h,d RET
.build/ada/asis-gela-elements-defs.adb
faelys/gela-asis
4
7890
------------------------------------------------------------------------------ -- Copyright (c) 2006-2013, <NAME> -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, -- this list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- * Neither the name of the Maxim Reznik, IE nor the names of its -- contributors may be used to endorse or promote products derived from -- this software without specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------ package body Asis.Gela.Elements.Defs is function Corresponding_Type_Operators (Element : Type_Definition_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List is begin return Secondary_Declaration_Lists.To_Element_List (Element.Corresponding_Type_Operators, Include_Pragmas); end Corresponding_Type_Operators; procedure Add_To_Corresponding_Type_Operators (Element : in out Type_Definition_Node; Item : in Asis.Element) is begin Secondary_Declaration_Lists.Add (Element.Corresponding_Type_Operators, Item); end Add_To_Corresponding_Type_Operators; function Definition_Kind (Element : Type_Definition_Node) return Asis.Definition_Kinds is begin return A_Type_Definition; end; function Get_Subtype_Mark (Element : Subtype_Indication_Node) return Asis.Expression is begin return Element.Subtype_Mark; end Get_Subtype_Mark; procedure Set_Subtype_Mark (Element : in out Subtype_Indication_Node; Value : in Asis.Expression) is begin Element.Subtype_Mark := Value; end Set_Subtype_Mark; function Subtype_Constraint (Element : Subtype_Indication_Node) return Asis.Constraint is begin return Element.Subtype_Constraint; end Subtype_Constraint; procedure Set_Subtype_Constraint (Element : in out Subtype_Indication_Node; Value : in Asis.Constraint) is begin Element.Subtype_Constraint := Value; end Set_Subtype_Constraint; function Has_Null_Exclusion (Element : Subtype_Indication_Node) return Boolean is begin return Element.Has_Null_Exclusion; end Has_Null_Exclusion; procedure Set_Has_Null_Exclusion (Element : in out Subtype_Indication_Node; Value : in Boolean) is begin Element.Has_Null_Exclusion := Value; end Set_Has_Null_Exclusion; function New_Subtype_Indication_Node (The_Context : ASIS.Context) return Subtype_Indication_Ptr is Result : Subtype_Indication_Ptr := new Subtype_Indication_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Subtype_Indication_Node; function Definition_Kind (Element : Subtype_Indication_Node) return Asis.Definition_Kinds is begin return A_Subtype_Indication; end; function Children (Element : access Subtype_Indication_Node) return Traverse_List is begin return ((False, Element.Subtype_Mark'Access), (False, Element.Subtype_Constraint'Access)); end Children; function Clone (Element : Subtype_Indication_Node; Parent : Asis.Element) return Asis.Element is Result : constant Subtype_Indication_Ptr := new Subtype_Indication_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; Result.Has_Null_Exclusion := Element.Has_Null_Exclusion; return Asis.Element (Result); end Clone; procedure Copy (Source : in Asis.Element; Target : access Subtype_Indication_Node; Cloner : in Cloner_Class; Parent : in Asis.Element) is begin Target.Subtype_Mark := Copy (Cloner, Get_Subtype_Mark (Source.all), Asis.Element (Target)); Target.Subtype_Constraint := Copy (Cloner, Subtype_Constraint (Source.all), Asis.Element (Target)); end Copy; function Definition_Kind (Element : Constraint_Node) return Asis.Definition_Kinds is begin return A_Constraint; end; function Component_Subtype_Indication (Element : Component_Definition_Node) return Asis.Subtype_Indication is begin return Element.Component_Subtype_Indication; end Component_Subtype_Indication; procedure Set_Component_Subtype_Indication (Element : in out Component_Definition_Node; Value : in Asis.Subtype_Indication) is begin Element.Component_Subtype_Indication := Value; end Set_Component_Subtype_Indication; function Trait_Kind (Element : Component_Definition_Node) return Asis.Trait_Kinds is begin return Element.Trait_Kind; end Trait_Kind; procedure Set_Trait_Kind (Element : in out Component_Definition_Node; Value : in Asis.Trait_Kinds) is begin Element.Trait_Kind := Value; end Set_Trait_Kind; function New_Component_Definition_Node (The_Context : ASIS.Context) return Component_Definition_Ptr is Result : Component_Definition_Ptr := new Component_Definition_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Component_Definition_Node; function Definition_Kind (Element : Component_Definition_Node) return Asis.Definition_Kinds is begin return A_Component_Definition; end; function Children (Element : access Component_Definition_Node) return Traverse_List is begin return (1 => (False, Element.Component_Subtype_Indication'Access)); end Children; function Clone (Element : Component_Definition_Node; Parent : Asis.Element) return Asis.Element is Result : constant Component_Definition_Ptr := new Component_Definition_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; Result.Trait_Kind := Element.Trait_Kind; return Asis.Element (Result); end Clone; procedure Copy (Source : in Asis.Element; Target : access Component_Definition_Node; Cloner : in Cloner_Class; Parent : in Asis.Element) is begin Target.Component_Subtype_Indication := Copy (Cloner, Component_Subtype_Indication (Source.all), Asis.Element (Target)); end Copy; function Definition_Kind (Element : Discrete_Subtype_Definition_Node) return Asis.Definition_Kinds is begin return A_Discrete_Subtype_Definition; end; function Definition_Kind (Element : Discrete_Range_Node) return Asis.Definition_Kinds is begin return A_Discrete_Range; end; function New_Unknown_Discriminant_Part_Node (The_Context : ASIS.Context) return Unknown_Discriminant_Part_Ptr is Result : Unknown_Discriminant_Part_Ptr := new Unknown_Discriminant_Part_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Unknown_Discriminant_Part_Node; function Definition_Kind (Element : Unknown_Discriminant_Part_Node) return Asis.Definition_Kinds is begin return An_Unknown_Discriminant_Part; end; function Clone (Element : Unknown_Discriminant_Part_Node; Parent : Asis.Element) return Asis.Element is Result : constant Unknown_Discriminant_Part_Ptr := new Unknown_Discriminant_Part_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; return Asis.Element (Result); end Clone; function Discriminants (Element : Known_Discriminant_Part_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List is begin return Primary_Declaration_Lists.To_Element_List (Element.Discriminants, Include_Pragmas); end Discriminants; procedure Set_Discriminants (Element : in out Known_Discriminant_Part_Node; Value : in Asis.Element) is begin Element.Discriminants := Primary_Declaration_Lists.List (Value); end Set_Discriminants; function Discriminants_List (Element : Known_Discriminant_Part_Node) return Asis.Element is begin return Asis.Element (Element.Discriminants); end Discriminants_List; function New_Known_Discriminant_Part_Node (The_Context : ASIS.Context) return Known_Discriminant_Part_Ptr is Result : Known_Discriminant_Part_Ptr := new Known_Discriminant_Part_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Known_Discriminant_Part_Node; function Definition_Kind (Element : Known_Discriminant_Part_Node) return Asis.Definition_Kinds is begin return A_Known_Discriminant_Part; end; function Children (Element : access Known_Discriminant_Part_Node) return Traverse_List is begin return (1 => (True, Asis.Element (Element.Discriminants))); end Children; function Clone (Element : Known_Discriminant_Part_Node; Parent : Asis.Element) return Asis.Element is Result : constant Known_Discriminant_Part_Ptr := new Known_Discriminant_Part_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; return Asis.Element (Result); end Clone; procedure Copy (Source : in Asis.Element; Target : access Known_Discriminant_Part_Node; Cloner : in Cloner_Class; Parent : in Asis.Element) is begin Set_Discriminants (Target.all, Primary_Declaration_Lists.Deep_Copy (Discriminants (Source.all), Cloner, Asis.Element (Target))); end Copy; function Record_Components (Element : Record_Definition_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List is begin return Primary_Declaration_Lists.To_Element_List (Element.Record_Components, Include_Pragmas); end Record_Components; procedure Set_Record_Components (Element : in out Record_Definition_Node; Value : in Asis.Element) is begin Element.Record_Components := Primary_Declaration_Lists.List (Value); end Set_Record_Components; function Record_Components_List (Element : Record_Definition_Node) return Asis.Element is begin return Asis.Element (Element.Record_Components); end Record_Components_List; function Implicit_Components (Element : Record_Definition_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List is begin return Secondary_Declaration_Lists.To_Element_List (Element.Implicit_Components, Include_Pragmas); end Implicit_Components; procedure Add_To_Implicit_Components (Element : in out Record_Definition_Node; Item : in Asis.Element) is begin Secondary_Declaration_Lists.Add (Element.Implicit_Components, Item); end Add_To_Implicit_Components; function New_Record_Definition_Node (The_Context : ASIS.Context) return Record_Definition_Ptr is Result : Record_Definition_Ptr := new Record_Definition_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Record_Definition_Node; function Definition_Kind (Element : Record_Definition_Node) return Asis.Definition_Kinds is begin return A_Record_Definition; end; function Children (Element : access Record_Definition_Node) return Traverse_List is begin return (1 => (True, Asis.Element (Element.Record_Components))); end Children; function Clone (Element : Record_Definition_Node; Parent : Asis.Element) return Asis.Element is Result : constant Record_Definition_Ptr := new Record_Definition_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; null; return Asis.Element (Result); end Clone; procedure Copy (Source : in Asis.Element; Target : access Record_Definition_Node; Cloner : in Cloner_Class; Parent : in Asis.Element) is begin Set_Record_Components (Target.all, Primary_Declaration_Lists.Deep_Copy (Record_Components (Source.all), Cloner, Asis.Element (Target))); end Copy; function New_Null_Record_Definition_Node (The_Context : ASIS.Context) return Null_Record_Definition_Ptr is Result : Null_Record_Definition_Ptr := new Null_Record_Definition_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Null_Record_Definition_Node; function Definition_Kind (Element : Null_Record_Definition_Node) return Asis.Definition_Kinds is begin return A_Null_Record_Definition; end; function Clone (Element : Null_Record_Definition_Node; Parent : Asis.Element) return Asis.Element is Result : constant Null_Record_Definition_Ptr := new Null_Record_Definition_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; return Asis.Element (Result); end Clone; function Pragmas (Element : Null_Component_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List is begin return Primary_Pragma_Lists.To_Element_List (Element.Pragmas, Include_Pragmas); end Pragmas; procedure Set_Pragmas (Element : in out Null_Component_Node; Value : in Asis.Element) is begin Element.Pragmas := Primary_Pragma_Lists.List (Value); end Set_Pragmas; function Pragmas_List (Element : Null_Component_Node) return Asis.Element is begin return Asis.Element (Element.Pragmas); end Pragmas_List; function New_Null_Component_Node (The_Context : ASIS.Context) return Null_Component_Ptr is Result : Null_Component_Ptr := new Null_Component_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Null_Component_Node; function Definition_Kind (Element : Null_Component_Node) return Asis.Definition_Kinds is begin return A_Null_Component; end; function Clone (Element : Null_Component_Node; Parent : Asis.Element) return Asis.Element is Result : constant Null_Component_Ptr := new Null_Component_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; return Asis.Element (Result); end Clone; function Discriminant_Direct_Name (Element : Variant_Part_Node) return Asis.Name is begin return Element.Discriminant_Direct_Name; end Discriminant_Direct_Name; procedure Set_Discriminant_Direct_Name (Element : in out Variant_Part_Node; Value : in Asis.Name) is begin Element.Discriminant_Direct_Name := Value; end Set_Discriminant_Direct_Name; function Variants (Element : Variant_Part_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List is begin return Primary_Variant_Lists.To_Element_List (Element.Variants, Include_Pragmas); end Variants; procedure Set_Variants (Element : in out Variant_Part_Node; Value : in Asis.Element) is begin Element.Variants := Primary_Variant_Lists.List (Value); end Set_Variants; function Variants_List (Element : Variant_Part_Node) return Asis.Element is begin return Asis.Element (Element.Variants); end Variants_List; function Pragmas (Element : Variant_Part_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List is begin return Primary_Pragma_Lists.To_Element_List (Element.Pragmas, Include_Pragmas); end Pragmas; procedure Set_Pragmas (Element : in out Variant_Part_Node; Value : in Asis.Element) is begin Element.Pragmas := Primary_Pragma_Lists.List (Value); end Set_Pragmas; function Pragmas_List (Element : Variant_Part_Node) return Asis.Element is begin return Asis.Element (Element.Pragmas); end Pragmas_List; function End_Pragmas (Element : Variant_Part_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List is begin return Primary_Pragma_Lists.To_Element_List (Element.End_Pragmas, Include_Pragmas); end End_Pragmas; procedure Set_End_Pragmas (Element : in out Variant_Part_Node; Value : in Asis.Element) is begin Element.End_Pragmas := Primary_Pragma_Lists.List (Value); end Set_End_Pragmas; function End_Pragmas_List (Element : Variant_Part_Node) return Asis.Element is begin return Asis.Element (Element.End_Pragmas); end End_Pragmas_List; function New_Variant_Part_Node (The_Context : ASIS.Context) return Variant_Part_Ptr is Result : Variant_Part_Ptr := new Variant_Part_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Variant_Part_Node; function Definition_Kind (Element : Variant_Part_Node) return Asis.Definition_Kinds is begin return A_Variant_Part; end; function Children (Element : access Variant_Part_Node) return Traverse_List is begin return ((False, Element.Discriminant_Direct_Name'Access), (True, Asis.Element (Element.Pragmas)), (True, Asis.Element (Element.Variants))); end Children; function Clone (Element : Variant_Part_Node; Parent : Asis.Element) return Asis.Element is Result : constant Variant_Part_Ptr := new Variant_Part_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; return Asis.Element (Result); end Clone; procedure Copy (Source : in Asis.Element; Target : access Variant_Part_Node; Cloner : in Cloner_Class; Parent : in Asis.Element) is begin Target.Discriminant_Direct_Name := Copy (Cloner, Discriminant_Direct_Name (Source.all), Asis.Element (Target)); Set_Pragmas (Target.all, Primary_Pragma_Lists.Deep_Copy (Pragmas (Source.all), Cloner, Asis.Element (Target))); Set_Variants (Target.all, Primary_Variant_Lists.Deep_Copy (Variants (Source.all), Cloner, Asis.Element (Target))); end Copy; function Record_Components (Element : Variant_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List is begin return Primary_Declaration_Lists.To_Element_List (Element.Record_Components, Include_Pragmas); end Record_Components; procedure Set_Record_Components (Element : in out Variant_Node; Value : in Asis.Element) is begin Element.Record_Components := Primary_Declaration_Lists.List (Value); end Set_Record_Components; function Record_Components_List (Element : Variant_Node) return Asis.Element is begin return Asis.Element (Element.Record_Components); end Record_Components_List; function Implicit_Components (Element : Variant_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List is begin return Secondary_Declaration_Lists.To_Element_List (Element.Implicit_Components, Include_Pragmas); end Implicit_Components; procedure Add_To_Implicit_Components (Element : in out Variant_Node; Item : in Asis.Element) is begin Secondary_Declaration_Lists.Add (Element.Implicit_Components, Item); end Add_To_Implicit_Components; function Variant_Choices (Element : Variant_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List is begin return Primary_Choise_Lists.To_Element_List (Element.Variant_Choices, Include_Pragmas); end Variant_Choices; procedure Set_Variant_Choices (Element : in out Variant_Node; Value : in Asis.Element) is begin Element.Variant_Choices := Primary_Choise_Lists.List (Value); end Set_Variant_Choices; function Variant_Choices_List (Element : Variant_Node) return Asis.Element is begin return Asis.Element (Element.Variant_Choices); end Variant_Choices_List; function New_Variant_Node (The_Context : ASIS.Context) return Variant_Ptr is Result : Variant_Ptr := new Variant_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Variant_Node; function Definition_Kind (Element : Variant_Node) return Asis.Definition_Kinds is begin return A_Variant; end; function Children (Element : access Variant_Node) return Traverse_List is begin return ((True, Asis.Element (Element.Variant_Choices)), (True, Asis.Element (Element.Record_Components))); end Children; function Clone (Element : Variant_Node; Parent : Asis.Element) return Asis.Element is Result : constant Variant_Ptr := new Variant_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; null; return Asis.Element (Result); end Clone; procedure Copy (Source : in Asis.Element; Target : access Variant_Node; Cloner : in Cloner_Class; Parent : in Asis.Element) is begin Set_Variant_Choices (Target.all, Primary_Choise_Lists.Deep_Copy (Variant_Choices (Source.all), Cloner, Asis.Element (Target))); Set_Record_Components (Target.all, Primary_Declaration_Lists.Deep_Copy (Record_Components (Source.all), Cloner, Asis.Element (Target))); end Copy; function New_Others_Choice_Node (The_Context : ASIS.Context) return Others_Choice_Ptr is Result : Others_Choice_Ptr := new Others_Choice_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Others_Choice_Node; function Definition_Kind (Element : Others_Choice_Node) return Asis.Definition_Kinds is begin return An_Others_Choice; end; function Clone (Element : Others_Choice_Node; Parent : Asis.Element) return Asis.Element is Result : constant Others_Choice_Ptr := new Others_Choice_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; return Asis.Element (Result); end Clone; function Has_Null_Exclusion (Element : Access_Definition_Node) return Boolean is begin return Element.Has_Null_Exclusion; end Has_Null_Exclusion; procedure Set_Has_Null_Exclusion (Element : in out Access_Definition_Node; Value : in Boolean) is begin Element.Has_Null_Exclusion := Value; end Set_Has_Null_Exclusion; function Definition_Kind (Element : Access_Definition_Node) return Asis.Definition_Kinds is begin return An_Access_Definition; end; function New_Incomplete_Type_Definition_Node (The_Context : ASIS.Context) return Incomplete_Type_Definition_Ptr is Result : Incomplete_Type_Definition_Ptr := new Incomplete_Type_Definition_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Incomplete_Type_Definition_Node; function Definition_Kind (Element : Incomplete_Type_Definition_Node) return Asis.Definition_Kinds is begin return An_Incomplete_Type_Definition; end; function Clone (Element : Incomplete_Type_Definition_Node; Parent : Asis.Element) return Asis.Element is Result : constant Incomplete_Type_Definition_Ptr := new Incomplete_Type_Definition_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; return Asis.Element (Result); end Clone; function Has_Tagged (Element : Tagged_Incomplete_Type_Definition_Node) return Boolean is begin return Element.Has_Tagged; end Has_Tagged; procedure Set_Has_Tagged (Element : in out Tagged_Incomplete_Type_Definition_Node; Value : in Boolean) is begin Element.Has_Tagged := Value; end Set_Has_Tagged; function New_Tagged_Incomplete_Type_Definition_Node (The_Context : ASIS.Context) return Tagged_Incomplete_Type_Definition_Ptr is Result : Tagged_Incomplete_Type_Definition_Ptr := new Tagged_Incomplete_Type_Definition_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Tagged_Incomplete_Type_Definition_Node; function Definition_Kind (Element : Tagged_Incomplete_Type_Definition_Node) return Asis.Definition_Kinds is begin return A_Tagged_Incomplete_Type_Definition; end; function Clone (Element : Tagged_Incomplete_Type_Definition_Node; Parent : Asis.Element) return Asis.Element is Result : constant Tagged_Incomplete_Type_Definition_Ptr := new Tagged_Incomplete_Type_Definition_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; Result.Has_Tagged := Element.Has_Tagged; return Asis.Element (Result); end Clone; function Trait_Kind (Element : Private_Type_Definition_Node) return Asis.Trait_Kinds is begin return Element.Trait_Kind; end Trait_Kind; procedure Set_Trait_Kind (Element : in out Private_Type_Definition_Node; Value : in Asis.Trait_Kinds) is begin Element.Trait_Kind := Value; end Set_Trait_Kind; function Corresponding_Type_Operators (Element : Private_Type_Definition_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List is begin return Secondary_Declaration_Lists.To_Element_List (Element.Corresponding_Type_Operators, Include_Pragmas); end Corresponding_Type_Operators; procedure Add_To_Corresponding_Type_Operators (Element : in out Private_Type_Definition_Node; Item : in Asis.Element) is begin Secondary_Declaration_Lists.Add (Element.Corresponding_Type_Operators, Item); end Add_To_Corresponding_Type_Operators; function Has_Limited (Element : Private_Type_Definition_Node) return Boolean is begin return Element.Has_Limited; end Has_Limited; procedure Set_Has_Limited (Element : in out Private_Type_Definition_Node; Value : in Boolean) is begin Element.Has_Limited := Value; end Set_Has_Limited; function Has_Private (Element : Private_Type_Definition_Node) return Boolean is begin return Element.Has_Private; end Has_Private; procedure Set_Has_Private (Element : in out Private_Type_Definition_Node; Value : in Boolean) is begin Element.Has_Private := Value; end Set_Has_Private; function New_Private_Type_Definition_Node (The_Context : ASIS.Context) return Private_Type_Definition_Ptr is Result : Private_Type_Definition_Ptr := new Private_Type_Definition_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Private_Type_Definition_Node; function Definition_Kind (Element : Private_Type_Definition_Node) return Asis.Definition_Kinds is begin return A_Private_Type_Definition; end; function Clone (Element : Private_Type_Definition_Node; Parent : Asis.Element) return Asis.Element is Result : constant Private_Type_Definition_Ptr := new Private_Type_Definition_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; Result.Trait_Kind := Element.Trait_Kind; null; Result.Has_Limited := Element.Has_Limited; Result.Has_Private := Element.Has_Private; return Asis.Element (Result); end Clone; function Has_Abstract (Element : Tagged_Private_Type_Definition_Node) return Boolean is begin return Element.Has_Abstract; end Has_Abstract; procedure Set_Has_Abstract (Element : in out Tagged_Private_Type_Definition_Node; Value : in Boolean) is begin Element.Has_Abstract := Value; end Set_Has_Abstract; function Has_Tagged (Element : Tagged_Private_Type_Definition_Node) return Boolean is begin return Element.Has_Tagged; end Has_Tagged; procedure Set_Has_Tagged (Element : in out Tagged_Private_Type_Definition_Node; Value : in Boolean) is begin Element.Has_Tagged := Value; end Set_Has_Tagged; function New_Tagged_Private_Type_Definition_Node (The_Context : ASIS.Context) return Tagged_Private_Type_Definition_Ptr is Result : Tagged_Private_Type_Definition_Ptr := new Tagged_Private_Type_Definition_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Tagged_Private_Type_Definition_Node; function Definition_Kind (Element : Tagged_Private_Type_Definition_Node) return Asis.Definition_Kinds is begin return A_Tagged_Private_Type_Definition; end; function Clone (Element : Tagged_Private_Type_Definition_Node; Parent : Asis.Element) return Asis.Element is Result : constant Tagged_Private_Type_Definition_Ptr := new Tagged_Private_Type_Definition_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; Result.Trait_Kind := Element.Trait_Kind; null; Result.Has_Limited := Element.Has_Limited; Result.Has_Private := Element.Has_Private; Result.Has_Abstract := Element.Has_Abstract; Result.Has_Tagged := Element.Has_Tagged; return Asis.Element (Result); end Clone; function Ancestor_Subtype_Indication (Element : Private_Extension_Definition_Node) return Asis.Subtype_Indication is begin return Element.Ancestor_Subtype_Indication; end Ancestor_Subtype_Indication; procedure Set_Ancestor_Subtype_Indication (Element : in out Private_Extension_Definition_Node; Value : in Asis.Subtype_Indication) is begin Element.Ancestor_Subtype_Indication := Value; end Set_Ancestor_Subtype_Indication; function Implicit_Inherited_Declarations (Element : Private_Extension_Definition_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List is begin return Secondary_Declaration_Lists.To_Element_List (Element.Implicit_Inherited_Declarations, Include_Pragmas); end Implicit_Inherited_Declarations; procedure Add_To_Implicit_Inherited_Declarations (Element : in out Private_Extension_Definition_Node; Item : in Asis.Element) is begin Secondary_Declaration_Lists.Add (Element.Implicit_Inherited_Declarations, Item); end Add_To_Implicit_Inherited_Declarations; function Implicit_Inherited_Subprograms (Element : Private_Extension_Definition_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List is begin return Secondary_Declaration_Lists.To_Element_List (Element.Implicit_Inherited_Subprograms, Include_Pragmas); end Implicit_Inherited_Subprograms; procedure Add_To_Implicit_Inherited_Subprograms (Element : in out Private_Extension_Definition_Node; Item : in Asis.Element) is begin Secondary_Declaration_Lists.Add (Element.Implicit_Inherited_Subprograms, Item); end Add_To_Implicit_Inherited_Subprograms; function Has_Synchronized (Element : Private_Extension_Definition_Node) return Boolean is begin return Element.Has_Synchronized; end Has_Synchronized; procedure Set_Has_Synchronized (Element : in out Private_Extension_Definition_Node; Value : in Boolean) is begin Element.Has_Synchronized := Value; end Set_Has_Synchronized; function Has_Abstract (Element : Private_Extension_Definition_Node) return Boolean is begin return Element.Has_Abstract; end Has_Abstract; procedure Set_Has_Abstract (Element : in out Private_Extension_Definition_Node; Value : in Boolean) is begin Element.Has_Abstract := Value; end Set_Has_Abstract; function New_Private_Extension_Definition_Node (The_Context : ASIS.Context) return Private_Extension_Definition_Ptr is Result : Private_Extension_Definition_Ptr := new Private_Extension_Definition_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Private_Extension_Definition_Node; function Definition_Kind (Element : Private_Extension_Definition_Node) return Asis.Definition_Kinds is begin return A_Private_Extension_Definition; end; function Children (Element : access Private_Extension_Definition_Node) return Traverse_List is begin return (1 => (False, Element.Ancestor_Subtype_Indication'Access)); end Children; function Clone (Element : Private_Extension_Definition_Node; Parent : Asis.Element) return Asis.Element is Result : constant Private_Extension_Definition_Ptr := new Private_Extension_Definition_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; Result.Trait_Kind := Element.Trait_Kind; null; Result.Has_Limited := Element.Has_Limited; Result.Has_Private := Element.Has_Private; null; null; Result.Has_Synchronized := Element.Has_Synchronized; Result.Has_Abstract := Element.Has_Abstract; return Asis.Element (Result); end Clone; procedure Copy (Source : in Asis.Element; Target : access Private_Extension_Definition_Node; Cloner : in Cloner_Class; Parent : in Asis.Element) is begin Target.Ancestor_Subtype_Indication := Copy (Cloner, Ancestor_Subtype_Indication (Source.all), Asis.Element (Target)); end Copy; function Is_Private_Present (Element : Protected_Definition_Node) return Boolean is begin return Element.Is_Private_Present; end Is_Private_Present; procedure Set_Is_Private_Present (Element : in out Protected_Definition_Node; Value : in Boolean) is begin Element.Is_Private_Present := Value; end Set_Is_Private_Present; function Visible_Part_Items (Element : Protected_Definition_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List is begin return Primary_Declaration_Lists.To_Element_List (Element.Visible_Part_Items, Include_Pragmas); end Visible_Part_Items; procedure Set_Visible_Part_Items (Element : in out Protected_Definition_Node; Value : in Asis.Element) is begin Element.Visible_Part_Items := Primary_Declaration_Lists.List (Value); end Set_Visible_Part_Items; function Visible_Part_Items_List (Element : Protected_Definition_Node) return Asis.Element is begin return Asis.Element (Element.Visible_Part_Items); end Visible_Part_Items_List; function Private_Part_Items (Element : Protected_Definition_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List is begin return Primary_Declaration_Lists.To_Element_List (Element.Private_Part_Items, Include_Pragmas); end Private_Part_Items; procedure Set_Private_Part_Items (Element : in out Protected_Definition_Node; Value : in Asis.Element) is begin Element.Private_Part_Items := Primary_Declaration_Lists.List (Value); end Set_Private_Part_Items; function Private_Part_Items_List (Element : Protected_Definition_Node) return Asis.Element is begin return Asis.Element (Element.Private_Part_Items); end Private_Part_Items_List; function Get_Identifier (Element : Protected_Definition_Node) return Asis.Element is begin return Element.Identifier; end Get_Identifier; procedure Set_Identifier (Element : in out Protected_Definition_Node; Value : in Asis.Element) is begin Element.Identifier := Value; end Set_Identifier; function Corresponding_Type_Operators (Element : Protected_Definition_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List is begin return Secondary_Declaration_Lists.To_Element_List (Element.Corresponding_Type_Operators, Include_Pragmas); end Corresponding_Type_Operators; procedure Add_To_Corresponding_Type_Operators (Element : in out Protected_Definition_Node; Item : in Asis.Element) is begin Secondary_Declaration_Lists.Add (Element.Corresponding_Type_Operators, Item); end Add_To_Corresponding_Type_Operators; function New_Protected_Definition_Node (The_Context : ASIS.Context) return Protected_Definition_Ptr is Result : Protected_Definition_Ptr := new Protected_Definition_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Protected_Definition_Node; function Definition_Kind (Element : Protected_Definition_Node) return Asis.Definition_Kinds is begin return A_Protected_Definition; end; function Children (Element : access Protected_Definition_Node) return Traverse_List is begin return ((True, Asis.Element (Element.Visible_Part_Items)), (True, Asis.Element (Element.Private_Part_Items))); end Children; function Clone (Element : Protected_Definition_Node; Parent : Asis.Element) return Asis.Element is Result : constant Protected_Definition_Ptr := new Protected_Definition_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; Result.Is_Private_Present := Element.Is_Private_Present; Result.Identifier := Element.Identifier; null; return Asis.Element (Result); end Clone; procedure Copy (Source : in Asis.Element; Target : access Protected_Definition_Node; Cloner : in Cloner_Class; Parent : in Asis.Element) is begin Set_Visible_Part_Items (Target.all, Primary_Declaration_Lists.Deep_Copy (Visible_Part_Items (Source.all), Cloner, Asis.Element (Target))); Set_Private_Part_Items (Target.all, Primary_Declaration_Lists.Deep_Copy (Private_Part_Items (Source.all), Cloner, Asis.Element (Target))); end Copy; function Is_Task_Definition_Present (Element : Task_Definition_Node) return Boolean is begin return Element.Is_Task_Definition_Present; end Is_Task_Definition_Present; procedure Set_Is_Task_Definition_Present (Element : in out Task_Definition_Node; Value : in Boolean) is begin Element.Is_Task_Definition_Present := Value; end Set_Is_Task_Definition_Present; function New_Task_Definition_Node (The_Context : ASIS.Context) return Task_Definition_Ptr is Result : Task_Definition_Ptr := new Task_Definition_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Task_Definition_Node; function Definition_Kind (Element : Task_Definition_Node) return Asis.Definition_Kinds is begin return A_Task_Definition; end; function Clone (Element : Task_Definition_Node; Parent : Asis.Element) return Asis.Element is Result : constant Task_Definition_Ptr := new Task_Definition_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; Result.Is_Private_Present := Element.Is_Private_Present; Result.Identifier := Element.Identifier; null; Result.Is_Task_Definition_Present := Element.Is_Task_Definition_Present; return Asis.Element (Result); end Clone; procedure Copy (Source : in Asis.Element; Target : access Task_Definition_Node; Cloner : in Cloner_Class; Parent : in Asis.Element) is begin Set_Visible_Part_Items (Target.all, Primary_Declaration_Lists.Deep_Copy (Visible_Part_Items (Source.all), Cloner, Asis.Element (Target))); Set_Private_Part_Items (Target.all, Primary_Declaration_Lists.Deep_Copy (Private_Part_Items (Source.all), Cloner, Asis.Element (Target))); end Copy; function Corresponding_Type_Operators (Element : Formal_Type_Definition_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List is begin return Secondary_Declaration_Lists.To_Element_List (Element.Corresponding_Type_Operators, Include_Pragmas); end Corresponding_Type_Operators; procedure Add_To_Corresponding_Type_Operators (Element : in out Formal_Type_Definition_Node; Item : in Asis.Element) is begin Secondary_Declaration_Lists.Add (Element.Corresponding_Type_Operators, Item); end Add_To_Corresponding_Type_Operators; function Definition_Kind (Element : Formal_Type_Definition_Node) return Asis.Definition_Kinds is begin return A_Formal_Type_Definition; end; end Asis.Gela.Elements.Defs;
programs/oeis/131/A131734.asm
neoneye/loda
22
177430
<reponame>neoneye/loda ; A131734: Hexaperiodic [0, 1, 0, 1, 0, -1]. ; 0,1,0,1,0,-1,0,1,0,1,0,-1,0,1,0,1,0,-1,0,1,0,1,0,-1,0,1,0,1,0,-1,0,1,0,1,0,-1,0,1,0,1,0,-1,0,1,0,1,0,-1,0,1,0,1,0,-1,0,1,0,1,0,-1,0,1,0,1,0,-1,0,1,0,1,0,-1,0,1,0,1,0,-1,0,1,0,1,0,-1,0,1,0,1,0,-1,0,1,0,1,0,-1,0,1,0,1 add $0,1 mod $0,6 sub $0,1 mod $0,2
alloy4fun_models/trashltl/models/5/qrseory3n7Ay39gj5.als
Kaixi26/org.alloytools.alloy
0
4643
open main pred idqrseory3n7Ay39gj5_prop6 { Trash in Trash' } pred __repair { idqrseory3n7Ay39gj5_prop6 } check __repair { idqrseory3n7Ay39gj5_prop6 <=> prop6o }
Task/Call-a-function/Ada/call-a-function-5.ada
LaudateCorpus1/RosettaCodeData
1
8605
Positional := H(A, F'Access); Named := H(Int => A, Fun => F'Access); Mixed := H(A, Fun=>F'Access);
src/main/fragment/mos6502-common/vdum1=vdum2_plus_pduc1_derefidx_vbuxx.asm
jbrandwood/kickc
2
17113
<gh_stars>1-10 lda {m2} clc adc {c1},x sta {m1} lda {m2}+1 adc {c1}+1,x sta {m1}+1 lda {m2}+2 adc {c1}+2,x sta {m1}+2 lda {m2}+3 adc {c1}+3,x sta {m1}+3
src/MessageClosureProperties.agda
peterthiemann/dual-session
1
5234
<reponame>peterthiemann/dual-session<gh_stars>1-10 {-# OPTIONS --rewriting #-} module MessageClosureProperties where open import Data.Nat using (ℕ; zero ; suc) open import Data.Fin using (Fin; zero; suc) open import Function using (_∘_) open import Relation.Binary.PropositionalEquality using (_≡_; cong; cong₂; sym; refl) open import Auxiliary.Extensionality open import Auxiliary.RewriteLemmas import Types.COI as COI import Types.IND1 as IND import Types.Tail1 as Tail import DualTail1 as DT import MessageClosure as MC open COI using (_≈_; _≈'_; _≈ᵗ_) open DT using (Stack; ε; ⟪_,_⟫) private variable n : ℕ σ σ′ : Stack n G : IND.GType n ---------------------------------------------------------------------- var=shift-var : (i : Fin (suc n)) → IND.var i ≡ MC.shift{m = n}{n = 0} IND.var i var=shift-var zero = refl var=shift-var (suc i) = refl apply-id-S : (S : IND.SType n) → MC.applyS{n = 0} IND.var S ≡ S apply-id-G : (G : IND.GType n) → MC.applyG{n = 0} IND.var G ≡ G apply-id-T : (T : IND.TType n) → MC.applyT{n = 0} IND.var T ≡ T apply-id-S (IND.gdd G) = cong IND.gdd (apply-id-G G) apply-id-S{n} (IND.rec G) rewrite sym (ext (var=shift-var{n})) = cong IND.rec (apply-id-G G) apply-id-S (IND.var x) = refl apply-id-G (IND.transmit d T S) = cong₂ (IND.transmit d) (apply-id-T T) (apply-id-S S) apply-id-G (IND.choice d m alt) = cong (IND.choice d m) (ext (apply-id-S ∘ alt)) apply-id-G IND.end = refl apply-id-T IND.TUnit = refl apply-id-T IND.TInt = refl apply-id-T (IND.TPair T T₁) = cong₂ IND.TPair (apply-id-T T) (apply-id-T T₁) apply-id-T (IND.TChan S) = cong IND.TChan (apply-id-S S) mc-equiv-S : (s : IND.SType 0) → DT.ind2coiS ε s ≈ DT.tail2coiS ε (MC.mclosureS s) mc-equiv-G : (g : IND.GType 0) → DT.ind2coiG ε g ≈' DT.tail2coiG ε (MC.mclosureG g) mc-equiv-T : (t : IND.TType 0) → DT.ind2coiT ε t ≈ᵗ DT.tail2coiT (MC.injectT (MC.applyT IND.var t)) COI.Equiv.force (mc-equiv-S (IND.gdd g)) = mc-equiv-G g COI.Equiv.force (mc-equiv-S (IND.rec G)) = {!!} -- mc-equiv-G (IND.st-substG G zero (IND.rec G)) mc-equiv-G (IND.transmit d t s) = COI.eq-transmit d (mc-equiv-T t) (mc-equiv-S s) mc-equiv-G (IND.choice d m alt) = COI.eq-choice d (mc-equiv-S ∘ alt) mc-equiv-G IND.end = COI.eq-end mc-equiv-T IND.TUnit = COI.eq-unit mc-equiv-T IND.TInt = COI.eq-int mc-equiv-T (IND.TPair t t₁) = COI.eq-pair (mc-equiv-T t) (mc-equiv-T t₁) mc-equiv-T (IND.TChan S) rewrite apply-id-S S = COI.eq-chan COI.≈-refl -- relation between two stacks (to fill above hole in mc-equiv-S) data Related : DT.Stack {IND.GType} n → Stack {Tail.GType} n → Set where base : Related {0} ε ε step : Related {n} σ σ′ → Related {suc n} ⟪ σ , G ⟫ ⟪ σ′ , MC.mcloG (MC.ext {!!} (IND.rec G)) G ⟫
examples/GetIsFollower.asm
rapito/VSCode-PowerPC-Syntax
13
174432
<gh_stars>10-100 ################################################################################ # Address: FN_GetIsFollower # 0x800055f8 from Common.s ################################################################################ ################################################################################ # Function: GetREG_IsFollower # Inject @ 800055f8 # ------------------------------------------------------------------------------ # Description: Returns whether or not the player is a follower # ------------------------------------------------------------------------------ # in # r3 = player's data # out # r3 = REG_IsFollower ################################################################################ .include "Common.s" .set REG_IsFollower, 31 .set REG_PlayerData, 30 GetREG_IsFollower: backup mr REG_PlayerData,r3 # check if the player is a follower li REG_IsFollower, 0 # initialize REG_IsFollower to false lbz r3, 0x221F(REG_PlayerData) #Check If Subchar rlwinm. r0, r3, 29, 31, 31 beq RETURN_IS_FOLLOWER #Check If Follower lbz r3,0xC(REG_PlayerData) branchl r12, PlayerBlock_LoadExternalCharID load r4,0x803bcde0 #pdLoadCommonData table mulli r0, r3, 3 #struct length add r3,r4,r0 #get characters entry lbz r0, 0x2(r3) #get subchar functionality cmpwi r0,0x0 #if not a follower, exit bne RETURN_IS_FOLLOWER li REG_IsFollower, 1 # if we get here then we know this is nana RETURN_IS_FOLLOWER: mr r3,REG_IsFollower Exit: #restore registers and sp restore blr
tests/src/assert_ast.adb
TNO/Rejuvenation-Ada
0
8690
with AUnit.Assertions; use AUnit.Assertions; with Libadalang.Analysis; use Libadalang.Analysis; with Rejuvenation.Match_Patterns; use Rejuvenation.Match_Patterns; with Rejuvenation.Simple_Factory; use Rejuvenation.Simple_Factory; package body Assert_AST is function Assert_AST (AST : String; Rule : Grammar_Rule; Message : String) return Analysis_Unit; function Assert_AST (AST : String; Rule : Grammar_Rule; Message : String) return Analysis_Unit is begin return Analyze_Fragment (AST, Rule); exception when others => Assert (Condition => False, Message => Message & ASCII.LF & "AST = " & AST & ASCII.LF & "Rule = " & Rule'Image); return No_Analysis_Unit; end Assert_AST; procedure Assert_Equal_AST (Expected_String, Actual_String : String; Rule : Grammar_Rule; Message : String) is Expected_AST : constant Analysis_Unit := Assert_AST (Expected_String, Rule, "Assert_Equal_AST - Expected_String is not an AST"); Actual_AST : constant Analysis_Unit := Assert_AST (Actual_String, Rule, "Assert_Equal_AST - Actual_String is not an AST"); MP : Match_Pattern; Match : constant Boolean := Match_Full (MP, Expected_AST.Root, Actual_AST.Root); begin Assert (Condition => Match, Message => Message & ASCII.LF & "Actual = " & Actual_String & ASCII.LF & "Expected = " & Expected_String & ASCII.LF); Assert (Condition => not MP.Get_Nodes.Is_Empty, Message => "Match so nodes expected"); end Assert_Equal_AST; end Assert_AST;
Driver/Stream/Serial/serialMain.asm
steakknife/pcgeos
504
242208
<filename>Driver/Stream/Serial/serialMain.asm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1990 -- All Rights Reserved PROJECT: PC GEOS MODULE: Serial Driver - Public Interface FILE: serial.asm AUTHOR: <NAME>, Jan 12, 1990 ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- Adam 1/12/90 Initial revision andres 12/10/96 Modified for Penelope DESCRIPTION: Code to communicate with multiple serial ports. Some notes of interest: There can be up to four serial ports on some machines, but there are only two interrupt levels allocated to the things, and most cards don't handle sharing the levels well at all (maybe because they're edge-triggered...). Some cards, however, offer other levels besides SDI_ASYNC and SDI_ASYNC_ALT, so we allow the user to specify the level in the .ini file under the [serial] category: port 1 = <num> gives the interrupt level for COM1 port 2 = <num> gives the interrupt level for COM2 port 3 = <num> gives the interrupt level for COM3 port 4 = <num> gives the interrupt level for COM4 The given interrupt level is verified, however, and the specification ignored if it is not correct. When a port is opened, its interrupt vector will be snagged by the driver, but not before then. $Id: serialMain.asm,v 1.96 98/05/05 17:49:49 cthomas Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ include serial.def include initfile.def include heap.def ; need HF_FIXED UseDriver Internal/powerDr.def if LOG_MODEM_SETTINGS include Internal/log.def endif DefStub macro realFunc Resident segment resource realFunc&Stub proc near call realFunc ret realFunc&Stub endp Resident ends endm ;------------------------------------------------------------------------------ ; MISCELLANEOUS VARIABLES ;------------------------------------------------------------------------------ idata segment if STANDARD_PC_HARDWARE if NEW_ISR primaryVec SerialVectorData <,,MiniSerialPrimaryInt,SDI_ASYNC> alternateVec SerialVectorData <,,MiniSerialAlternateInt,SDI_ASYNC_ALT> weird1Vec SerialVectorData <,,MiniWeird1Int> weird2Vec SerialVectorData <,,MiniWeird2Int> else primaryVec SerialVectorData <,,SerialPrimaryInt,SDI_ASYNC> alternateVec SerialVectorData <,,SerialAlternateInt,SDI_ASYNC_ALT> weird1Vec SerialVectorData <,,SerialWeird1Int> ; Data for first weird ; port interrupting at ; non-standard level weird2Vec SerialVectorData <,,SerialWeird2Int> ; Data for second weird ; port interrupting at ; non-standard level endif ; NEW_ISR irpc n,<12345678> ; ; Data for the active port ; com&n SerialPortData < 0,0,0, offset com&n&_Sem, offset com&n&_passive, 0, SERIAL_COM&n > com&n&_Sem Semaphore ; ; Data for the passive port ; com&n&_passive SerialPortData < 0,0,0, offset com&n&_passive_Sem, offset com&n, mask SPS_PASSIVE, SERIAL_COM&n&_PASSIVE > com&n&_passive_Sem Semaphore endm ; ; com port table of structures ; comPorts nptr.SerialPortData com1, com2, com3, com4, com5, com6, com7, com8 ; ; These are the passive representations of the serial ports, used when ; dealing with a passive (read-only, preemptible) connection. ; comPortsPassive nptr.SerialPortData com1_passive, com2_passive, com3_passive, com4_passive, com5_passive, com6_passive, com7_passive, com8_passive else ImplementMe endif ; ------------------- HARDWARE TYPE --------------------------------- idata ends udata segment ; ; Device map to return from DR_STREAM_GET_DEVICE_MAP ; deviceMap SerialDeviceMap <0,0,0,0,0,0,0,0> powerStrat fptr.far udata ends if INTERRUPT_STAT udata segment com1Stat InterruptStatStructure com2Stat InterruptStatStructure com3Stat InterruptStatStructure udata ends endif ; INTERRUPT_STAT ;------------------------------------------------------------------------------ ; Driver info table ;------------------------------------------------------------------------------ Resident segment resource DriverTable DriverInfoStruct < SerialStrategy, mask DA_CHARACTER, DRIVER_TYPE_STREAM > ForceRef DriverTable Resident ends idata segment numPorts word 0 ; No known ports... will be changed by ; SerialRealInit idata ends Resident segment resource DefFunction macro funcCode, routine if ($-serialFunctions) ne funcCode ErrMessage <routine not in proper slot for funcCode> endif .assert (TYPE routine eq NEAR) AND (SEGMENT routine eq @CurSeg), <Improper serial handler routine> nptr routine endm serialFunctions label nptr DefFunction DR_INIT, SerialInitStub DefFunction DR_EXIT, SerialExitStub DefFunction DR_SUSPEND, SerialSuspend DefFunction DR_UNSUSPEND, SerialUnsuspend DefFunction DR_STREAM_GET_DEVICE_MAP, SerialGetDeviceMap DefFunction DR_STREAM_OPEN, SerialOpenStub DefFunction DR_STREAM_CLOSE, SerialCloseStub DefFunction DR_STREAM_SET_NOTIFY, SerialSetNotify DefFunction DR_STREAM_GET_ERROR, SerialHandOff DefFunction DR_STREAM_SET_ERROR, SerialHandOff DefFunction DR_STREAM_FLUSH, SerialFlush DefFunction DR_STREAM_SET_THRESHOLD, SerialHandOff DefFunction DR_STREAM_READ, SerialRead DefFunction DR_STREAM_READ_BYTE, SerialReadByte DefFunction DR_STREAM_WRITE, SerialWrite DefFunction DR_STREAM_WRITE_BYTE, SerialWriteByte DefFunction DR_STREAM_QUERY, SerialHandOff DefFunction DR_SERIAL_SET_FORMAT, SerialSetFormat DefFunction DR_SERIAL_GET_FORMAT, SerialGetFormat DefFunction DR_SERIAL_SET_MODEM, SerialSetModem DefFunction DR_SERIAL_GET_MODEM, SerialGetModem DefFunction DR_SERIAL_OPEN_FOR_DRIVER, SerialOpenStub DefFunction DR_SERIAL_SET_FLOW_CONTROL, SerialSetFlowControl DefFunction DR_SERIAL_DEFINE_PORT, SerialDefinePortStub DefFunction DR_SERIAL_STAT_PORT, SerialStatPort DefFunction DR_SERIAL_CLOSE_WITHOUT_RESET, SerialCloseWithoutResetStub DefFunction DR_SERIAL_REESTABLISH_STATE, SerialReestablishState DefFunction DR_SERIAL_PORT_ABSENT, SerialPortAbsent DefFunction DR_SERIAL_GET_PASSIVE_STATE, SerialGetPassiveState DefFunction DR_SERIAL_GET_MEDIUM, SerialGetMedium DefFunction DR_SERIAL_SET_MEDIUM, SerialSetMedium DefFunction DR_SERIAL_SET_BUFFER_SIZE, SerialSetBufferSizeStub DefFunction DR_SERIAL_ENABLE_FLOW_CONTROL, SerialEnableFlowControl DefFunction DR_SERIAL_SET_ROLE, SerialSetRole COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialStrategy %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Entry point for all serial-driver functions CALLED BY: GLOBAL PASS: di = routine number bx = open port number (usually) RETURN: depends on function, but an ever-present possibility is carry set with AX = STREAM_CLOSING DESTROYED: PSEUDO CODE/STRATEGY: There are three classes of functions in this interface: - those that open a port - those that work on an open port - those that don't require a port to be open Each open port has a reference count that must be incremented for #2 functions on entry and decremented on exit. KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 1/14/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ;serialData sptr dgroup SerialStrategy proc far uses es, ds .enter push bx EC < cmp di, SerialFunction > EC < ERROR_AE INVALID_FUNCTION > segmov es, ds ; In case segment passed in DS push bx mov bx, handle dgroup call MemDerefDS pop bx ; mov ds, cs:serialData cmp di, DR_STREAM_OPEN jb openNotNeeded je openCall cmp di, DR_SERIAL_OPEN_FOR_DRIVER je openCall cmp di, DR_SERIAL_DEFINE_PORT je definePort cmp di, DR_SERIAL_STAT_PORT je openNotNeeded cmp di, DR_SERIAL_SET_MEDIUM ja mustBeOpen cmp di, DR_SERIAL_GET_PASSIVE_STATE jae openNotNeeded ;(get_passive_state, ;get_medium, and set_medium may ;all be done with the port open ;or closed) mustBeOpen: ; ; Point at port data if already open -- most things will ; need it. ; call SerialGetPortData ; bx <- port data offset ; ; Up the reference count if the port is open. Fail if it's closed. ; call SysEnterCritical IsPortOpen bx jg portNotOpen inc ds:[bx].SPD_refCount call SysExitCritical ; ; Call the function. ; push ds, bx call cs:serialFunctions[di] pop ds, bx decRefCount: ; ; Port open/call complete. Reduce the reference count and clean up the ; streams/V the openSem if the count is now 0. Again the check & cleanup ; must be atomic. The port state should have been reestablished, and ; any control returned to the passive open, in SerialClose ; pushf call SysEnterCritical EC < tst ds:[bx].SPD_refCount > EC < ERROR_Z REF_COUNT_UNDERFLOW > dec ds:[bx].SPD_refCount jz cleanUpStreams popf exitCriticalAndExit: call SysExitCritical exit: pop bx .leave ret openCall: ; ; Open the port and reduce the reference count (initialized to 2) if ; the open succeeds. ; call SerialOpen jnc decRefCount ; ; If opened passive port preempted, we still need to drop the refcount ; cmp ax, STREAM_ACTIVE_IN_USE stc je decRefCount jmp exit openNotNeeded: ; ; Port doesn't need to be open, so don't bother with the reference ; count or open semaphore. ; call cs:serialFunctions[di] jmp exit portNotOpen: ; ; ERROR: Port is not open. return with carry set and an error enum ; mov ax, STREAM_CLOSED ; signal error type stc jmp exitCriticalAndExit definePort: ; ; Defining a new port. No reference count shme, but we have to ; return a different BX than we were passed, so we have to handle ; this specially. ; call cs:serialFunctions[di] inc sp ; return the BX we got back inc sp push bx jmp exit cleanUpStreams: ; ; Ref count down to 0. Finish destroying the two streams and release ; the port. ; push cx, dx, ax clr cx xchg ds:[bx].SPD_inStream, cx clr dx xchg ds:[bx].SPD_outStream, dx mov bx, ds:[bx].SPD_openSem VSem ds, [bx], TRASH_AX_BX ; ; Exit critical section before attempting to free up the streams. ; call SysExitCritical ; ; Free the input stream. ; mov bx, cx tst bx jz inStreamGone call StreamFree inStreamGone: ; ; Then the output stream. ; mov bx, dx tst bx jz cleanUpDone call StreamFree cleanUpDone: ; ; Boogie with appropriate error code & flag from call. ; pop cx, dx, ax popf jmp exit SerialStrategy endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialGetPortData %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Return the offset for the active or passive SerialPortData associated with a passed SerialPortNum. CALLED BY: Internal PASS: bx - SerialPortNum ds - serialData segment RETURN: bx - offset to either the active or passive SerialPortData as indicated by the passed SerialPortNum. DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jeremy 4/ 8/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialGetPortDataFAR proc far .enter call SerialGetPortData .leave ret SerialGetPortDataFAR endp SerialGetPortData proc near uses si .enter EC < push ax, bx > EC < and bx, (not SERIAL_PASSIVE) > EC < test bx, 1 > EC < ERROR_NZ INVALID_PORT_NUMBER > EC < cmp bx, SERIAL_COM8 > EC < ERROR_A INVALID_PORT_NUMBER > ;EC < mov ax, cs:serialData > EC < push es > EC < mov bx, handle dgroup > EC < call MemDerefES > EC < mov ax, es > EC < pop es > EC < mov bx, ds > EC < cmp ax, bx > EC < ERROR_NE DS_NOT_POINTING_TO_SERIAL_DATA > EC < pop ax, bx > mov si, offset comPorts test bx, SERIAL_PASSIVE jz loadOffset ; jump if active port ; ; The requested port has the passive flag set. Clear the ; flag, and the offset will be appropriate for indexing into ; the comPortsPassive table. ; mov si, offset comPortsPassive and bx, (not SERIAL_PASSIVE) loadOffset: mov bx, ds:[si][bx] .leave ret SerialGetPortData endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialInitStub %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Front-end for DR_INIT function. Just calls to SerialInit, which is movable. CALLED BY: DR_INIT (SerialStrategy) PASS: ds = dgroup RETURN: Carry clear if we're happy DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 1/14/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialInitStub proc near .enter CallMod SerialInit .leave ret SerialInitStub endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialExitStub %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle driver exit. CALLED BY: DR_EXIT (SerialStrategy) PASS: Nothing RETURN: Carry clear if we're happy, which we generally are... DESTROYED: PSEUDO CODE/STRATEGY: Nothing to do on exit, in contrast to init, so we don't. KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 1/14/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialExitStub proc near .enter CallMod SerialExit .leave ret SerialExitStub endp Resident ends OpenClose segment resource if INTERRUPT_STAT COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialResetStatVar %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Clear all variables in stat CALLED BY: SerialOpen PASS: ds:si = SerialPortData for the port that was open just now RETURN: nothing DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 4/29/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialResetStatVar proc near uses ax, di, es .enter segmov es, ds, ax clr ax mov di, offset com1Stat cmp si, offset com1 je doclr mov di, offset com2Stat cmp si, offset com2 je doclr mov di, offset com3Stat cmp si, offset com3 je doclr jmp exit doclr: mov cx, size InterruptStatStructure rep stosw exit: .leave ret SerialResetStatVar endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialWriteOutStat %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Write out contents of stat variables to Ini file CALLED BY: SerialClose PASS: ds:si = SerialPortData of the port just closed RETURN: nothing DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 4/29/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ com1Str char "com1",0 com2Str char "com2",0 com3Str char "com3",0 SerialWriteOutStat proc near uses ds,es,di,si .enter segmov es, ds, di segmov ds, cs, di cmp si, offset com1 jne ne1 mov di, offset com1Stat mov si, offset com1Str jmp doWrite ne1: cmp si, offset com2 jne ne2 mov di, offset com2Stat mov si, offset com2Str jmp doWrite ne2: cmp si, offset com3 jne ne3 mov di, offset com3Stat mov si, offset com3Str jmp doWrite ne3: jmp done doWrite: call WriteOutStat done: .leave ret SerialWriteOutStat endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% WriteOutStat %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Write out stat CALLED BY: SerialWriteOutStat PASS: es:di = one of com1Stat/com2Stat/com3Stat ds:si = pointer to correct category string: com1Str/com2Str/etc RETURN: nothing DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 4/29/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ interruptCountStr char "interruptCount",0 errorCountStr char "errorCount",0 xmitIntCountStr char "xmitIntCount",0 recvIntCountStr char "recvIntCount",0 fifoTimeoutStr char "fifoTimeout", 0 modemStatusCountStr char "modemStatusCount", 0 noActionCountStr char "noActionCount",0 bogusIntCountStr char "bogusIntCount",0 overrunCountStr char "overrunCount",0 bufferFullCountStr char "bufferFullCount",0 WriteOutStat proc near uses cx,dx,bp .enter mov cx, cs mov bp, es:[di].ISS_interruptCount mov dx, offset interruptCountStr call InitFileWriteInteger mov bp, es:[di].ISS_errorCount mov dx, offset errorCountStr call InitFileWriteInteger mov bp, es:[di].ISS_xmitIntCount mov dx, offset xmitIntCountStr call InitFileWriteInteger mov bp, es:[di].ISS_recvIntCount mov dx, offset recvIntCountStr call InitFileWriteInteger mov bp, es:[di].ISS_fifoTimeout mov dx, offset fifoTimeoutStr call InitFileWriteInteger mov bp, es:[di].ISS_modemStatusCount mov dx, offset modemStatusCountStr call InitFileWriteInteger mov bp, es:[di].ISS_noActionCount mov dx, offset noActionCountStr call InitFileWriteInteger mov bp, es:[di].ISS_bogusIntCount mov dx, offset bogusIntCountStr call InitFileWriteInteger mov bp, es:[di].ISS_overrunCount mov dx, offset overrunCountStr call InitFileWriteInteger mov bp, es:[di].ISS_bufferFullCount mov dx, offset bufferFullCountStr call InitFileWriteInteger .leave ret WriteOutStat endp endif ; INTERRUPT_STAT COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialFindVector %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Find the interrupt vector for a port. CALLED BY: SerialInitPort, SerialClose PASS: ds:si = SerialPortData for the port RETURN: cx = device interrupt level ds:di = SerialVectorData to use carry set if no interrupt vector allocated to the port DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 1/15/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialFindVector proc near .enter clr cx mov cl, ds:[si].SPD_irq ; cx <- interrupt level cmp cl, -1 je noInts ; -1 means can't interrupt ; ; Check known interrupt levels first ; mov di, offset primaryVec if STANDARD_PC_HARDWARE cmp cl, SDI_ASYNC ; Primary vector? je haveVec mov di, offset alternateVec cmp cl, SDI_ASYNC_ALT ; Alternate vector? je haveVec ; ; Not a known level, so see if one of the weird interrupt ; vector slots is available for use (or is already bound ; to this level). ; mov di, offset weird1Vec cmp ds:[di].SVD_irq, cl je haveVec tst ds:[di].SVD_port ; Weird1 taken? jz setVec mov di, offset weird2Vec cmp ds:[di].SVD_irq, cl je haveVec tst ds:[di].SVD_port ; Weird2 taken? jz setVec endif ; STANDARD_PC_HARDWARE noInts: stc ; Signal no vector available haveVec: .leave ret if STANDARD_PC_HARDWARE setVec: mov ds:[di].SVD_irq, cl ; Claim this vector ; for our own. jmp haveVec endif SerialFindVector endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialInitVector %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Snag an interrupt vector. Unmasks the interrupt and makes sure any pending interrupt for the level has been acknowledged (this last is for init code, but can be useful...) CALLED BY: SerialCheckPort, SerialInitPort PASS: di = SerialVectorData in dgroup for vector to be caught ds:si = SerialPortData for port on whose behalf the vector is being caught. bx = segment of handling routine ds = es RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: turn off interrupts fetch interrupt level from data and vector it to the proper handler figure the interrupt mask for the level fetch the current mask from the proper controller save the state of the mask bit for this level enable the interrupt in the controller send a specific end-of-interrupt command to the controller in charge for this level. KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/13/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialInitVector proc far uses ax, dx, bx, cx, es .enter INT_OFF tst ds:[di].SVD_port jnz done ; non-zero => already intercepted ; ; Catch the interrupt vector ; push bx mov bx, handle dgroup call MemDerefES pop bx ; segmov es, dgroup, ax clr ax mov al, ds:[di].SVD_irq mov cx, ds:[di].SVD_handler push di call SysCatchDeviceInterrupt pop di mov cl, ds:[di].SVD_irq ; ; Figure which controller to change ; mov dx, IC1_MASKPORT cmp cl, 8 jl 10$ sub cl, 8 if STANDARD_PC_HARDWARE ; ; Deliver specific EOI for chained-controller level to the ; first controller while we're here... ; mov al, IC_SPECEOI or 2 out IC1_CMDPORT, al endif mov dx, IC2_MASKPORT 10$: ; ; Fetch the current mask and mask out the bit for this interrupt ; level, saving it away in SVD_mask for restoration by ; SerialResetVector. ; mov ah, 1 shl ah, cl in al, dx and ah, al mov ds:[di].SVD_mask, ah ; ; Invert the result and mask the current interrupt-mask with it ; If the bit for the level was already 0, this won't change ; anything (only 1 bit was set in ah originally). If the bit ; was 1, however, this will clear it. ; not ah and al, ah out dx, al ; ; Send a specific EOI for the level to the affected controller. ; if STANDARD_PC_HARDWARE mov al, IC_SPECEOI or al, cl CheckHack <IC1_CMDPORT - IC1_MASKPORT eq -1> dec dx endif ; STANDARD_PC_HARDWARE out dx, al done: ; ; Add this port to the list of ports for the interrupt vector. ; mov ax, ds:[di].SVD_port mov ds:[si].SPD_next, ax mov ds:[di].SVD_port, si if NEW_ISR ; ; initialize interrupt handler table to be non-flow control version, ; as this is the faster of the two ( see FcHandlerTbl in ; serialHighSpeed.asm ) ; mov ds:[si].SPD_handlers, offset QuickHandlerTbl endif INT_ON .leave ret SerialInitVector endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialResetVector %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Reset an interrupt vector to its previous contents, re-masking the affected interrupt if it was masked before SerialInitVector was called. CALLED BY: SerialCheckPort, SerialClose PASS: di = SerialVectorData in dgroup si = SerialPortData offset of the port to unhook ds = dgroup RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/13/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialResetVector proc far uses ax, dx, bx, es .enter INT_OFF ; ; Remove the port from the list for this vector ; mov bx, handle dgroup call MemDerefES ; segmov es, dgroup, ax lea ax, ds:[di].SVD_port-SPD_next portLoop: mov bx, ax mov ax, ds:[bx].SPD_next EC < tst ax > EC < ERROR_Z VECTOR_PORT_LIST_CORRUPTED > cmp ax, si jne portLoop mov ax, ds:[si].SPD_next mov ds:[bx].SPD_next, ax ; ; If any ports are still using this interrupt vector, leave it alone ; tst ds:[di].SVD_port jnz stillInUse ; ; Reset the mask bit to its original state, then put back the original ; vector. ; mov dx, IC1_MASKPORT mov al, ds:[di].SVD_irq cmp al, 8 jl 10$ mov dx, IC2_MASKPORT 10$: in al, dx or al, ds:[di].SVD_mask out dx, al clr ax mov al, ds:[di].SVD_irq call SysResetDeviceInterrupt stillInUse: INT_ON .leave ret SerialResetVector endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialFetchPortStatePC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: fetch the port state for a PC-like port CALLED BY: SerialFetchPortState PASS: ds:si = SerialPortData ds:di = SerialPortState to fill RETURN: Void. DESTROYED: ax, dx PSEUDOCODE/STRATEGY: KNOWN BUGS/SIDEFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jimmy 5/ 4/93 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialFetchPortStatePC proc near .enter mov dx, ds:[si].SPD_base add dx, offset SP_lineCtrl in al, dx ; fetch line format first ; so we can mess with SF_DLAB mov ds:[di].SPS_format, al mov ah, al ornf al, mask SF_DLAB out dx, al ; go for the current baud rate jmp $+2 ; I/O delay sub dx, offset SP_lineCtrl in al, dx ; low byte mov ds:[di].SPS_baud.low, al inc dx in al, dx ; high byte mov ds:[di].SPS_baud.high, al mov al, ah add dx, offset SP_lineCtrl - offset SP_divHigh out dx, al ; reset line format jmp $+2 ; I/O delay inc dx ; dx <- SP_modemCtrl in al, dx mov ds:[di].SPS_modem, al add dx, offset SP_ien - offset SP_modemCtrl in al, dx mov ds:[di].SPS_ien, al .leave ret SerialFetchPortStatePC endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialFetchPortState %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Store the current state of the port in the port data for later restoration. CALLED BY: SerialInitPort, SerialCloseWithoutReset PASS: ds:si = SerialPortData for the port RETURN: nothing DESTROYED: ax PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 11/ 8/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialFetchPortState proc near uses dx, es, di, bx, cx .enter INT_OFF lea di, ds:[si].SPD_initState if STANDARD_PC_HARDWARE call SerialFetchPortStatePC endif ; STANDARD_PC_HARDWARE INT_ON ; ; Make sure we know the interrupt level at which the port is operating. ; cmp ds:[si].SPD_irq, -1 clc jne done if STANDARD_PC_HARDWARE mov bx, ds:[si].SPD_portNum ; ; Now try and figure the interrupt level for the port. ; call SerialCheckPort jnc portFound ; jump if found ; ; Not found, so clear the bit from our device map and return an error. ; mov cx, bx and cx, (not SERIAL_PASSIVE) ; nuke passive bit mov ax, not 1 rol ax, cl andnf ds:[deviceMap], ax mov ax, STREAM_NO_DEVICE stc endif ; STANDARD_PC_HARDWARE jmp done portFound: ; ; Copy the interrupt level and base to the passive port's data ; structure if we're opening an active port or to the ; active port if we're opening a passive port. ; mov ax, si ; save original pointer mov cl, ds:[si].SPD_irq mov dx, ds:[si].SPD_base mov si, ds:[si].SPD_otherPortData mov ds:[si].SPD_base, dx mov ds:[si].SPD_irq, cl mov si, ax ; recover original pointer done: .leave ret SerialFetchPortState endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialInitHWPC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: init a PC-like serial port CALLED BY: SerialInitPort PASS: ds:si = SerialPortData cx = buffer size RETURN: Void. DESTROYED: ax, dx PSEUDOCODE/STRATEGY: KNOWN BUGS/SIDEFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jimmy 5/ 3/93 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialInitHWPC proc near .enter mov dx, ds:[si].SPD_base add dx, offset SP_status ; Clear pending in al, dx ; error irq jmp $+2 add dx, offset SP_data-offset SP_status ; Clear pending in al, dx ; data avail ; irq jmp $+2 add dx, offset SP_iid - offset SP_data ; Clear pending in al, dx ; transmit irq jmp $+2 add dx, offset SP_modemStatus-offset SP_iid ;Clear pending in al, dx ; modem status jmp $+2 ; irq ; ; See if the port supports FIFOs. ; add dx, offset SP_iid - offset SP_modemStatus mov al, mask SFC_ENABLE or mask SFC_XMIT_RESET or \ mask SFC_RECV_RESET or \ (FIFO_RECV_THRESHOLD_SFS shl offset SFC_SIZE) out dx, al jmp $+2 in al, dx test al, mask SIID_FIFO_MODE jz raiseSignals jpo cantUseFIFO ; (see note there) ; ; 1/13/98 See if the input buffer is small. If so, don't use ; FIFO anyway. If this port is for a mouse, use of a FIFO ; produces jerky movement as the FIFO needs to time out before ; responding. We assume that a small buffer (<= 16 bytes) is ; for a serial mouse. -- eca cmp cx, 16 ; small buffer? jbe cantUseFIFO ; branch if so ; ; It does. Remember that we turned them on so we turn them off again ; when we're done. ; ornf ds:[si].SPD_flags, mask SPF_FIFO raiseSignals: ; ; Raise DTR and RTS on the port since it's open. Most things like to ; have them asserted (e.g. modems) and I doubt if things would get ; upset, so just do it here to save further calls by the user. ; mov al, mask SMC_OUT2 or mask SMC_DTR or mask SMC_RTS adjustModemControl:: add dx, offset SP_modemCtrl - offset SP_iid out dx, al mov ds:[si].SPD_curState.SPS_modem, al ; ; 4/28/94: wait 3 clock ticks here to allow things to react to ; having DTR asserted. In particular, this is here to allow a ; serial -> parallel converter manufactured by GDT Softworks to ; power up -- ardeb mov ax, 3 call TimerSleep ; ; Now enable interrupts for the port. Only enable the DATA_AVAIL and ; LINE_ERR interrupts until (1) we get data to transmit or (2) the user ; expresses an interest in modem status changes. ; add dx, offset SP_ien - offset SP_modemCtrl mov al, mask SIEN_DATA_AVAIL or mask SIEN_LINE_ERR mov ds:[si].SPD_ien, al out dx, al .leave ret cantUseFIFO: ; ; The original 16550 part had asynchronous (read: random) failures ; when operated in FIFO mode. On the 16550, the SIID_FIFO_MODE field ; is 2 when FIFOs are enabled, while on the (working) 16550A, the field ; is 3. Thus if the field is non-zero but the parity is odd, we've got ; a 16550 and must turn the FIFOs back off again. ; clr al out dx, al jmp raiseSignals SerialInitHWPC endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialInitPort %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Initialize things for a newly opened port CALLED BY: SerialOpen PASS: bx = owner handle ds:si = SerialPortData for the port cx = input buffer size dx = output buffer size RETURN: carry set if port couldn't be initialized (ax = reason) DESTROYED: ax, cx, dx, di, bx PSEUDO CODE/STRATEGY: Create a stream for the port Set up routine notifier for ourselves Set notification threshold to 1 Grab interrupt vector and enable interrupts for port's interrupt level. Force the printer on-line and turn off auto-feed, since we do mostly graphics printing around here. KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 1/15/90 Initial version jdashe 4/27/94 Added passive port support %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialInitPort proc near .enter push cx ; save size for init push bx ; save handle for second stream ; creation ; ; Notify the power management driver ; push cx mov cx, 1 ; indicate open call NotifyPowerDriver pop cx mov ax, STREAM_POWER_ERROR LONG jc openFailedPopOwner ; ; If on PCMCIA card, make sure the thing actually exists. ; cmp ds:[si].SPD_socket, -1 je getState mov ax, ds:[si].SPD_base call SerialCheckExists mov ax, STREAM_NO_DEVICE LONG jc openFailedPopOwner getState: ; ; Fetch the initial state of the port and squirrel it away for close. ; ; This was already done for preempted passive ports. ; test ds:[si].SPD_passive, mask SPS_PREEMPTED jnz bumpInputBuffer ; jump if passive call SerialFetchPortState LONG jc openFailedPopOwner ; ; Replicate initial state as port's current state, for use when ; re-establishing the port's state at some later date. ; push si, es, di, cx segmov es, ds lea di, ds:[si].SPD_curState lea si, ds:[si].SPD_initState mov cx, size SPD_curState rep movsb pop si, es, di, cx ; ; If this is a passive port, we need to bump the input buffer size ; by one so we hold as many bytes as the caller requires, and still ; easily check if the buffer has become full. ; test ds:[si].SPD_passive, mask SPS_PASSIVE jz 5$ ; jump if not passive bumpInputBuffer: EC < call ECSerialVerifyPassive > inc cx EC < jmp ECjump > 5$: EC < call ECSerialVerifyActive > EC < ECjump: > ; ; Create the input stream of the specified size (first as ; DR_STREAM_CREATE biffs CX, also want bx = output stream ; for later calls) after setting the high- and low-water marks ; based on the size. ; call SerialInitInput jc openFailedCreatingFirstStream ; ; Now the output stream. ; ; If this is a passive connection, skip creating the output ; stream, since a passive connections are read-only. ; mov_tr ax, dx pop bx ; bx <- owner call SerialInitOutput jc openFailedFreeIn call SerialFindVector EC < ERROR_C SERIAL_PORT_CANT_INTERRUPT_AND_I_DONT_KNOW_WHY > ; ; Intercept the device's interrupt vector, unless this ; is a preempted passive port. ; xchg ax, cx ; (1-byte inst) mov ds:[si].SPD_vector, di ; Record vector pop cx ; cx <- input buffer size test ds:[si].SPD_passive, mask SPS_PREEMPTED jnz afterInit ; jump if preempted mov bx, segment Resident call SerialInitVector ; ; Disable all interrupts from the chip so we can make sure ; all bogus existing conditions (like pending DATA_AVAIL or ; TRANSMIT interrupts) are gone. ; call SerialInitHWPC afterInit: clc ; We're happy done: .leave ret openFailedPopOwner: openFailedCreatingFirstStream: pop bx ;Restore "owner" pop cx ;restore size jmp openFailed openFailedFreeIn: pop cx ;restore size ; ; Open failed b/c we couldn't allocate the output stream. Need ; to biff the input stream. ; push ax ; Save error code mov bx, ds:[si].SPD_inStream mov di, DR_STREAM_DESTROY mov ax, STREAM_DISCARD call StreamStrategy pop ax openFailed: ; ; Open failed, but don't want to leave the port locked, in case ; resources get freed up later. ; push bx mov bx, ds:[si].SPD_openSem VSem ds, [bx] pop bx clr cx ; make sure power management call NotifyPowerDriver ; driver knows the thing's not ; actually open stc jmp done SerialInitPort endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialInitInput %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Create and initialize the input stream for the port. CALLED BY: (INTERNAL) SerialInitPort PASS: cx = buffer size ds:si = SerialPortData bx = handle to own the stream RETURN: carry set if couldn't create DESTROYED: ax, cx, bp, di, bx SIDE EFFECTS: SPD_inStream set PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 8/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialInitInput proc near uses dx .enter ; ; Set the flow-control stuff and other input-related stuff first. ; - SPD_lowWater is set to 1/4 the size of the input buffer ; - SPD_highWater is set to 3/4 the size of the input buffer ; - SPD_byteMask is set to 0x7f (cooked) ; - SPD_mode is set to enable software flow control on both input ; and output ; mov ax, cx ; ax <- buffer size shr cx ; Divide total size by 4 shr cx ; to give low-water mark for mov ds:[si].SPD_lowWater,cx ; the port. mov ds:[si].SPD_highWater,ax; Turn off flow-control if ; buffer too small (by setting ; high-water mark to the size ; of the buffer) neg cx add cx, ax ; cx <- bufsize - bufsize/4 jle 10$ mov ds:[si].SPD_highWater,cx; cx > 0, so set as high water 10$: mov ds:[si].SPD_byteMask, 0x7f mov ds:[si].SPD_mode, mask SF_INPUT or mask SF_OUTPUT or \ mask SF_SOFTWARE ; ; Now create the input stream. ; push ax ; save buffer size mov cx, mask HF_FIXED mov di, DR_STREAM_CREATE call StreamStrategy ; bx = stream token ; ; Set the threshold for when the input stream drains below ; the lowWater mark. We only register the notifier if we ; send an XOFF. ; pop cx ; cx <- buffer size jc done mov ds:[si].SPD_inStream, bx sub cx, ds:[si].SPD_lowWater mov ax, STREAM_WRITE mov di, DR_STREAM_SET_THRESHOLD call StreamStrategy ; ; Initialize the data notifier on the writing side of the ; input stream so we can just change the type to SNM_ROUTINE ; in SerialInt when we want to cause an XON to be sent. ; mov ax, StreamNotifyType <0,SNE_DATA,SNM_NONE> mov bp, si ; Pass SerialPortData offset to us if NEW_ISR mov dx, offset ResumeIncomingData mov cx, segment ResumeIncomingData else mov dx, offset SerialRestart mov cx, segment SerialRestart endif mov di, DR_STREAM_SET_NOTIFY call StreamStrategy clc done: .leave ret SerialInitInput endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialInitOutput %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Create the output stream for the port. If there's an open passive version of the port, preempt it. CALLED BY: (INTERNAL) SerialInitPort PASS: ds:si = SerialPortData ax = buffer size bx = geode to own the stream RETURN: carry set if couldn't create DESTROYED: ax, bx, cx, dx, di, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 8/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialInitOutput proc near .enter ; ; If port is passive, we don't have to do any of this ; test ds:[si].SPD_passive, mask SPS_PASSIVE EC < jz noPassiveCheck > EC < call ECSerialVerifyPassive > EC < jmp doneOK > EC < noPassiveCheck: > jnz done ; (carry cleared by test) ; ; Create the stream. ; EC < call ECSerialVerifyActive > mov cx, mask HF_FIXED mov di, DR_STREAM_CREATE call StreamStrategy jc done mov ds:[si].SPD_outStream, bx ; ; Set up a routine notifier to call us when we stick data in ; the output stream. This may seem strange, after all we're the one who ; caused the data to go there, but it seems somehow cleaner to ; me to do it this way... ; mov ax, StreamNotifyType <1,SNE_DATA,SNM_ROUTINE> mov bp, si ; Pass SerialPortData offset to us mov dx, offset SerialNotify mov cx, segment SerialNotify mov di, DR_STREAM_SET_NOTIFY call StreamStrategy ; ; We need to know if even one byte goes in... ; 8/21/95: set the threshold to 0, not 1, so we get a general ; routine notification (not a special), but still get called ; whenever something is there. This causes an initial ; notification to happen (b/c there are the indicated number ; of bytes currently in the stream [0]), but SerialNotify is ; aware of this -- ardeb ; mov ax, STREAM_READ mov cx, 0 mov di, DR_STREAM_SET_THRESHOLD call StreamStrategy ; ; If there is a passive connection in progress, preempt it ; with a call to SerialResetVector and copy any data in the ; passive buffer to the just-created active input buffer. ; mov di, ds:[si].SPD_otherPortData IsPortOpen di ; passive port in use? jg doneOK ; jump if no passive connection call SerialCopyPassiveData doneOK: clc done: .leave ret SerialInitOutput endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialCopyPassiveData %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Copy data out of passive port, now the output stream has been successfully created. CALLED BY: (INTERNAL) SerialInitOutput PASS: ds:si = SerialPortData for active ds:di = SerialPortData for passive RETURN: nothing DESTROYED: ax, bx, cx, di SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 8/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialCopyPassiveData proc near uses ds, si .enter mov_tr ax, si ; ax <- active port data mov si, di ; pass passive port data in si mov di, ds:[di].SPD_vector ; di <- passive vector call SerialResetVector ; ; copy data from the passive buffer to the active. (note that we can't ; use SD_reader.SSD_sem, as that gets adjusted by reads...) ; mov di, si ; di <- passive port data mov_tr si, ax ; si <- active port data mov bx, ds:[si].SPD_inStream; bx <- active input stream mov ds, ds:[di].SPD_inStream; ds <- passive input stream mov si, offset SD_data ; ds:si <- source for copy mov cx, ds:[SD_writer].SSD_ptr; cx <- number of bytes in sub cx, si ; the passive buffer jz done ; jump if nothing to copy mov ax, STREAM_NOBLOCK ; we want as much as possible mov di, DR_STREAM_WRITE call StreamStrategy ; Ignore results... ; ; Clear out the passive port's data buffer. ; mov bx, ds ; bx <- passive input stream mov di, DR_STREAM_FLUSH call StreamStrategy ; ; Reset the passive port's input stream pointer to the head of the ; buffer. Must change both reader and writer pointers because ; they must be equal when the stream is empty!! ; mov ds:SD_writer.SSD_ptr, offset SD_data mov ds:SD_reader.SSD_ptr, offset SD_data done: .leave ret SerialCopyPassiveData endp OpenClose ends Resident segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialBufferPowerChange %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: The transmit interrupt has changed, so let the power driver know, if this port is a standard serial port (i.e. not PCMCIA) CALLED BY: (EXTERNAL) SerialReestablishState, SerialEnableTransmit, PASS: ds:si = SerialPortData RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/22/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialBufferPowerChange proc near .enter cmp ds:[si].SPD_socket, -1 jne done ; => is PCMCIA push cx mov cx, 1 call NotifyPowerDriver pop cx done: .leave ret SerialBufferPowerChange endp COMMENT @---------------------------------------------------------------------- FUNCTION: NotifyPowerDriver DESCRIPTION: Notify the power management driver that a serial port has opened or closed CALLED BY: INTERNAL PASS: cx = non-zero for open, zero for close ds:si = SerialPortData for the port RETURN: none DESTROYED: cx REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 2/16/92 Initial version ------------------------------------------------------------------------------@ NotifyPowerDriver proc far uses ax, bx, dx, di .enter ; ; If port is in a PCMCIA socket, specify that device instead. ; cmp ds:[si].SPD_socket, -1 je passSerialInfo mov ax, PDT_PCMCIA_SOCKET mov bx, ds:[si].SPD_socket mov dx, mask PCMCIAPI_NO_POWER_OFF ; do not allow power-off while ; this device is open ; ; If this is a passive connection, then allow power-off after all. ; If possible, have the machine wake up if there is data coming in from ; the PCMCIA port. ; test ds:[si].SPD_passive, mask SPS_PASSIVE jz notifyDriver ; ; Passive it is. ; mov dx, mask PCMCIAPI_WAKE_UP_ON_INTERRUPT jmp notifyDriver passSerialInfo: ; ; Convert SerialPortNum into a 0-based index, with the SERIAL_PASSIVE ; bit still set in the high bit, if necessary. ; mov bx, ds:[si].SPD_portNum sar bx, 1 ; (duplicates SERIAL_PASSIVE) andnf bx, not (SERIAL_PASSIVE shr 1) ; clear duplicate SERIAL_PASSIVE ; in bit 14, please mov ax, PDT_SERIAL_PORT clr dx mov dl, ds:[si].SPD_ioMode ornf dx, mask SPI_CONTROLS test ds:[si].SPD_ien, mask SIEN_DATA_AVAIL jz checkXmit ornf dx, mask SPI_RECEIVE checkXmit: test ds:[si].SPD_ien, mask SIEN_TRANSMIT jz notifyDriver ornf dx, mask SPI_TRANSMIT .assert $ eq notifyDriver notifyDriver: mov di, DR_POWER_DEVICE_ON_OFF call SerialCallPowerDriver .leave ret NotifyPowerDriver endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialCallPowerDriver %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: make a call into the power driver CALLED BY: (EXTERNAL) NotifyPowerDriver, SerialCheckExists (zoomer only) PASS: di = call to make ax,bx = args to power driver ds = dgroup RETURN: Void. DESTROYED: di? PSEUDOCODE/STRATEGY: KNOWN BUGS/SIDEFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jimmy 5/20/93 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialCallPowerDriver proc far .enter ; ; Get the strategy routine once, if there's a power driver in the ; system. ; push ax, bx mov ax, ds:[powerStrat].segment inc ax jz noDriver ; => was -1, so power driver sought ; before and not found dec ax jnz haveStrategy ; => was neither -1 nor 0, so have ; strategy already mov ds:[powerStrat].segment, -1 ; assume no power driver mov ax, GDDT_POWER_MANAGEMENT call GeodeGetDefaultDriver tst ax jz noDriver mov_tr bx, ax ; bx <- driver push ds, si call GeodeInfoDriver movdw axbx, ds:[si].DIS_strategy pop ds, si movdw ds:[powerStrat], axbx haveStrategy: pop ax, bx call ds:[powerStrat] done: .leave ret noDriver: pop ax, bx jmp done SerialCallPowerDriver endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialResetPortPC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: reset a PC-like serial port CALLED BY: SerialResetPort PASS: ds:si = SerialPortData ds:bx = SerialPortState RETURN: Void. DESTROYED: ax, dx PSEUDOCODE/STRATEGY: KNOWN BUGS/SIDEFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jimmy 5/ 3/93 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ; this is a useful little macro to check for bogus interrupt requests coming ; in for my com3. Since we can now handle those, it's if'ed out, but I might ; need it again some day... note that it relies on an out 0xa0, 0xa having ; been done, to set the PIC to returning the IRR chkirr macro if 0 local q mov cx, 2000 q: in al, 0xa0 test al, 2 loope q ERROR_NZ -1 endif endm SerialResetPortPC proc far .enter chkirr mov dx, ds:[si].SPD_base ; ; This is the action that can cause a spurious interrupt when ; the chip is degated from the bus by our resetting OUT2, so ; we do it first to give the system time to generate its spurious ; interrupt while we've still got control of the vector... ; add dx, offset SP_modemCtrl ; first reset OUT2 et al mov al, ds:[bx].SPS_modem out dx, al chkirr ; now, the enabled interrupts add dx, offset SP_ien - offset SP_modemCtrl mov al, ds:[bx].SPS_ien out dx, al chkirr add dx, offset SP_lineCtrl - offset SP_ien mov al, ds:[bx].SPS_format mov ah, al ornf al, mask SF_DLAB out dx, al ; reset baud-rate now chkirr jmp $+2 mov al, ds:[bx].SPS_baud.low add dx, offset SP_divLow - offset SP_lineCtrl out dx, al chkirr inc dx mov al, ds:[bx].SPS_baud.high out dx, al chkirr jmp $+2 mov al, ah ; now the line format add dx, offset SP_lineCtrl - offset SP_divHigh out dx, al chkirr ; ; Mess with the FIFO state. If we're resetting the port to its ; initial state, turn off FIFOs if no passive open remains. If we're ; reestablishing the port's state (i.e. bx is SPD_curState), we ; turn them back on again. ; test ds:[si].SPD_flags, mask SPF_FIFO jz done ; => FIFO not enabled add dx, offset SP_iid - offset SP_lineCtrl lea ax, ds:[si].SPD_curState cmp bx, ax je turnFIFOsBackOn test ds:[si].SPD_passive, mask SPS_PASSIVE jnz resetFIFO ; => closing passive, so do reset push si mov si, ds:[si].SPD_otherPortData IsPortOpen si pop si jng done ; => passive still open, so leave alone resetFIFO: clr al setFIFO: out dx, al done: .leave ret turnFIFOsBackOn: mov al, mask SFC_ENABLE or mask SFC_XMIT_RESET or \ mask SFC_RECV_RESET or \ (FIFO_RECV_THRESHOLD_SFS shl offset SFC_SIZE) jmp setFIFO SerialResetPortPC endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialReestablishState %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Reprogram the port to match the state most-recently set for it, to cope with power having been lost, for example. (Must be Resident for PCMCIA support) CALLED BY: DR_SERIAL_REESTABLISH_STATE PASS: ds:bx = SerialPortData for the port RETURN: nothing DESTROYED: ax, bx, di SIDE EFFECTS: PSEUDO CODE/STRATEGY: We alter the state a bit by turning the transmitter interrupt on so any aborted outputs will actually get started up automatically. If there's nothing in the output stream, this just causes an extra interrupt, but does no harm. REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 9/13/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialReestablishState proc near uses si .enter andnf ds:[bx].SPD_flags, not mask SPF_PORT_GONE mov si, bx lea bx, ds:[si].SPD_curState ornf ds:[bx].SPS_ien, mask SIEN_TRANSMIT ; ; Make sure the transmit buffers are enabled for the nonce. ; call SerialBufferPowerChange call SerialResetPortPC .leave ret SerialReestablishState endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialPortAbsent %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Note that a port is temporarily AWOL CALLED BY: DR_SERIAL_PORT_ABSENT PASS: ds:bx = SerialPortData for the port RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 10/ 7/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialPortAbsent proc near .enter ornf ds:[bx].SPD_flags, mask SPF_PORT_GONE .leave ret SerialPortAbsent endp Resident ends OpenClose segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialResetPort %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Reset a port to its initial state, as saved in its SerialPortData descriptor. CALLED BY: SerialEnsureClosed, SerialClose PASS: ds:si = SerialPortData RETURN: nothing DESTROYED: dx, ax PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 9/29/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialResetPort proc near uses cx, bx .enter ; ; Tell the power management driver that we are done with the port ; push cx clr cx call NotifyPowerDriver pop cx ; ; Use the reset routines to restore the port to its initial state. ; INT_OFF if 0 ; for chkirr macro... mov al, 10 out 0xa0, al endif lea bx, ds:[si].SPD_initState call SerialResetPortPC INT_ON .leave ret SerialResetPort endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialOpen %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Open one of the serial ports CALLED BY: DR_STREAM_OPEN, DR_SERIAL_OPEN_FOR_DRIVER (SerialStrategy) PASS: ax = StreamOpenFlags record. SOF_NOBLOCK and SOF_TIMEOUT are exclusive. bx = port number to open cx = total size of input buffer dx = total size of output buffer bp = timeout value if SOF_TIMEOUT given in ax ds = dgroup si = owner handle, if DR_STREAM_OPEN_FOR_DRIVER RETURN: carry set if port couldn't be opened: ax = STREAM_NO_DEVICE if device doesn't exist STREAM_DEVICE_IN_USE if SOF_NOBLOCK or SOF_TIMEOUT given and device is already open/ timeout period expired. carry set and ax = STREAM_ACTIVE_IN_USE if a passive port was opened in a PREEMPTED state. carry clear if port opened ds:bx = SerialPortData for port DESTROYED: cx, dx, bp, bx (preserved by SerialStrategy) See KNOWN BUGS below. PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: By default, though, flow control is turned off. In order to do flow control at driver level, you need to call DR_SERIAL_SET_FLOW_CONTROL, DR_SERIAL_ENABLE_FLOW_CONTROL, and DR_SERIAL_SET_ROLE( for H/W fc ). BUG: It is a bug that cx, dx and bp are destroyed, since they should be preserved according to DR_STREAM_OPEN and DR_SERIAL_OPEN_FOR_DRIVER. But since this bug already exists in shipped products, we decide to keep the bug and document it here instead of fixing it. REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 1/14/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DefStub SerialOpen SerialOpen proc far uses si, di .enter call SerialGetPortDataFAR ; ds:bx <- SerialPortData xchg si, bx tst ds:[si].SPD_base jz portExistethNot ; ; Open passive ports elsewhere. ; test ds:[si].SPD_passive, mask SPS_PASSIVE jz openActive call SerialPassiveOpen jmp exit openActive: EC < test ax, not StreamOpenFlags > EC < ERROR_NZ OPEN_BAD_FLAGS > EC < test ax, mask SOF_NOBLOCK or mask SOF_TIMEOUT > EC < jz 10$ ; neither is ok > EC < jpo 10$ ; just one is fine > EC < ERROR OPEN_BAD_FLAGS > EC <10$: > test ax, mask SOF_NOBLOCK or mask SOF_TIMEOUT jnz noBlockOpenPort push bx mov bx, ds:[si].SPD_openSem PSem ds, [bx] ; Wait for port to be available pop bx afterPortOpen: ; ; Set the reference count to 2: one for the thing being open (will ; be reduced in SerialClose) and one for this call (in case someone ; closes the thing while we're opening it, or something ludicrous ; like that) ; mov ds:[si].SPD_refCount, 2 ; ; This port is free for an active connection. Do we have a ; passive connection which we can preempt? ; mov si, ds:[si].SPD_otherPortData ; si <- passive port IsPortOpen si ; passive connection? jg continueOpening ; jump if no passive ; ; There is a passive connection in progress. Preempt the ; passive connection then continue with the usual connection ; procedure. When we have an input stream, we'll copy the ; data from the passive connection's input stream. ; call SerialPreemptPassive continueOpening: mov si, ds:[si].SPD_otherPortData ; si <- active port cmp di, DR_SERIAL_OPEN_FOR_DRIVER je 15$ ; => bx already contains owner call GeodeGetProcessHandle ; Stream owned by opener 15$: call SerialInitPort exit: mov bx, si ; ds:bx <- SerialPortData, in ; case successful open ; ; interrupt stat ; ds:si - SerialPortData ; IS < pushf > IS < call SerialResetStatVar > IS < popf > .leave ret portExistethNot: mov ax, STREAM_NO_DEVICE stc jmp exit noBlockOpenPort: ; ; Perform a non-blocking PSem on the openSem for a port. We ; also come here if just have a timeout option -- in the case ; of a non-blocking one, we just have a timeout value of 0... ; test ax, mask SOF_TIMEOUT jnz 20$ clr bp 20$: push bx mov bx, ds:[si].SPD_openSem PTimedSem ds, [bx], bp pop bx jnc afterPortOpen mov ax, STREAM_DEVICE_IN_USE jmp exit SerialOpen endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialPassiveOpen %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Attempts to open passive serial port connections ala SerialOpen. It's identical in intent to SerialOpen, but the arguments and actions are slightly different: * There are no StreamOpenFlags; passive opens are always SOF_NOBLOCK. * There is no output buffer in passive port connections. CALLED BY: SerialOpen PASS: ds:si = SerialPortData for this port cx = input buffer size bx = owner handle, if DR_STREAM_OPEN_FOR_DRIVER RETURN: carry set and ax set to one of the following: ax = STREAM_NO_DEVICE if device doesn't exist = STREAM_DEVICE_IN_USE if the passive port is in use. = STREAM_ACTIVE_IN_USE if the passive port was opened in a PREEMPTED state. carry clear if the port opened with no problems. DESTROYED: cx, dx, bp, bx (preserved by SerialStrategy or SerialOpen) REVISION HISTORY: Name Date Description ---- ---- ----------- jdashe 5/25/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialPassiveOpen proc near uses si, di .enter EC < call ECSerialVerifyPassive > tst ds:[si].SPD_base LONG jz portExistethNot ; ; If there is already a passive connection in progress, the ; open fails. ; push bx mov bx, ds:[si].SPD_openSem PTimedSem ds, [bx], 0 pop bx jc deviceInUse ; ; Set the reference count to 2: one for the thing being open (will ; be reduced in SerialClose) and one for this call (in case someone ; closes the thing while we're opening it, or something ludicrous ; like that) ; mov ds:[si].SPD_refCount, 2 ; ; The port exists. Initialize its status flags. ; andnf ds:[si].SPD_passive, not (mask SPS_BUFFER_FULL or mask SPS_PREEMPTED) ; ; If there is not an active connection in progress, open the port ; normally. Otherwise, set up the passive connection as a ; preempted port. ; mov si, ds:[si].SPD_otherPortData ; si <- active port IsPortOpen si mov si, ds:[si].SPD_otherPortData ; si <- passive port jg afterPortOpen ornf ds:[si].SPD_passive, mask SPS_PREEMPTED afterPortOpen: ; ; Open the port (or set things up if the port is preempted). ; cmp di, DR_SERIAL_OPEN_FOR_DRIVER je 15$ ; => bx already contains owner call GeodeGetProcessHandle ; Stream owned by opener 15$: call SerialInitPort jc exit ; ; If this port is opening preempted, copy the current state of ; the active port into the passive port's current and initial state. ; test ds:[si].SPD_passive, mask SPS_PREEMPTED jz doneOK ; jump if not opening preempted push es, si segmov es, ds, cx mov di, ds:[si].SPD_otherPortData ; di <- active port add di, SPD_initState add si, SPD_initState xchg di, si ; ; di - passive port's SPD_initState ; si - active port's SPD_initState ; mov cx, size SerialPortState call SysEnterCritical rep movsb call SysExitCritical ; ; Copy the same data for the passive's curState. ; mov cx, size SerialPortState sub di, cx mov si, di ; si <- passive's initState sub di, cx ; di <- passive's curState CheckHack < SPD_curState eq (SPD_initState - size SerialPortState) > rep movsb pop es, si mov ax, STREAM_ACTIVE_IN_USE openFailed: stc jmp exit doneOK: clc exit: .leave ret portExistethNot: mov ax, STREAM_NO_DEVICE jmp openFailed deviceInUse: mov ax, STREAM_DEVICE_IN_USE jmp openFailed SerialPassiveOpen endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialPreemptPassive %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This function deals with preempting a passive connection with an active one. CALLED BY: SerialOpen PASS: ds:si = SerialPortData for the passive port to be preempted RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: * Notify the passive owner that the connection is being preempted. KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jeremy 5/16/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialPreemptPassive proc near uses cx .enter EC < test ds:[si].SPD_passive, mask SPS_PASSIVE > EC < ERROR_Z NOT_A_PASSIVE_PORT > EC < call ECSerialVerifyPassive > ; ; Set the preempted flag. ; or ds:[si].SPD_passive, mask SPS_PREEMPTED mov cx, mask SPNS_PREEMPTED or mask SPNS_PREEMPTED_CHANGED call SerialPassiveNotify .leave ret SerialPreemptPassive endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialClose %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Close an open serial port. CALLED BY: DR_STREAM_CLOSE (SerialStrategy) PASS: ds:bx = SerialPortData for the port ax = STREAM_LINGER if should wait for pending data to be read before closing. STREAM_DISCARD if can just throw it away. NOTE: passive ports don't have output buffers, so ax is ignored. RETURN: nothing DESTROYED: ax, bx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 1/15/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DefStub SerialClose SerialClose proc far uses si, di, cx, dx .enter mov si, bx ; ; serial Stat ; ds:si = current SerialPortData ; IS < call SerialWriteOutStat > test ds:[si].SPD_passive, mask SPS_PASSIVE jz notPassive CheckHack <STREAM_DISCARD eq 0> clr ax EC < call ECSerialVerifyPassive > EC < jmp axOK > notPassive: EC < call ECSerialVerifyActive > EC < cmp ax, STREAM_LINGER > EC < je axOK > EC < cmp ax, STREAM_DISCARD > EC < ERROR_NE AX_NOT_STREAM_LINGER_OR_STREAM_DISCARD > EC <axOK: > mov cx, ax ; ; Turn off all but transmit interrupts for the port first. ; CheckHack <STREAM_LINGER eq -1 AND STREAM_DISCARD eq 0> andnf al, ds:[si].SPD_ien ; If discarding, this will ; result in al==0, disabling ; *all* interrupts, which ; will prevent us using a ; dead stream in the interrupt ; routine. If lingering, this ; will just give us SPD_ien andnf al, mask SIEN_MODEM or mask SIEN_TRANSMIT jcxz dontWorryAboutSTOPBit test ds:[si].SPD_mode, mask SF_SOFTSTOP jz dontWorryAboutSTOPBit ; ; If output is currently stopped and we're lingering, we must ; continue to get DATA_AVAIL interrupts so we can get the XON ; character that turns output back on again... ; mov ah, mask SIEN_DATA_AVAIL dontWorryAboutSTOPBit: mov dx, ds:[si].SPD_base add dx, offset SP_ien or al, ah ; or in correct DATA_AVAIL bit ; ; If this is a preempted passive port, no touchie the ; hardware, please. ; test ds:[si].SPD_passive, mask SPS_PREEMPTED EC < jz biffHardware > EC < pushf > EC < call ECSerialVerifyPassive ; sets ZF > EC < popf > EC <biffHardware: > jnz nukeInputStream ; jump if preempted out dx, al nukeInputStream: ; ; Shut down the input stream first, discarding any remaining ; data. The thing will be freed by SerialStrategy when the ; ref count goes to 0. ; mov bx, ds:[si].SPD_inStream mov ax, STREAM_DISCARD call StreamShutdown ; ; If this is a passive buffer, we don't have an output stream. ; test ds:[si].SPD_passive, mask SPS_PASSIVE jnz outStreamGone ; ; Now biff the output stream, passing whatever linger/discard ; constant we were given. ; mov ax, cx mov bx, ds:[si].SPD_outStream call StreamShutdown outStreamGone: ; ; If this is a preempted port, we are not intercepting ; interrupts, nor do we need to reset the port. We do need to ; update the active port's initState with the passive's, ; however, so when the active closes down it will reset the ; port to its original state. ; test ds:[si].SPD_passive, mask SPS_PREEMPTED jz nukeInterrupts EC < call ECSerialVerifyPassive > push es, cx, di, si segmov es, ds, cx mov di, ds:[si].SPD_otherPortData add di, SPD_initState add si, SPD_initState mov cx, size SerialPortState call SysEnterCritical rep movsb call SysExitCritical pop es, cx, di, si jmp vPort nukeInterrupts: ; ; Turn off all interrupts for the port, now the streams are gone. ; mov dx, ds:[si].SPD_base add dx, offset SP_ien clr al out dx, al ; ; Reset the modem-event notifier. ; mov ds:[si].SPD_modemEvent.SN_type, SNM_NONE ; ; Restore the initial state of the port before resetting the vector,, ; as tri-stating the IRQ line can have the nasty side-effect of ; allowing the interrupt line to float, thereby triggering a spurious ; interrupt. Since our interrupt code deals with not having any ; streams to use, it's safe to let it handle any spurious interrupts ; this resetting can generate. ; call SerialResetPort ; ; Reset the appropriate interrupt vector to its earlier condition. ; mov di, ds:[si].SPD_vector call SerialResetVector ; ; We're ready to V the semaphore if this is a passive port. ; test ds:[si].SPD_passive, mask SPS_PASSIVE jnz vPort ; ; We're closing down an active port. Is there a passive port ; that needs to be reawakened? ; mov di, ds:[si].SPD_otherPortData ; ds:di <- passive port IsPortOpen di jg vPort ; jump if no passive connection ; ; There is indeed a passive open that needs dealing with. ; Redo the passive's SerialInitVector and send a notification ; to the passive owner that it's back in business. ; xchg si, di ; ds:si <- passive port andnf ds:[si].SPD_passive, not (mask SPS_PREEMPTED) ; ; Intercept the device's interrupt vector. ; mov di, ds:[si].SPD_vector ; Record vector mov bx, segment Resident call SerialInitVector mov cx, 0xffff ; cx <- large size call SerialInitHWPC ; ; Notify the owner of the passive port that the passive port ; is back in action. ; mov cx, mask SPNS_PREEMPTED_CHANGED call SerialPassiveNotify ; ; In case there's a pending active port, V the closing active ; port's semaphore. ; mov si, ds:[si].SPD_otherPortData vPort: ; ; We used to V the openSem here, but now we do it in SerialStrategy ; when the refCount goes to 0. ; dec ds:[si].SPD_refCount EC < ERROR_Z REF_COUNT_UNDERFLOW > .leave ret SerialClose endp OpenClose ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialCloseWithoutReset %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Close down an open port without resetting it to its initial condition. Useful for PCAO, mostly. CALLED BY: DR_SERIAL_CLOSE_WITHOUT_RESET PASS: ds:bx = SerialPortData for the port ax = STREAM_LINGER if should wait for pending data to be read before closing. STREAM_DISCARD if can just throw it away. RETURN: port interrupts are off, but all other attributes of the port remain untouched (except it's closed from our perspective). DESTROYED: ax, bx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 11/ 8/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DefStub SerialCloseWithoutReset OpenClose segment SerialCloseWithoutReset proc far uses si, es, cx .enter ; ; Just store the current state of the port as its initial state, so ; SerialResetPort won't do anything to it. ; lea si, ds:[bx].SPD_curState lea di, ds:[bx].SPD_initState mov cx, size SPD_initState segmov es, ds rep movsb mov si, bx ; ; Do not leave any interrupts on when we've closed the thing. This ; prevents us from dying horribly should a byte come in after we've ; closed but before the system has been shut down. ; mov ds:[si].SPD_initState.SPS_ien, 0 ; ; And close the port normally. ; call SerialClose .leave ret SerialCloseWithoutReset endp OpenClose ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialSetNotify %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set a notifier for the caller. If SNT_EVENT is SNE_ERROR, SNT_READER must be set, as errors are posted only to the reading side of the stream. If SNT_EVENT is SNE_PASSIVE, SNT_READER must be set and the unit number must be for a passive port. If the passive port has a full buffer or has been preempted, a notification will be sent out immediately. CALLED BY: DR_STREAM_SET_NOTIFY PASS: ax = StreamNotifyType bx = unit number (transformed to SerialPortData offset by SerialStrategy). cx:dx = address of handling routine, if SNM_ROUTINE; destination of output if SNM_MESSAGE bp = AX to pass if SNM_ROUTINE (except for SNE_DATA with threshold of 1, in which case value is passed in CX); method to send if SNM_MESSAGE. RETURN: nothing DESTROYED: ax, bx (saved by SerialStrategy) PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 6/90 Initial version jdashe 5/13/90 Added support for passive notifications %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment resource SerialSetNotify proc near uses si, dx .enter ; ; See if the event in question is ours ; mov si, ax andnf si, mask SNT_EVENT cmp si, SNE_MODEM shl offset SNT_EVENT je setupModemEvent ; jump if a modem event cmp si, SNE_PASSIVE shl offset SNT_EVENT jne handOff ; Nope -- hand off to stream driver ; ; We're setting a passive notification, so make sure it's a ; passive port. Also make sure it's being set for the reader. ; EC < test ds:[bx].SPD_passive, mask SPS_PASSIVE > EC < ERROR_Z NOT_A_PASSIVE_PORT > EC < test ax, mask SNT_READER > EC < ERROR_Z BAD_CONTEXT_FOR_PASSIVE_PORT > EC < xchg bx, si > EC < call ECSerialVerifyPassive > EC < xchg bx, si > ; ; Store the parameters in our very own SPD_passiveEvent structure. ; lea si, ds:[bx].SPD_passiveEvent call SerialSetNotificationEvent ; ax <- SNT_HOW only ; ; If there are any pending notifications for this passive ; port, send them off now. ; test ds:[bx].SPD_passive, (mask SPS_PREEMPTED or \ mask SPS_BUFFER_FULL) jz doneOK tst ax ; clearing the notification? jz doneOK ; jump if clearing. push cx clr cx test ds:[bx].SPD_passive, mask SPS_PREEMPTED jz detectBufferFull mov cx, mask SPNS_PREEMPTED or mask SPNS_PREEMPTED_CHANGED detectBufferFull: test ds:[bx].SPD_passive, mask SPS_BUFFER_FULL jz sendNotify ornf cx, (mask SPNS_BUFFER_FULL or \ mask SPNS_BUFFER_FULL_CHANGED) sendNotify: xchg bx, si ; ds:si <- port data call SerialPassiveNotify xchg bx, si ; ds:bx <- port data pop cx jmp doneOK setupModemEvent: ; ; Were's setting the modem notification. Store the parameters in our ; very own SPD_modemEvent structure. ; lea si, ds:[bx].SPD_modemEvent call SerialSetNotificationEvent ; ax <- SNT_HOW only if NOTIFY_WHEN_SNE_MODEM_CHANGED call SerialNotifyModemNotifierChanged endif ; ; Enable/disable modem status interrupts for the port. ; CheckHack <SNM_NONE eq 0> tst ax mov al, ds:[bx].SPD_ien jz disable ; SNT_HOW is SNM_NONE, so no longer ; interested in modem interrupts ; ZSIEN_MODEM HAPPENS TO BE THE SAME AS SIEN_MODEM SO I JUST ; LEFT THE CODE IN AS IS RATHER THAN CHECKING TO SEE WHICH ; TO USE IN THE ZOOMER CODE ornf al, mask SIEN_MODEM jmp setModem disable: test ds:[bx].SPD_mode, mask SF_HARDWARE jnz done ; Leave modem ints on for hwfc andnf al, not mask SIEN_MODEM setModem: mov dx, ds:[bx].SPD_base add dx, offset SP_ien mov ds:[bx].SPD_ien, al out dx, al jmp doneOK handOff: ; ; Hand off the call to the stream driver passing the proper stream. ; Note that if the caller sets an error notifier for the writer, ; it won't have any effect, since errors are posted only to the ; input stream. ; mov si, ds:[bx].SPD_inStream ; Assume reader... test ax, mask SNT_READER jnz 10$ mov si, ds:[bx].SPD_outStream 10$: mov bx, si tst bx stc jz done call StreamStrategy doneOK: clc done: .leave ret SerialSetNotify endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialSetNotificationEvent %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Loads a StreamNotifier structure. CALLED BY: SerialSetNotify PASS: ax = StreamNotifyType cx:dx = address of handling routine, if SNM_ROUTINE; destination of output if SNM_MESSAGE bp = AX to pass if SNM_ROUTINE (except for SNE_DATA with threshold of 1, in which case value is passed in CX); method to send if SNM_MESSAGE. ds:si = StreamNotifier to load RETURN: ax = just the SN_type DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- jdashe 5/27/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialSetNotificationEvent proc near .enter andnf ax, mask SNT_HOW mov ds:[si].SN_type, al mov ds:[si].SN_dest.SND_routine.low, dx mov ds:[si].SN_dest.SND_routine.high, cx mov ds:[si].SN_data, bp .leave ret SerialSetNotificationEvent endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialFlush %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handler for the serial driver's DR_STREAM_FLUSH. If called for an active port, pass straight through to SerialHandOff. A passive port will call SerialHandOff to flush pending data, then reset the writer's SSD_ptr to SD_data. CALLED BY: DR_STREAM_FLUSH PASS: bx = unit number (transformed to SerialPortData by SerialStrategy) di = function code ax = STREAM_READ to apply only to reading STREAM_WRITE to apply only to writing STREAM_BOTH to apply to both (valid only for DR_STREAM_FLUSH and DR_STREAM_SET_THRESHOLD) RETURN: nothing DESTROYED: bx (saved by SerialStrategy) REVISION HISTORY: Name Date Description ---- ---- ----------- jdashe 6/15/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment resource SerialFlush proc near .enter ; ; If this is an active port, jump straight to SerialHandOff. ; test ds:[bx].SPD_passive, mask SPS_PASSIVE jnz handlePassive call SerialHandOff jmp exit handlePassive: push bx call SerialHandOff pop bx mov bx, ds:[bx].SPD_inStream tst bx ; Is there an input stream? jz exit ; If not, leave. ; ; Reset the passive port's input stream pointer to the head of the ; buffer. Must change both reader and writer pointers because ; they must be equal when the stream is empty!! ; push ds mov ds, bx ; ds:0 <- StreamData mov ds:SD_writer.SSD_ptr, offset SD_data mov ds:SD_reader.SSD_ptr, offset SD_data pop ds exit: .leave ret SerialFlush endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ECVerifyReadWriteBothFlag %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: EC: Make sure ax holds STREAM_READ, STREAM_WRITE or STREAM_BOTH CALLED BY: (INTERNAL) PASS: ax = one of those RETURN: nothing DESTROYED: nothing SIDE EFFECTS: death if bad data PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 8/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if ERROR_CHECK ECVerifyReadWriteBothFlag proc near .enter cmp ax, STREAM_READ je notAHoser cmp ax, STREAM_WRITE je notAHoser cmp ax, STREAM_BOTH je notAHoser ERROR AX_NOT_STREAM_WRITE_OR_STREAM_READ_OR_STREAM_BOTH notAHoser: .leave ret ECVerifyReadWriteBothFlag endp endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialHandOff %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Pass a call on to the stream driver for one or both of the streams associated with the port, passing the appropriate side for each. CALLED BY: DR_STREAM_GET_ERROR (STREAM_BOTH should *not* be given), DR_STREAM_SET_ERROR, DR_STREAM_FLUSH, DR_STREAM_SET_THRESHOLD, DR_STREAM_QUERY PASS: bx = unit number (transformed to SerialPortData by SerialStrategy) di = function code ax = STREAM_READ to apply only to reading STREAM_WRITE to apply only to writing STREAM_BOTH to apply to both (valid only for DR_STREAM_FLUSH and DR_STREAM_SET_THRESHOLD) RETURN: ? DESTROYED: bx (saved by SerialStrategy) PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 6/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialHandOff proc near .enter CheckHack <(STREAM_WRITE AND 1) eq 0 and (STREAM_BOTH AND 1) eq 0 and (STREAM_BOTH lt 0) and (STREAM_READ lt 0) and (STREAM_READ AND 1) ne 0> EC < call ECVerifyReadWriteBothFlag > ; ; If this is a passive port, set ax to STREAM_READ only. ; test ds:[bx].SPD_passive, mask SPS_PASSIVE jz testStreamSelection EC < push si > EC < mov si, bx > EC < call ECSerialVerifyPassive > EC < pop si > mov ax, STREAM_READ ; ; If we're clearing out the buffer for the passive buffer, ; clear the full buffer flag just to be sure. ; cmp di, DR_STREAM_FLUSH jne testStreamSelection andnf ds:[bx].SPD_passive, not (mask SPS_BUFFER_FULL) testStreamSelection: ; ; See if output stream affected (STREAM_WRITE and STREAM_BOTH both have ; the low bit 0) ; test ax, 1 jnz readOnly push ax, bx, di mov ax, STREAM_WRITE mov bx, ds:[bx].SPD_outStream tst bx jz 10$ call StreamStrategy 10$: pop bx, di XchgTopStack ax ; Preserve possible return value from ; function if STREAM_WRITE specified ; ; See if input also affected (STREAM_READ and STREAM_BOTH are ; both < 0). ; tst ax pop ax ; Recover possible result... jns done readOnly: mov ax, STREAM_READ mov bx, ds:[bx].SPD_inStream tst bx jz done call StreamStrategy done: .leave ret SerialHandOff endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialRead %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Read data from a port CALLED BY: DR_STREAM_READ PASS: bx = unit number (transformed to SerialPortData by SerialStrategy) ax = STREAM_BLOCK/STREAM_NO_BLOCK cx = number of bytes to read ds:si = buffer to which to read RETURN: cx = number of bytes read DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 6/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialRead proc near .enter mov bx, ds:[bx].SPD_inStream tst bx jz noInputStream segmov ds, es ; Restore ds from entry call StreamStrategy done: .leave ret noInputStream: clr cx stc jmp done SerialRead endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialReadByte %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Read a single byte from a port CALLED BY: DR_STREAM_READ_BYTE PASS: ax = STREAM_BLOCK/STREAM_NO_BLOCK bx = unit number (transformed to SerialPortData by SerialStrategy) RETURN: al = byte read DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 6/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialReadByte proc near .enter mov bx, ds:[bx].SPD_inStream tst bx jz noInputStream call StreamStrategy done: .leave ret noInputStream: stc jmp done SerialReadByte endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialWrite %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Write a buffer to the serial port. CALLED BY: DR_STREAM_WRITE PASS: ax = STREAM_BLOCK/STREAM_NO_BLOCK bx = unit number (transformed to SerialPortData by SerialStrategy) cx = number of bytes to write es:si = buffer from which to write (ds moved to es by SerialStrategy) di = DR_STREAM_WRITE RETURN: cx = number of bytes written DESTROYED: bx (preserved by SerialStrategy) PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 6/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialWrite proc near .enter mov bx, ds:[bx].SPD_outStream tst bx jz noOutputStream segmov ds, es ; ds <- buffer segment for ; stream driver call StreamStrategy done: .leave ret noOutputStream: clr cx stc jmp done SerialWrite endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialWriteByte %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Write a byte to the serial port. CALLED BY: DR_STREAM_WRITE_BYTE PASS: ax = STREAM_BLOCK/STREAM_NO_BLOCK bx = unit number (transformed to SerialPortData by SerialStrategy) cl = byte to write di = DR_STREAM_WRITE_BYTE RETURN: carry set if byte could not be written and STREAM_NO_BLOCK was specified DESTROYED: bx (preserved by SerialStrategy) PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 6/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialWriteByte proc near .enter mov bx, ds:[bx].SPD_outStream tst bx jz noOutputStream call StreamStrategy done: .leave ret noOutputStream: stc jmp done SerialWriteByte endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialSetFormatPC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: set format for a PC-like serial port CALLED BY: SerialSetFormat PASS: al = data format (SerialFormat) ah = SerialMode bx = unit number (transformed to SerialPortData by SerialStrategy) cx = baud rate (SerialBaud) RETURN: Void. DESTROYED: ax, cx, dx PSEUDOCODE/STRATEGY: KNOWN BUGS/SIDEFFECTS/IDEAS: If this is called on a preempted passive port, the hardware is not modified, only the curState for the passive port and the initState for the active port. REVISION HISTORY: Name Date Description ---- ---- ----------- jimmy 5/ 3/93 Initial version. jdashe 5/26/94 passive support added %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialSetFormatPC proc near .enter mov ds:[bx].SPD_curState.SPS_baud, cx mov ds:[bx].SPD_curState.SPS_format, al if _FUNKY_INFRARED ; ; For our funky infrared dongles, the DTR & RTS signals tell the ; thing what baud rate we're using. If the medium is infrared, adjust ; the modem control signals appropriately. ; mov dl, ds:[bx].SPD_curState.SPS_modem cmp ds:[bx].SPD_medium.MET_manuf, MANUFACTURER_ID_GEOWORKS jne setState cmp ds:[bx].SPD_medium.MET_id, GMID_INFRARED jne setState mov dh, mask SMC_RTS cmp cx, SB_9600 je modifyModem mov dh, mask SMC_DTR cmp cx, SB_19200 je modifyModem mov dh, mask SMC_RTS or mask SMC_DTR cmp cx, SB_115200 jne fail modifyModem: andnf dl, not (mask SMC_RTS or mask SMC_DTR) or dl, dh setState: mov ds:[bx].SPD_curState.SPS_modem, dl endif ; _FUNKY_INFRARED test ds:[bx].SPD_passive, mask SPS_PREEMPTED jz normalSet ; ; This is a preempted port. Make the change in the port's ; curState and in the active port's initState, so it'll take ; effect when the preempted port regains control. ; EC < xchg bx, si > EC < call ECSerialVerifyPassive > EC < xchg bx, si > mov bx, ds:[bx].SPD_otherPortData call SysEnterCritical mov ds:[bx].SPD_initState.SPS_baud, cx mov ds:[bx].SPD_initState.SPS_format, al if _FUNKY_INFRARED mov ds:[bx].SPD_initState.SPS_modem, dl endif ; _FUNKY_INFRARED call SysExitCritical mov bx, ds:[bx].SPD_otherPortData jmp done normalSet: ; ; Establish the format right away while setting DLAB, allowing ; us to store the new baud rate as well. ; mov dx, ds:[bx].SPD_base add dx, offset SP_lineCtrl ornf al, mask SF_DLAB out dx, al ; ; Stuff the new baud rate in its two pieces. ; sub dx, offset SP_lineCtrl - offset SP_divLow xchg ax, cx out dx, al inc dx mov al, ah out dx, al ; ; Restore the data format and stuff it again after clearing DLAB (this ; is also a nice, painless way to make sure the user passing us DLAB ; set causes us no problems). ; xchg cx, ax andnf al, not mask SF_DLAB add dx, offset SP_lineCtrl - offset SP_divHigh out dx, al if _FUNKY_INFRARED ; ; Set modem control signals for IR baud rate ; mov al, ds:[bx].SPD_curState.SPS_modem sub dx, offset SP_modemCtrl - offset SP_lineCtrl out dx, al endif ; _FUNKY_INFRARED done: clc exit:: .leave ret if _FUNKY_INFRARED fail: mov ax, STREAM_UNSUPPORTED_FORMAT stc jmp exit endif ; _FUNKY_INFRARED SerialSetFormatPC endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialSetFormat %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set the data format and baud rate and mode for a port CALLED BY: DR_SERIAL_SET_FORMAT PASS: al = data format (SerialFormat) ah = SerialMode bx = unit number (transformed to SerialPortData by SerialStrategy) cx = baud rate (SerialBaud) RETURN: carry set if passed an invalid format DESTROYED: ax, cx, bx (preserved by SerialStrategy) PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/13/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialSetFormat proc near uses dx .enter INT_OFF call SerialSetFormatPC jc done ; ; Adjust for the passed mode. ; dl <- SerialFlow with SF_SOFTWARE adjusted properly ; dh <- byte mask for input bytes (0x7f or 0xff) ; mov dl, ds:[bx].SPD_mode ornf dl, mask SF_SOFTWARE mov dh, 0x7f ; dl, dh <- assume cooked cmp ah, SM_RARE CheckHack <SM_COOKED gt SM_RARE> ja haveMode ; => is cooked mov dh, 0xff ; else set 8-bit data input CheckHack <SM_RAW lt SM_RARE> je haveMode ; ; RAW mode -- turn off all aspects of software flow-control ; andnf dl, not (mask SF_SOFTWARE or mask SF_XON or \ mask SF_XOFF or mask SF_SOFTSTOP) test dl, mask SF_HARDWARE jnz haveMode ; ; raw mode with no hardware flow control, so no flow control at all ; ( save some cycles in SerialInt or MiniSerialInt code ) ; andnf dl, not (mask SF_OUTPUT or mask SF_INPUT) haveMode: mov ds:[bx].SPD_byteMask, dh call SerialAdjustFCCommon done: INT_ON .leave ret SerialSetFormat endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialAdjustFCCommon %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Have a new SerialFlow record that may have turned off output flowcontrol, and therefore overridden a hard or soft stop. Set the new mode and reenable transmission if there was a change. CALLED BY: (INTERNAL) SerialSetFormat, SerialSetFlowControl, SerialEnableFlowControl PASS: ds:bx = SerialPortData dl = SerialFlow to set interrupts *OFF* RETURN: carry clear interrupts *ON* DESTROYED: dx, ax SIDE EFFECTS: SPD_mode set, transmit interrupt may be set in SPD_ien PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 8/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialAdjustFCCommon proc near .enter ; ; Set the new mode and get the mask of bits that have changed. ; mov_tr ax, dx xchg ds:[bx].SPD_mode, al xor al, ds:[bx].SPD_mode if NEW_ISR ; ; if any flow control is set, switch to flow control version of ; interrupt handlers. If flow control is cleared, switch to fast ; non-flow control version of interrupt handlers. ; test ds:[bx].SPD_mode, mask SF_SOFTWARE or \ mask SF_HARDWARE jz noFc mov ds:[bx].SPD_handlers, offset FcHandlerTbl jmp cont noFc: mov ds:[bx].SPD_handlers, offset QuickHandlerTbl cont: endif ; NEW_ISR ; ; al = mask of SerialFlow bits that changed. ; test al, mask SF_SOFTSTOP or mask SF_HARDSTOP jnz newIEN ; ; If hardware flow-control changed, we want to tweak the hardware, ; in case the modem-status interrupt has been enabled or disabled. ; test al, mask SF_HARDWARE jz done newIEN: ; ; If preempted passive, don't tweak the hardware. ; test ds:[bx].SPD_passive, mask SPS_PREEMPTED jnz done ; ; We enable transmit always, even if it was just a change in the ; HWFC, but not in the softstop/hardstop flags, as it's smaller ; codewise and does everything we need to do when we do need to turn ; on the transmitter. In the case where we're just changing the ; modem interrupt, this yields an extra interrupt, but it will find ; the output stream empty, and no harm will be done. ; call SerialEnableTransmit done: INT_ON clc .leave ret SerialAdjustFCCommon endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialGetFormatPC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: get format for a PC-like serial port CALLED BY: SerialGetFormat PASS: ds:bx = SerialPortData RETURN: al = SerialFormat cx = SerialBaud DESTROYED: Nada. PSEUDOCODE/STRATEGY: KNOWN BUGS/SIDEFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jimmy 5/ 3/93 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialGetFormatPC proc near .enter mov al, ds:[bx].SPD_curState.SPS_format mov cx, ds:[bx].SPD_curState.SPS_baud .leave ret SerialGetFormatPC endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialGetFormat %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Fetch the current format parameters for the port CALLED BY: DR_SERIAL_GET_FORMAT PASS: bx = unit number (transformed to SerialPortData by SerialStrategy) RETURN: al = SerialFormat ah = SerialMode cx = SerialBaud DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/13/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialGetFormat proc near uses dx .enter INT_OFF ; ; Compute the current mode based on the SF_SOFTWARE and byteMask ; settings. ; mov ah, SM_RAW test ds:[bx].SPD_mode, mask SF_SOFTWARE jz haveMode CheckHack <SM_RARE eq SM_RAW+1> inc ah cmp ds:[bx].SPD_byteMask, 0xff je haveMode CheckHack <SM_COOKED eq SM_RARE+1> inc ah haveMode: ; ; Fetch the pieces of the current baud divisor into cx ; if STANDARD_PC_HARDWARE call SerialGetFormatPC endif ; STANDARD_PC_HARDWARE INT_ON .leave ret SerialGetFormat endp Resident ends if LOG_MODEM_SETTINGS COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialLogModemSettings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Write the SerialModem settings to the log file CALLED BY: (Internal) SerialSetModem PASS: al = SerialModem RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- grisco 1/15/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SBCS < serialModemString char "RI,DCD,CTS,DSR = 0,0,0,0",0 > DBCS < serialModemString wchar "RI,DCD,CTS,DSR = 0,0,0,0",0 > SerialLogModemSettings proc near uses ax,cx,si,di,ds,es .enter ; ; Copy string template to the stack ; mov cx, cs segmov ds, cx mov si, offset serialModemString ; ds:si = string sub sp, size serialModemString mov cx, ss segmov es, cx mov di, sp ; es:di = target LocalCopyString SAVE_REGS ; copy to stack ; ; Loop to set up the string ; mov si, di ; si = offset to start SBCS < add di, size serialModemString-2 ; idx to last 0 > DBCS < add di, size serialModemString-4 > mov cx, 4 ; # bits to set loopTop: shr ax, 1 ; LSB in carry jnc notSet SBCS < mov {byte} es:[di], '1' > DBCS < mov {word} es:[di], '1' > notSet: SBCS < dec di > SBCS < dec di ; previous zero > DBCS < sub di, 4 > loop loopTop ; do the rest segmov ds, es, ax ; ds:si = final string call LogWriteEntry ; write the string add sp, size serialModemString .leave ret SerialLogModemSettings endp Resident ends endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialSetModem %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set the modem-control bits for a port CALLED BY: DR_SERIAL_SET_MODEM PASS: al = modem control bits (SerialModem). SMC_OUT2 is silently forced high. bx = unit number (transformed to SerialPortData by SerialStrategy) RETURN: Nothing DESTROYED: ax PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/14/90 Initial version jdashe 5/26/94 added passive support %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialSetModem proc near uses dx .enter EC < test al, not SerialModem > EC < ERROR_NZ BAD_MODEM_FLAGS > if LOG_MODEM_SETTINGS call SerialLogModemSettings endif ; ; If this is a preempted port, set the modem-contol bits in ; curState and in the active port's initState, then leave ; without modifying the hardware. ; test ds:[bx].SPD_passive, mask SPS_PREEMPTED jz notPreempted EC < xchg bx, si > EC < call ECSerialVerifyPassive > EC < xchg bx, si > ornf al, mask SMC_OUT2 mov bx, ds:[bx].SPD_otherPortData mov ds:[bx].SPD_initState.SPS_modem, al mov bx, ds:[bx].SPD_otherPortData jmp done notPreempted: mov dx, ds:[bx].SPD_base add dx, offset SP_modemCtrl ornf al, mask SMC_OUT2 out dx, al ; ; 4/28/94: wait 3 clock ticks here to allow things to react to ; having DTR asserted. In particular, this is here to allow a ; serial -> parallel converter manufactured by GDT Softworks to ; power up -- ardeb ; checkDTR:: mov ds:[bx].SPD_curState.SPS_modem, al test al, mask SMC_DTR jz done mov ax, 3 call TimerSleep done: .leave ret SerialSetModem endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialGetModem %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Get the modem-control bits for a port CALLED BY: DR_SERIAL_GET_MODEM PASS: bx = unit number (transformed to SerialPortData by SerialStrategy) RETURN: al = modem control bits (SerialModem). DESTROYED: ax PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/14/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialGetModem proc near uses dx .enter ; ; If this is a preempted port, grab the modem control bits ; from the curState rather than from the hardware (we ; don't have control of the hardware, after all). ; test ds:[bx].SPD_passive, mask SPS_PREEMPTED jz notPreempted EC < xchg bx, si > EC < call ECSerialVerifyPassive > EC < xchg bx, si > mov al, ds:[bx].SPD_curState.SPS_modem jmp gotModem notPreempted: mov dx, ds:[bx].SPD_base add dx, offset SP_modemCtrl in al, dx gotModem: ; deal with non-existent port being enabled by masking out all but the ; real modem bits, preventing BAD_MODEM_FLAGS in EC version when caller ; attempts to restore the original modem flags... EC < andnf al, SerialModem > .leave ret SerialGetModem endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialSetFlowControl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Change the flow-control used by a port CALLED BY: DR_SERIAL_SET_FLOW_CONTROL PASS: ax = SerialFlowControl record describing what method(s) of control to use bx = unit number (transformed to SerialPortData by SerialStrategy) cl = signal(s) to use to tell remote to stop sending (SerialModem) if de-asserted ch = signal(s) whose de-assertion indicates we should stop sending (one or more of SMS_DCD, SMS_DSR or SMS_CTS). If more than one signal is given, the dropping of any will cause output to stop until all signals are high again. RETURN: Nothing DESTROYED: ax, cx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 3/ 7/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialSetFlowControl proc near uses dx .enter INT_OFF EC < test ax, not SerialFlowControl > EC < ERROR_NZ BAD_FLOW_CONTROL_FLAGS > mov dl, ds:[bx].SPD_mode ; for Zoomer, we are not allowing Hardware Handshaking, ; due to the way the hardware was designed (cannot be interrupt ; driven as the modem signals are wire-or'ed to be the IRQ ; line, meaning the thing keeps interrupting as long as the ; other side has the signal dropped) test al, mask SFC_SOFTWARE jz clearSWFC ornf dl, mask SF_SOFTWARE jmp checkHWFC clearSWFC: andnf dl, not (mask SF_SOFTWARE or mask SF_XON or \ mask SF_XOFF or mask SF_SOFTSTOP) checkHWFC: test al, mask SFC_HARDWARE jz clearHWFC ornf dl, mask SF_HARDWARE EC < test cl, not (mask SMC_RTS or mask SMC_DTR) > EC < ERROR_NZ BAD_FLOW_CONTROL_FLAGS > EC < test ch, not (mask SMS_CTS or mask SMS_DCD or mask SMS_DSR)> EC < ERROR_NZ BAD_FLOW_CONTROL_FLAGS > mov ds:[bx].SPD_stopCtrl, cl mov ds:[bx].SPD_stopSignal, ch ; SIEN_MODEM IS THE SAME AS ZSIEN_MODEM SO NO NEED TO CHECK ; WHICH PORT IN ZOOMER CODE ornf ds:[bx].SPD_ien, mask SIEN_MODEM done: ; ; Adjust the port's interrupt-enable register to match what we want ; dl = SerialFlow to set ; call SerialAdjustFCCommon .leave ret clearHWFC: andnf dl, not (mask SF_HARDWARE or mask SF_HARDSTOP) tst ds:[bx].SPD_modemEvent.SN_type jnz done ; Modem event registered -- leave modem ; status interrupt enabled. ; SIEN_MODEM IS THE SAME AS ZSIEN_MODEM SO NO NEED TO CHECK ; WHICH PORT IN ZOOMER CODE andnf ds:[bx].SPD_ien, not mask SIEN_MODEM jmp done SerialSetFlowControl endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialEnableFlowControl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set whether flow control is enabled for either or both sides of the serial port. CALLED BY: DR_SERIAL_ENABLE_FLOW_CONTROL PASS: ax = STREAM_READ/STREAM_WRITE/STREAM_BOTH bx = unit RETURN: carry set on error: ax = STREAM_NO_DEVICE = STREAM_CLOSED carry clear if ok: ax = destroyed DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 8/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialEnableFlowControl proc near uses dx .enter EC < call ECVerifyReadWriteBothFlag > INT_OFF ; ; Assume enabling flow control for both sides. ; mov dl, ds:[bx].SPD_mode ornf dl, mask SF_INPUT or mask SF_OUTPUT CheckHack <(STREAM_WRITE and 1) eq 0> CheckHack <(STREAM_BOTH and 1) eq 0> test ax, 1 jz checkInput ; ; Disabling flow control for output. This means we clear SF_OUTPUT ; and also clear SF_SOFTSTOP and SF_HARDSTOP as we are no longer ; constrained not to transmit. ; andnf dl, not (mask SF_OUTPUT or mask SF_SOFTSTOP or \ mask SF_HARDSTOP) checkInput: CheckHack <(STREAM_READ and 0x8000) eq 0x8000> CheckHack <(STREAM_BOTH and 0x8000) eq 0x8000 tst ax js setMode ; ; Disabling flow control for input. This means we clear SF_INPUT ; and also clear SF_XOFF and SF_XON flags (we clear SF_XON to ; ensure consistent behaviour: if the stream hadn't yet drained to ; the low water mark, we would not send an XON when the thing got ; there, so we shouldn't allow one to be sent on the next interrupt ; either; once you disable input flow control, you don't get an ; XON or XOFF generated, period) ; andnf dl, not (mask SF_INPUT or mask SF_XOFF or mask SF_XON) setMode: call SerialAdjustFCCommon .leave ret SerialEnableFlowControl endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialSetRole %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Sets the role of the driver (either DCE or DTE) CALLED BY: DR_SERIAL_SET_ROLE PASS: al = SerialRole bx = unit number RETURN: carry set on error carry clear if ok DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: This doesn't do anything for the serial driver, but the API needed to be defined here so that it could be used in IrCOMM. If the serial driver is ever to be used as a DCE, this routine will need to set the state. REVISION HISTORY: Name Date Description ---- ---- ----------- grisco 12/12/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialSetRole proc near clc ret SerialSetRole endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialGetDeviceMap %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Fetch the map of existing stream devices for this driver CALLED BY: DR_STREAM_GET_DEVICE_MAP PASS: ds = dgroup (from SerialStrategy) RETURN: ax = SerialDeviceMap DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 8/ 7/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialGetDeviceMap proc near .enter mov ax, ds:[deviceMap] .leave ret SerialGetDeviceMap endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialDefinePort %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Define an additional port for the driver to handle. CALLED BY: DR_SERIAL_DEFINE_PORT PASS: ax = base I/O port of device cl = interrupt level for device RETURN: bx = unit number for later calls. carry set if port couldn't be defined (no interrupt vectors available, e.g.) DESTROYED: ax, cx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 10/14/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DefStub SerialDefinePort COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialStatPort %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Check on the status of a serial port. (Must be Resident for PCMCIA support) CALLED BY: DR_SERIAL_STAT_PORT PASS: bx = unit number (SerialPortNum) RETURN: carry set if port doesn't exist carry clear if port is known: al = interrupt level (-1 => unknown) ah = BB_TRUE if port is currently open DESTROYED: nothing (interrupts turned on) PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 10/21/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialStatPort proc near uses bx .enter call SerialGetPortData ; ds:bx <- SerialPortData INT_OFF tst ds:[bx].SPD_base jz nonExistent mov al, ds:[bx].SPD_irq clr ah ; assume not open push bx mov bx, ds:[bx].SPD_openSem tst ds:[bx].Sem_value ; (clears carry) pop bx jg done dec ah done: INT_ON .leave ret nonExistent: stc jmp done SerialStatPort endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialGetPassiveState %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Returns the status of a passive port. CALLED BY: DR_SERIAL_GET_PASSIVE_STATE PASS: bx = Serial unit number RETURN: carry clear if the port exists and is available for passive use carry set otherwise, and: ax = STREAM_NO_DEVICE if the indicated unit doesn't exist. = STREAM_ACTIVE_IN_USE if the unit is actively allocated, which means that a passive allocation is allowed (but will immediately block). = STREAM_PASSIVE_IN_USE if the unit is currently passively allocated. An attempted SerialOpen will be unsuccessful. If ax = STREAM_PASSIVE_IN_USE, check cl for more details. cl = SerialPassiveStatus for the open port, with SPS_PREEMPTED and SPS_BUFFER_FULL set as appropriate. DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- jdashe 5/24/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialGetPassiveState proc near uses bx .enter call SerialGetPortData ; bx <- port data offset EC < xchg si, bx > EC < call ECSerialVerifyPassive > EC < xchg si, bx > tst ds:[bx].SPD_base jnz checkPassiveInUse mov ax, STREAM_NO_DEVICE jmp error checkPassiveInUse: mov cl, ds:[bx].SPD_passive IsPortOpen bx jg portNotOpen mov ax, STREAM_PASSIVE_IN_USE jmp error portNotOpen: mov bx, ds:[bx].SPD_otherPortData IsPortOpen bx mov bx, ds:[bx].SPD_otherPortData jg activeNotOpen mov ax, STREAM_ACTIVE_IN_USE jmp error activeNotOpen: clc jmp exit error: stc exit: .leave ret SerialGetPassiveState endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ECSerialVerifyPassive %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Verifies that the passed offset points to a passive port's SerialPortData structure rather than to an active port's. PASS: ds:si - pointer to the port's data structure RETURN: The Z flag set. DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jdashe 4/27/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if ERROR_CHECK Resident segment ECSerialVerifyPassive proc far .enter ; ; Passive ports are not yet available for the Zoomer. ; if STANDARD_PC_HARDWARE ; ; See if it's one of the passive ports... ; push es, di, cx push bx mov bx, handle dgroup call MemDerefES pop bx ; segmov es, dgroup, di mov di, offset comPortsPassive mov cx, length comPortsPassive xchg ax, si repne scasw xchg ax, si pop es, di, cx ERROR_NE INVALID_PORT_DATA_OFFSET ; ; It's in the right place. Make sure the passive bit is set. ; test ds:[si].SPD_passive, mask SPS_PASSIVE ERROR_Z NOT_A_PASSIVE_PORT cmp si, si ; cheesy way to set Z... endif ; STANDARD_PC_HARDWARE .leave ret ECSerialVerifyPassive endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ECSerialVerifyActive %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Verifies that the passed offset points to an active port's SerialPortData structure rather than to a passive port's. PASS: ds:si - pointer to the port's data structure RETURN: The Z flag clear. DESTROYED: nothing PSEUDO CODE/STRATEGY: Hackish. The code assumes the passive port structure definitions are placed after the active ones. REVISION HISTORY: Name Date Description ---- ---- ----------- jdashe 6/ 2/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ECSerialVerifyActive proc far .enter ; ; Make sure the thing is a port at all. ; cmp si, offset com1 ERROR_B INVALID_PORT_DATA_OFFSET cmp si, LAST_ACTIVE_SERIAL_COMPORT ERROR_A NOT_AN_ACTIVE_PORT ; It's something else. ; ; It's in the right place. Make sure the passive bit is clear. ; test ds:[si].SPD_passive, mask SPS_PASSIVE ERROR_NZ NOT_AN_ACTIVE_PORT .leave ret ECSerialVerifyActive endp Resident ends endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialGetMedium %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Fetch the medium bound to a particular port CALLED BY: DR_SERIAL_GET_MEDIUM PASS: bx = unit number (SerialPortNum) cx = medium # to fetch (0 == primary) RETURN: carry set on error: ax = STREAM_NO_DEVICE carry clear if ok: dxax = MediumType (medium.def) DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 9/22/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment resource SerialGetMedium proc near .enter Assert l, cx, SERIAL_MAX_MEDIA and bx, not SERIAL_PASSIVE ; ignore passive bit -- data ; set only on the active call SerialGetPortData tst_clc ds:[bx].SPD_base jz honk CheckHack <size MediumType eq 4> mov ax, cx shl ax shl ax add bx, ax ; offset bx by index into ; SPD_medium so next thing ; fetches the right medium out movdw dxax, ds:[bx].SPD_medium mov bx, ax or bx, dx jz noMedium ; => nothing in that slot done: .leave ret honk: mov ax, STREAM_NO_DEVICE error: stc jmp done noMedium: mov ax, STREAM_NO_SUCH_MEDIUM jmp error SerialGetMedium endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialSetMedium %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Specify the medium for a particular port. CALLED BY: DR_SERIAL_SET_MEDIUM PASS: bx = unit number (SerialPortNum) ds = serialData segment (from SerialStrategy) dx:ax = array of MediumTypes to bind to the port cx = # of MediumTypes to bind to it RETURN: carry set on error: ax = STREAM_NO_DEVICE carry clear if ok: ax = destroyed DESTROYED: nothing (bx, but that's saved by the caller) SIDE EFFECTS: if port had medium bound, MESN_MEDIUM_NOT_AVAILABLE generated for it MESN_MEDIUM_AVAILABLE generated for new medium PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 9/22/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment resource SerialSetMedium proc near uses cx, dx, si, di .enter ; ; Point to the port data and make sure it exists. ; and bx, not SERIAL_PASSIVE ; ignore passive bit -- data ; set only on the active mov si, bx call SerialGetPortData tst ds:[bx].SPD_base jz honk ; ; First let the world know the currently bound media are gone, before ; we overwrite the info. ; push si ; save port # push dx, ax mov di, MESN_MEDIUM_NOT_AVAILABLE call SerialNotifyMedia ; ; Move the new media into the port data. ; segmov es, ds lea di, ds:[bx].SPD_medium pop ds, si Assert le, cx, SERIAL_MAX_MEDIA CheckHack <size MediumType eq 4> shl cx mov dx, SERIAL_MAX_MEDIA * 2 sub dx, cx ; dx <- # words to zero push si, cx, dx rep movsw mov cx, dx clr ax rep stosw ; mark the rest of the array ; invalid ; ; Now do the same for the passive port, please. ; pop si, cx, dx mov di, es:[bx].SPD_otherPortData add di, offset SPD_medium rep movsw mov cx, dx rep stosw ; ; Let the world know the thing exists. ; pop si ; si <- port # segmov ds, es ; ds:bx <- SPD mov di, MESN_MEDIUM_AVAILABLE call SerialNotifyMedia clc done: .leave ret honk: mov ax, STREAM_NO_DEVICE stc jmp done SerialSetMedium endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialNotifyMedia %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Send notification for each of the Media types bound to a port. CALLED BY: (INTERNAL) SerialSetMedium PASS: ds:bx = SerialPortData with SPD_medium set si = SerialPortNum di = MediumSubsystemNotification to send RETURN: nothing DESTROYED: ax, dx SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 1/23/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialNotifyMedia proc near uses si, bx, cx .enter add bx, offset SPD_medium xchg bx, si ; bx <- unit # ; ds:si <- array mov cx, SERIAL_MAX_MEDIA ; cx <- # media to check mediumLoop: ; ; Fetch the next medium out of the array. ; push cx lodsw mov_tr dx, ax ; dx <- low word lodsw mov cx, ax ; cxdx <- MediumType or ax, dx jz loopDone ; => GMID_INVALID, so done ; ; Send notification out for the medium. ; mov al, MUT_INT push si mov si, SST_MEDIUM call SysSendNotification pop si ; ds:si <- next medium entry pop cx ; cx <- loop counter loop mediumLoop done: .leave ret loopDone: pop cx jmp done SerialNotifyMedia endp SerialSetMediumFAR proc far ; for SerialLookForMedium & SerialDefinePort to ; use push bx call SerialSetMedium pop bx ret SerialSetMediumFAR endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialSetBufferSize %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Change the size of an open stream's buffers. CALLED BY: DR_SERIAL_SET_BUFFER_SIZE PASS: ax = STREAM_READ/STREAM_WRITE bx = unit # cx = new size RETURN: carry set on error DESTROYED: nothing SIDE EFFECTS: if new size smaller than actual number of bytes, most recent bytes will be discarded. PSEUDO CODE/STRATEGY: fetch & 0 the stream pointer for the appropriate side compute new stream size if too small to hold current # bytes, drop enough to leave stream full if shrinking & data wraps, move bytes down so last byte in current buffer is before new SD_max. there must be enough room in the buffer to do this without overwriting anything vital, because of the size adjusting we did in the previous step. set SD_reader.SSD_ptr accordingly MemRealloc the stream if growing & data wraps, move data in last part of buffer up to reach new SD_max adjust SD_writer.SSD_sem.Sem_value by size difference store new stream pointer back in appropriate side REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 8/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DefStub SerialSetBufferSize OpenClose segment SerialSetBufferSize proc far .enter ; ; Figure which variable holds the stream pointer, based on what ; we were passed. ; mov si, offset SPD_inStream cmp ax, STREAM_READ je haveStreamOffset EC < cmp ax, STREAM_WRITE > EC < ERROR_NE MUST_SPECIFY_READER_OR_WRITER > mov si, offset SPD_outStream haveStreamOffset: ; ; Make sure the new buffer size isn't too large. ; cmp cx, STREAM_MAX_STREAM_SIZE jb bufferSizeOk mov ax, STREAM_BUFFER_TOO_LARGE stc jmp done bufferSizeOk: ; ; Fetch the current stream out of the port and set the stream ; pointer to 0 for the duration. This will cause data to get dropped ; on the floor, etc., but that's fine by us. ; push bx, si, ds clr ax xchg ax, ds:[bx][si] tst ax jz errBusy ; => no stream, so someone else ; must be doing something ; ; If we're not the only thread actively messing with this port, claim ; the thing is busy and do nothing. ; cmp ds:[bx].SPD_refCount, 2 jne errBusy ; => another thread is doing ; stuff in here and might ; be dicking with this stream ; ; Figure how big to make the new stream buffer. ; mov ds, ax ; ds <- stream mov dx, ds:[SD_max] ; dx <- old size add cx, size StreamData ; cx <- new size ; ; Shift the data around to account for any shrinkage we're about to ; perform. ; call SerialAdjustForShrinkage ; ; Resize the stream block, please. ; mov bx, ds:[SD_handle] push cx mov_tr ax, cx ; ax <- new size clr cx call MemReAlloc pop cx ; cx <- new size jc allocErr ; ; Shift the data around to account for any enlargement we just ; performed. ; mov ds, ax ; ds <- stream, again call SerialAdjustForGrowth ; ; All the new space or the lost old space come from the writer's side, ; as the data in the stream remain constant. ; sub cx, dx ; cx <- size difference Assert ge, ds:[SD_writer].SSD_sem.Sem_value, 0 add ds:[SD_writer].SSD_sem.Sem_value, cx ; ; The max value for the stream data pointer gets adjusted by the ; same amount, please. ; add ds:[SD_max], cx clc mov ax, ds ; ax <- stream, for restoration replaceStream: ; ; Restore the stream pointer in the SerialPortData ; pop bx, si, ds mov ds:[bx][si], ax done: .leave ret allocErr: xchg cx, dx ; cx <- old size, dx <- new call SerialAdjustForGrowth ; so we can pretend the stream ; grew to its old size and ; undo the work of ; SerialAdjustForShrinkage mov ax, ds mov cx, STREAM_CANNOT_ALLOC stc jmp replaceStream errBusy: mov cx, STREAM_BUSY stc jmp replaceStream SerialSetBufferSize endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialAdjustForShrinkage %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Discard enough data to make it fit in the new size, then shift data down from the end of the buffer to fit under the new limit CALLED BY: (INTERNAL) SerialSetBufferSize PASS: ds = stream being shrunk dx = old size cx = new size RETURN: nothing DESTROYED: ax SIDE EFFECTS: data in the buffer shifted to be below the new max PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 9/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialAdjustForShrinkage proc near uses cx, si, di, es .enter mov ax, cx sub ax, size StreamData sub ax, ds:[SD_reader].SSD_sem.Sem_value jge bytesWillFit ; ; Too many bytes in the stream. Scale back the SSD_sem and advance the ; SSD_ptr for the reader. We adjust the SD_writer.SSD_sem to account ; for the scaling back that'll happen in SerialSetBufferSize itself ; once all is said and done (and in case of error, too...). ; add ds:[SD_reader].SSD_sem.Sem_value, ax neg ax add ds:[SD_writer].SSD_sem.Sem_value, ax add ax, ds:[SD_reader].SSD_ptr cmp ax, ds:[SD_max] ; wrap around end? jb setReaderPtr ; no sub ax, ds:[SD_max] ; ax <- amount of wrap add ax, offset SD_data ; ax <- new pointer setReaderPtr: mov ds:[SD_reader].SSD_ptr, ax bytesWillFit: ; ; There is now room for all the bytes in the new world order. See ; if we need to move any data down from the end of the buffer. ; Note that if the two SSD_ptrs are equal, it either means the buffer ; is empty (in which case we need only shift stuff down to the bottom ; of the buffer) or the buffer is full, which means we're not actually ; shrinking (else we would have thrown away some bytes, above...). ; segmov es, ds ; for moving mov ax, ds:[SD_writer].SSD_ptr cmp ax, ds:[SD_reader].SSD_ptr jae noWrap ; => contiguous or empty ; ; Data wraps around the end of the buffer. If we're actually shrinking, ; we have to shift that data down by the size difference. ; sub cx, dx jae done ; => buffer growing, so don't ; care yet. mov si, ds:[SD_reader].SSD_ptr mov di, si add di, cx ; di <- destination Assert ae, di, ds:[SD_writer].SSD_ptr mov ds:[SD_reader].SSD_ptr, di mov cx, ds:[SD_max] sub cx, si ; cx <- # bytes to move rep movsb jmp done noWrap: ; ; Ok, the data is contiguous or the buffer is empty, but it (the data ; or the pointers) might still be in the way. ; cmp ax, cx ; write pointer after new max? jbe done ; => no so not in the way ; ; Is in the way. Just shift the whole thing down to the start of ; the buffer. For an empty buffer, this moves nothing, but does set ; the SSD_ptr variables to SD_data, which is where we want them. ; mov si, ds:[SD_reader].SSD_ptr mov cx, ax ; cx <- write pointer sub cx, si ; cx <- # bytes to move mov di, offset SD_data ; es:di <- dest mov ds:[SD_reader].SSD_ptr, di rep movsb mov ds:[SD_writer].SSD_ptr, di done: .leave ret SerialAdjustForShrinkage endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialAdjustForGrowth %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Shift any data at the end of the ring buffer up to be at the new end of the ring buffer. CALLED BY: (INTERNAL) SerialSetBufferSize PASS: ds = stream affected cx = new size dx = old size RETURN: nothing DESTROYED: ax SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 9/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialAdjustForGrowth proc near uses cx, si, di, es .enter ; ; If didn't grow, do nothing. ; cmp cx, dx jbe done ; ; See if the data wrap around the end of the buffer. If they don't ; then we have nothing to worry about, as the data can merrily reside ; in the middle of the buffer contiguously without hurting anything. ; segmov es, ds mov ax, ds:[SD_reader].SSD_ptr cmp ax, ds:[SD_writer].SSD_ptr ja wraps jb done ; => doesn't wrap, so don't need to ; worry ; ; Either full (wraps) or empty (doesn't wrap). Don't have to worry about ; < 0 case, as no one can be blocked on the thing, since we're the only ; ones here... ; tst ds:[SD_reader].SSD_sem.Sem_value jz done wraps: ; ; Sigh. It wraps. Woe is me. Sniff. ; ; Must move the data up in the world from the old end to the new end. ; mov di, cx ; es:di <- new end+1 mov si, dx ; ds:si <- old end+1 mov cx, dx sub cx, ax ; cx <- # bytes to move dec di ; move to actual last byte dec si ; from actual last byte std ; do that wacky decrement thing rep movsb cld ; ; Point to the new position of the first byte for reading. ; inc di mov ds:[SD_reader].SSD_ptr, di done: .leave ret SerialAdjustForGrowth endp OpenClose ends
oeis/077/A077910.asm
neoneye/loda-programs
11
1130
<filename>oeis/077/A077910.asm<gh_stars>10-100 ; A077910: Expansion of 1/((1-x)*(1+x+2*x^2-2*x^3)). ; Submitted by <NAME>(s2) ; 1,0,-1,4,-1,-8,19,-4,-49,96,-5,-284,487,72,-1613,2444,927,-9040,12075,7860,-50089,58520,57379,-274596,276879,387072,-1490021,1269636,2484551,-8003864,5574035,15402796,-42558593,22901072,93021707,-223941036,83699767,550225720,-1165507325,232455420,3199010671,-5994936160,61825659,18326068004,-30439591641,-6088893048,103620212339,-152321609524,-67096601249,578980244976,-749430261525,-542723430924,3199544443927,-3612958105128,-3871577644573,17496582742684,-16979343663793,-25756977110720 mov $1,2 mov $2,2 mov $3,2 lpb $0 sub $0,1 mul $2,2 sub $3,$1 add $1,$3 sub $1,2 add $2,$3 add $1,$2 sub $2,$1 add $3,$2 lpe mov $0,$3 mul $0,10 div $0,20
Transynther/x86/_processed/NONE/_xt_sm_/i9-9900K_12_0xa0.log_21829_1327.asm
ljhsiun2/medusa
9
91806
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r14 push %r9 push %rax push %rcx push %rdi push %rsi lea addresses_WT_ht+0x603f, %rsi lea addresses_WT_ht+0x1dcfb, %rdi nop nop sub %r12, %r12 mov $72, %rcx rep movsw nop sub %r14, %r14 lea addresses_normal_ht+0x1bbea, %r9 nop nop nop nop sub $53335, %r10 movb (%r9), %cl dec %r10 lea addresses_UC_ht+0x140bf, %r9 nop nop inc %rcx vmovups (%r9), %ymm7 vextracti128 $1, %ymm7, %xmm7 vpextrq $0, %xmm7, %r12 nop nop nop nop sub %rcx, %rcx lea addresses_A_ht+0x1772f, %rsi lea addresses_normal_ht+0xe5df, %rdi nop nop nop nop nop dec %rax mov $53, %rcx rep movsw sub $46155, %rsi lea addresses_UC_ht+0x673f, %r12 nop nop nop nop nop dec %rsi movups (%r12), %xmm2 vpextrq $1, %xmm2, %rax nop cmp $38253, %r12 lea addresses_A_ht+0x14af9, %r14 nop cmp %r9, %r9 mov $0x6162636465666768, %rsi movq %rsi, %xmm0 vmovups %ymm0, (%r14) nop nop nop nop cmp %r9, %r9 lea addresses_UC_ht+0x333f, %rsi lea addresses_UC_ht+0x17f3f, %rdi nop nop nop nop nop and %r9, %r9 mov $47, %rcx rep movsl nop nop nop add %r10, %r10 pop %rsi pop %rdi pop %rcx pop %rax pop %r9 pop %r14 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r13 push %r14 push %r15 push %r8 push %r9 push %rbp push %rsi // Load lea addresses_US+0x1f13f, %r14 nop cmp %r13, %r13 vmovups (%r14), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $1, %xmm5, %r15 nop nop nop nop nop inc %r15 // Store lea addresses_RW+0xd0ab, %r9 nop nop nop nop cmp $4536, %r8 mov $0x5152535455565758, %rbp movq %rbp, (%r9) nop nop nop nop add %r15, %r15 // Store lea addresses_WT+0x15923, %r9 nop nop xor $304, %r13 mov $0x5152535455565758, %rsi movq %rsi, (%r9) nop nop sub $2172, %r9 // Store lea addresses_RW+0x4b3f, %rsi nop nop nop nop nop and %r15, %r15 mov $0x5152535455565758, %rbp movq %rbp, (%rsi) nop nop add $62840, %r13 // Faulty Load lea addresses_RW+0x4b3f, %r13 xor %r15, %r15 mov (%r13), %rbp lea oracles, %rsi and $0xff, %rbp shlq $12, %rbp mov (%rsi,%rbp,1), %rbp pop %rsi pop %rbp pop %r9 pop %r8 pop %r15 pop %r14 pop %r13 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_RW', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_US', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_RW', 'AVXalign': True, 'size': 8}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_WT', 'AVXalign': False, 'size': 8}} {'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_RW', 'AVXalign': False, 'size': 8}} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_RW', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': False, 'congruent': 8, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 0, 'type': 'addresses_WT_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 4, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_normal_ht'}} {'src': {'NT': False, 'same': True, 'congruent': 9, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32}} {'src': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_UC_ht'}} {'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 */
Binding_Sodium/sodium-functions.adb
jrmarino/libsodium-ada
10
18017
<reponame>jrmarino/libsodium-ada -- This file is covered by the Internet Software Consortium (ISC) License -- Reference: ../License.txt package body Sodium.Functions is --------------------------------- -- initialize_sodium_library -- --------------------------------- function initialize_sodium_library return Boolean is use type Thin.IC.int; res : Thin.IC.int; begin res := Thin.sodium_init; if res = 1 then raise Sodium_Already_Initialized; end if; return (res = 0); end initialize_sodium_library; ----------------------- -- Keyless_Hash #1 -- ----------------------- function Keyless_Hash (plain_text : String) return Standard_Hash is res : Thin.IC.int; hash_length : constant Thin.IC.size_t := Thin.IC.size_t (Standard_Hash'Length); target : aliased Thin.IC.char_array := (1 .. hash_length => Thin.IC.nul); hash_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (target'Unchecked_Access); text_length : constant Thin.NaCl_uint64 := Thin.NaCl_uint64 (plain_text'Length); text_pointer : Thin.ICS.chars_ptr := Thin.ICS.New_String (plain_text); begin res := Thin.crypto_generichash (text_out => hash_pointer, outlen => hash_length, text_in => text_pointer, inlen => text_length, key => Thin.ICS.Null_Ptr, keylen => 0); Thin.ICS.Free (text_pointer); return convert (target); end Keyless_Hash; ----------------------- -- Keyless_Hash #2 -- ----------------------- function Keyless_Hash (plain_text : String; output_size : Hash_Size_Range) return Any_Hash is res : Thin.IC.int; hash_length : constant Thin.IC.size_t := Thin.IC.size_t (output_size); target : aliased Thin.IC.char_array := (1 .. hash_length => Thin.IC.nul); hash_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (target'Unchecked_Access); text_length : constant Thin.NaCl_uint64 := Thin.NaCl_uint64 (plain_text'Length); text_pointer : Thin.ICS.chars_ptr := Thin.ICS.New_String (plain_text); begin res := Thin.crypto_generichash (text_out => hash_pointer, outlen => hash_length, text_in => text_pointer, inlen => text_length, key => Thin.ICS.Null_Ptr, keylen => 0); Thin.ICS.Free (text_pointer); return convert (target); end Keyless_Hash; --------------------- -- Keyed_Hash #1 -- --------------------- function Keyed_Hash (plain_text : String; key : Standard_Key) return Standard_Hash is res : Thin.IC.int; hash_length : constant Thin.IC.size_t := Thin.IC.size_t (Standard_Hash'Length); target : aliased Thin.IC.char_array := (1 .. hash_length => Thin.IC.nul); hash_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (target'Unchecked_Access); text_length : constant Thin.NaCl_uint64 := Thin.NaCl_uint64 (plain_text'Length); text_pointer : Thin.ICS.chars_ptr := Thin.ICS.New_String (plain_text); key_length : constant Thin.IC.size_t := Thin.IC.size_t (key'Length); key_pointer : Thin.ICS.chars_ptr := Thin.ICS.New_String (key); begin res := Thin.crypto_generichash (text_out => hash_pointer, outlen => hash_length, text_in => text_pointer, inlen => text_length, key => key_pointer, keylen => key_length); Thin.ICS.Free (text_pointer); Thin.ICS.Free (key_pointer); return convert (target); end Keyed_Hash; --------------------- -- Keyed_Hash #2 -- --------------------- function Keyed_Hash (plain_text : String; key : Any_Key; output_size : Hash_Size_Range) return Any_Hash is res : Thin.IC.int; hash_length : constant Thin.IC.size_t := Thin.IC.size_t (output_size); target : aliased Thin.IC.char_array := (1 .. hash_length => Thin.IC.nul); hash_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (target'Unchecked_Access); text_length : constant Thin.NaCl_uint64 := Thin.NaCl_uint64 (plain_text'Length); text_pointer : Thin.ICS.chars_ptr := Thin.ICS.New_String (plain_text); key_length : constant Thin.IC.size_t := Thin.IC.size_t (key'Length); key_pointer : Thin.ICS.chars_ptr := Thin.ICS.New_String (key); begin res := Thin.crypto_generichash (text_out => hash_pointer, outlen => hash_length, text_in => text_pointer, inlen => text_length, key => key_pointer, keylen => key_length); Thin.ICS.Free (text_pointer); Thin.ICS.Free (key_pointer); return convert (target); end Keyed_Hash; ------------------ -- convert #1 -- ------------------ function convert (data : Thin.IC.char_array) return String is use type Thin.IC.size_t; result : String (1 .. data'Length); arrow : Thin.IC.size_t := data'First; begin for z in result'Range loop result (z) := Character (data (arrow)); arrow := arrow + 1; end loop; return result; end convert; ------------------ -- convert #2 -- ------------------ function convert (data : String) return Thin.IC.char_array is use type Thin.IC.size_t; reslen : Thin.IC.size_t := Thin.IC.size_t (data'Length); result : Thin.IC.char_array (1 .. reslen); arrow : Thin.IC.size_t := 1; begin for z in data'Range loop result (arrow) := Thin.IC.char (data (z)); arrow := arrow + 1; end loop; return result; end convert; ---------------------------- -- Multipart_Hash_Start -- ---------------------------- function Multipart_Hash_Start (output_size : Hash_Size_Range) return Hash_State is res : Thin.IC.int; result : Hash_State; begin result.hash_length := Thin.IC.size_t (output_size); res := Thin.crypto_generichash_init (state => result.state'Unchecked_Access, key => Thin.ICS.Null_Ptr, keylen => 0, outlen => result.hash_length); return result; end Multipart_Hash_Start; ---------------------------------- -- Multipart_Keyed_Hash_Start -- ---------------------------------- function Multipart_Keyed_Hash_Start (key : Any_Key; output_size : Hash_Size_Range) return Hash_State is res : Thin.IC.int; result : Hash_State; key_length : constant Thin.IC.size_t := Thin.IC.size_t (key'Length); key_pointer : Thin.ICS.chars_ptr := Thin.ICS.New_String (key); begin result.hash_length := Thin.IC.size_t (output_size); res := Thin.crypto_generichash_init (state => result.state'Unchecked_Access, key => key_pointer, keylen => key_length, outlen => result.hash_length); Thin.ICS.Free (key_pointer); return result; end Multipart_Keyed_Hash_Start; ------------------------ -- Multipart_Append -- ------------------------ procedure Multipart_Append (plain_text : String; state : in out Hash_State) is res : Thin.IC.int; text_length : constant Thin.NaCl_uint64 := Thin.NaCl_uint64 (plain_text'Length); text_pointer : Thin.ICS.chars_ptr := Thin.ICS.New_String (plain_text); begin res := Thin.crypto_generichash_update (state => state.state'Unchecked_Access, text_in => text_pointer, inlen => text_length); Thin.ICS.Free (text_pointer); end Multipart_Append; ------------------------------- -- Multipart_Hash_Complete -- ------------------------------- function Multipart_Hash_Complete (state : in out Hash_State) return Any_Hash is res : Thin.IC.int; target : aliased Thin.IC.char_array := (1 .. state.hash_length => Thin.IC.nul); hash_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (target'Unchecked_Access); begin res := Thin.crypto_generichash_final (state => state.state'Unchecked_Access, text_out => hash_pointer, outlen => state.hash_length); return convert (target); end Multipart_Hash_Complete; ------------------------ -- Short_Input_Hash -- ------------------------ function Short_Input_Hash (short_data : String; key : Short_Key) return Short_Hash is res : Thin.IC.int; hash_length : constant Thin.IC.size_t := Thin.IC.size_t (Thin.crypto_shorthash_BYTES); target : aliased Thin.IC.char_array := (1 .. hash_length => Thin.IC.nul); hash_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (target'Unchecked_Access); text_length : constant Thin.NaCl_uint64 := Thin.NaCl_uint64 (short_data'Length); text_pointer : Thin.ICS.chars_ptr := Thin.ICS.New_String (short_data); key_pointer : Thin.ICS.chars_ptr := Thin.ICS.New_String (key); begin res := Thin.crypto_shorthash (text_out => hash_pointer, text_in => text_pointer, inlen => text_length, k => key_pointer); Thin.ICS.Free (text_pointer); Thin.ICS.Free (key_pointer); return convert (target); end Short_Input_Hash; ------------------- -- Random_Word -- ------------------- function Random_Word return Natural32 is result : Thin.NaCl_uint32 := Thin.randombytes_random; begin return Natural32 (result); end Random_Word; --------------------------- -- Random_Limited_Word -- --------------------------- function Random_Limited_Word (upper_bound : Natural32) return Natural32 is upper : Thin.NaCl_uint32 := Thin.NaCl_uint32 (upper_bound); result : Thin.NaCl_uint32 := Thin.randombytes_uniform (upper); begin return Natural32 (result); end Random_Limited_Word; ------------------- -- Random_Salt -- ------------------- function Random_Salt return Password_Salt is bufferlen : constant Thin.IC.size_t := Thin.IC.size_t (Password_Salt'Last); buffer : Thin.IC.char_array := (1 .. bufferlen => Thin.IC.nul); begin Thin.randombytes_buf (buf => buffer (buffer'First)'Address, size => bufferlen); return convert (buffer); end Random_Salt; ------------------------ -- Random_Short_Key -- ------------------------ function Random_Short_Key return Short_Key is bufferlen : constant Thin.IC.size_t := Thin.IC.size_t (Short_Key'Last); buffer : Thin.IC.char_array := (1 .. bufferlen => Thin.IC.nul); begin Thin.randombytes_buf (buf => buffer (buffer'First)'Address, size => bufferlen); return convert (buffer); end Random_Short_Key; -------------------------------- -- Random_Standard_Hash_key -- -------------------------------- function Random_Standard_Hash_Key return Standard_Key is bufferlen : constant Thin.IC.size_t := Thin.IC.size_t (Standard_Key'Last); buffer : Thin.IC.char_array := (1 .. bufferlen => Thin.IC.nul); begin Thin.randombytes_buf (buf => buffer (buffer'First)'Address, size => bufferlen); return convert (buffer); end Random_Standard_Hash_Key; ----------------------- -- Random_Hash_Key -- ----------------------- function Random_Hash_Key (Key_Size : Key_Size_Range) return Any_Key is bufferlen : constant Thin.IC.size_t := Thin.IC.size_t (Key_Size); buffer : Thin.IC.char_array := (1 .. bufferlen => Thin.IC.nul); begin Thin.randombytes_buf (buf => buffer (buffer'First)'Address, size => bufferlen); return convert (buffer); end Random_Hash_Key; ---------------------------- -- Random_Sign_Key_seed -- ---------------------------- function Random_Sign_Key_seed return Sign_Key_Seed is bufferlen : constant Thin.IC.size_t := Thin.IC.size_t (Sign_Key_Seed'Last); buffer : Thin.IC.char_array := (1 .. bufferlen => Thin.IC.nul); begin Thin.randombytes_buf (buf => buffer (buffer'First)'Address, size => bufferlen); return convert (buffer); end Random_Sign_Key_seed; --------------------------- -- Random_Box_Key_seed -- --------------------------- function Random_Box_Key_seed return Box_Key_Seed is bufferlen : constant Thin.IC.size_t := Thin.IC.size_t (Box_Key_Seed'Last); buffer : Thin.IC.char_array := (1 .. bufferlen => Thin.IC.nul); begin Thin.randombytes_buf (buf => buffer (buffer'First)'Address, size => bufferlen); return convert (buffer); end Random_Box_Key_seed; -------------------- -- Random_Nonce -- -------------------- function Random_Nonce return Box_Nonce is bufferlen : constant Thin.IC.size_t := Thin.IC.size_t (Box_Nonce'Last); buffer : Thin.IC.char_array := (1 .. bufferlen => Thin.IC.nul); begin Thin.randombytes_buf (buf => buffer (buffer'First)'Address, size => bufferlen); return convert (buffer); end Random_Nonce; ---------------------------- -- Random_Symmetric_Key -- ---------------------------- function Random_Symmetric_Key return Symmetric_Key is bufferlen : constant Thin.IC.size_t := Thin.IC.size_t (Symmetric_Key'Last); buffer : Thin.IC.char_array := (1 .. bufferlen => Thin.IC.nul); begin Thin.randombytes_buf (buf => buffer (buffer'First)'Address, size => bufferlen); return convert (buffer); end Random_Symmetric_Key; ------------------------------ -- Random_Symmetric_Nonce -- ------------------------------ function Random_Symmetric_Nonce return Symmetric_Nonce is bufferlen : constant Thin.IC.size_t := Thin.IC.size_t (Symmetric_Nonce'Last); buffer : Thin.IC.char_array := (1 .. bufferlen => Thin.IC.nul); begin Thin.randombytes_buf (buf => buffer (buffer'First)'Address, size => bufferlen); return convert (buffer); end Random_Symmetric_Nonce; ----------------------- -- Random_Auth_Key -- ----------------------- function Random_Auth_Key return Auth_Key is bufferlen : constant Thin.IC.size_t := Thin.IC.size_t (Auth_Key'Last); buffer : Thin.IC.char_array := (1 .. bufferlen => Thin.IC.nul); begin Thin.randombytes_buf (buf => buffer (buffer'First)'Address, size => bufferlen); return convert (buffer); end Random_Auth_Key; ------------------------- -- Random_AEAD_Nonce -- ------------------------- function Random_AEAD_Nonce (construction : AEAD_Construction := ChaCha20_Poly1305) return AEAD_Nonce is function nonce_size return Thin.IC.size_t; function nonce_size return Thin.IC.size_t is begin case construction is when ChaCha20_Poly1305 => return Thin.IC.size_t (Thin.crypto_aead_chacha20poly1305_NPUBBYTES); when ChaCha20_Poly1305_IETF => return Thin.IC.size_t (Thin.crypto_aead_chacha20poly1305_ietf_NPUBBYTES); when AES256_GCM => return Thin.IC.size_t (Thin.crypto_aead_aes256gcm_NPUBBYTES); end case; end nonce_size; bufferlen : constant Thin.IC.size_t := nonce_size; buffer : Thin.IC.char_array := (1 .. bufferlen => Thin.IC.nul); begin Thin.randombytes_buf (buf => buffer (buffer'First)'Address, size => bufferlen); return convert (buffer); end Random_AEAD_Nonce; ----------------------- -- Random_AEAD_Key -- ----------------------- function Random_AEAD_Key (construction : AEAD_Construction := ChaCha20_Poly1305) return AEAD_Key is function key_size return Thin.IC.size_t; function key_size return Thin.IC.size_t is begin case construction is when ChaCha20_Poly1305 => return Thin.IC.size_t (Thin.crypto_aead_chacha20poly1305_KEYBYTES); when ChaCha20_Poly1305_IETF => return Thin.IC.size_t (Thin.crypto_aead_chacha20poly1305_ietf_KEYBYTES); when AES256_GCM => return Thin.IC.size_t (Thin.crypto_aead_aes256gcm_KEYBYTES); end case; end key_size; bufferlen : constant Thin.IC.size_t := key_size; buffer : Thin.IC.char_array := (1 .. bufferlen => Thin.IC.nul); begin Thin.randombytes_buf (buf => buffer (buffer'First)'Address, size => bufferlen); return convert (buffer); end Random_AEAD_Key; --------------------------- -- Derive_Password_Key -- --------------------------- function Derive_Password_Key (criticality : Data_Criticality := online_interactive; passkey_size : Passkey_Size_Range := Positive (Thin.crypto_box_SEEDBYTES); password : String; salt : Password_Salt) return Any_Password_Key is opslimit : Thin.NaCl_uint64; memlimit : Thin.IC.size_t; password_size : constant Thin.NaCl_uint64 := Thin.NaCl_uint64 (password'Length); password_tank : aliased Thin.IC.char_array := convert (password); password_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (password_tank'Unchecked_Access); passkey_size_F : constant Thin.NaCl_uint64 := Thin.NaCl_uint64 (passkey_size); passkey_size_C : constant Thin.IC.size_t := Thin.IC.size_t (passkey_size); passkey_tank : aliased Thin.IC.char_array := (1 .. passkey_size_C => Thin.IC.nul); passkey_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (passkey_tank'Unchecked_Access); salt_tank : aliased Thin.IC.char_array := convert (salt); salt_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (salt_tank'Unchecked_Access); begin case criticality is when online_interactive => opslimit := Thin.crypto_pwhash_OPSLIMIT_INTERACTIVE; memlimit := Thin.crypto_pwhash_MEMLIMIT_INTERACTIVE; when moderate => opslimit := Thin.crypto_pwhash_OPSLIMIT_MODERATE; memlimit := Thin.crypto_pwhash_MEMLIMIT_MODERATE; when highly_sensitive => opslimit := Thin.crypto_pwhash_OPSLIMIT_SENSITIVE; memlimit := Thin.crypto_pwhash_MEMLIMIT_SENSITIVE; end case; declare use type Thin.IC.int; res : Thin.IC.int; begin res := Thin.crypto_pwhash (text_out => passkey_pointer, outlen => passkey_size_F, passwd => <PASSWORD>, passwdlen => <PASSWORD>, salt => salt_pointer, opslimit => opslimit, memlimit => memlimit, alg => Thin.crypto_pwhash_ALG_DEFAULT); if res /= 0 then raise Sodium_Out_Of_Memory with "Derive_Password_Key"; end if; end; return convert (passkey_tank); end Derive_Password_Key; ------------------------------ -- Generate_Password_Hash -- ------------------------------ function Generate_Password_Hash (criticality : Data_Criticality := online_interactive; password : String) return Any_Hash is opslimit : Thin.NaCl_uint64; memlimit : Thin.IC.size_t; hash_tank : Thin.Password_Hash_Container; password_size : constant Thin.NaCl_uint64 := Thin.NaCl_uint64 (password'Length); password_tank : aliased Thin.IC.char_array := convert (password); password_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (password_tank'Unchecked_Access); begin case criticality is when online_interactive => opslimit := Thin.crypto_pwhash_OPSLIMIT_INTERACTIVE; memlimit := Thin.crypto_pwhash_MEMLIMIT_INTERACTIVE; when moderate => opslimit := Thin.crypto_pwhash_OPSLIMIT_MODERATE; memlimit := Thin.crypto_pwhash_MEMLIMIT_MODERATE; when highly_sensitive => opslimit := Thin.crypto_pwhash_OPSLIMIT_SENSITIVE; memlimit := Thin.crypto_pwhash_MEMLIMIT_SENSITIVE; end case; declare use type Thin.IC.int; use type Thin.IC.char; res : Thin.IC.int; product : String (hash_tank'Range); lastz : Natural := 0; begin res := Thin.crypto_pwhash_str (text_out => hash_tank, passwd => <PASSWORD>, passwdlen => <PASSWORD>, opslimit => opslimit, memlimit => memlimit); if res /= 0 then raise Sodium_Out_Of_Memory with "Generate_Password_Hash"; end if; for z in hash_tank'Range loop if hash_tank (z) = Thin.IC.nul then return product (product'First .. lastz); end if; product (z) := Character (hash_tank (z)); lastz := z; end loop; return product; end; end Generate_Password_Hash; ----------------------------- -- Password_Hash_Matches -- ----------------------------- function Password_Hash_Matches (hash : Any_Hash; password : String) return Boolean is hash_tank : Thin.Password_Hash_Container := (others => Thin.IC.nul); password_size : constant Thin.NaCl_uint64 := Thin.NaCl_uint64 (password'Length); password_tank : aliased Thin.IC.char_array := convert (password); password_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (password_tank'Unchecked_Access); arrow : Positive := Thin.Password_Hash_Container'First; begin for z in hash'Range loop hash_tank (arrow) := Thin.IC.char (hash (z)); arrow := arrow + 1; end loop; declare use type Thin.IC.int; res : Thin.IC.int; begin res := Thin.crypto_pwhash_str_verify (text_str => hash_tank, passwd => <PASSWORD>, passwdlen => password_size); return (res = 0); end; end Password_Hash_Matches; ---------------------- -- As_Hexidecimal -- ---------------------- function As_Hexidecimal (binary : String) return String is type byte is mod 2 ** 8; subtype octet is String (1 .. 2); function Hex (mychar : Character) return octet; mask0 : constant byte := 16#F#; mask1 : constant byte := 16#F0#; zero : constant Natural := Character'Pos ('0'); alpha : constant Natural := Character'Pos ('a') - 10; function Hex (mychar : Character) return octet is mybyte : byte := byte (Character'Pos (mychar)); val0 : byte := (mybyte and mask0); val1 : byte := (mybyte and mask1); result : octet; begin case val0 is when 0 .. 9 => result (2) := Character'Val (zero + Natural (val0)); when 10 .. 15 => result (2) := Character'Val (alpha + Natural (val0)); when others => null; end case; case val1 is when 16#00# => result (1) := '0'; when 16#10# => result (1) := '1'; when 16#20# => result (1) := '2'; when 16#30# => result (1) := '3'; when 16#40# => result (1) := '4'; when 16#50# => result (1) := '5'; when 16#60# => result (1) := '6'; when 16#70# => result (1) := '7'; when 16#80# => result (1) := '8'; when 16#90# => result (1) := '9'; when 16#A0# => result (1) := 'a'; when 16#B0# => result (1) := 'b'; when 16#C0# => result (1) := 'c'; when 16#D0# => result (1) := 'd'; when 16#E0# => result (1) := 'e'; when 16#F0# => result (1) := 'f'; when others => null; end case; return result; end Hex; product : String (1 .. 2 * binary'Length); arrow : Positive := 1; begin for z in binary'Range loop product (arrow .. arrow + 1) := Hex (binary (z)); arrow := arrow + 2; end loop; return product; end As_Hexidecimal; ----------------- -- As_Binary -- ----------------- function As_Binary (hexidecimal : String; ignore : String := "") return String is subtype octet is String (1 .. 2); function decvalue (byte : octet) return Character; pass1 : String := (1 .. hexidecimal'Length => ASCII.NUL); real_size : Natural := 0; adiff : constant Natural := Character'Pos ('a') - Character'Pos ('A'); found : Boolean; function decvalue (byte : octet) return Character is position : Natural := 0; zero : constant Natural := Character'Pos ('0'); alpha : constant Natural := Character'Pos ('A') - 10; sixt : Character renames byte (1); ones : Character renames byte (2); begin case sixt is when '0' .. '9' => position := (Character'Pos (sixt) - zero) * 16; when 'A' .. 'F' => position := (Character'Pos (sixt) - alpha) * 16; when others => null; end case; case byte (2) is when '0' .. '9' => position := position + (Character'Pos (ones) - zero); when 'A' .. 'F' => position := position + (Character'Pos (ones) - alpha); when others => null; end case; return Character'Val (position); end decvalue; begin for z in hexidecimal'Range loop case hexidecimal (z) is when '0' .. '9' | 'A' .. 'F' => real_size := real_size + 1; pass1 (real_size) := hexidecimal (z); when 'a' .. 'f' => real_size := real_size + 1; pass1 (real_size) := Character'Val (Character'Pos (hexidecimal (z)) - adiff); when others => found := False; for y in ignore'Range loop if hexidecimal (z) = ignore (y) then found := True; exit; end if; end loop; if not found then raise Sodium_Invalid_Input with "As_Binary - illegal character: " & hexidecimal (z); end if; end case; end loop; if real_size = 0 then raise Sodium_Invalid_Input with "As_Binary - no hexidecimal digits found: " & hexidecimal; end if; if real_size mod 2 /= 0 then raise Sodium_Invalid_Input with "As_Binary - odd number of hexidecimal digits: " & hexidecimal; end if; declare bin_size : constant Natural := real_size / 2; product : String (1 .. bin_size); index : Natural; begin for z in 1 .. bin_size loop index := z * 2 - 1; product (z) := decvalue (pass1 (index .. index + 1)); end loop; return product; end; end As_Binary; ----------------------------- -- Generate_Sign_Keys #1 -- ----------------------------- procedure Generate_Sign_Keys (sign_key_public : out Public_Sign_Key; sign_key_secret : out Secret_Sign_Key) is res : Thin.IC.int; public_key_size : Thin.IC.size_t := Thin.IC.size_t (Thin.crypto_sign_PUBLICKEYBYTES); public_key_tank : aliased Thin.IC.char_array := (1 .. public_key_size => Thin.IC.nul); public_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (public_key_tank'Unchecked_Access); secret_key_size : Thin.IC.size_t := Thin.IC.size_t (Thin.crypto_sign_SECRETKEYBYTES); secret_key_tank : aliased Thin.IC.char_array := (1 .. secret_key_size => Thin.IC.nul); secret_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (secret_key_tank'Unchecked_Access); begin res := Thin.crypto_sign_keypair (pk => public_pointer, sk => secret_pointer); sign_key_public := convert (public_key_tank); sign_key_secret := convert (secret_key_tank); end Generate_Sign_Keys; ----------------------------- -- Generate_Sign_Keys #2 -- ----------------------------- procedure Generate_Sign_Keys (sign_key_public : out Public_Sign_Key; sign_key_secret : out Secret_Sign_Key; seed : Sign_Key_Seed) is res : Thin.IC.int; public_key_size : Thin.IC.size_t := Thin.IC.size_t (Thin.crypto_sign_PUBLICKEYBYTES); public_key_tank : aliased Thin.IC.char_array := (1 .. public_key_size => Thin.IC.nul); public_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (public_key_tank'Unchecked_Access); secret_key_size : Thin.IC.size_t := Thin.IC.size_t (Thin.crypto_sign_SECRETKEYBYTES); secret_key_tank : aliased Thin.IC.char_array := (1 .. secret_key_size => Thin.IC.nul); secret_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (secret_key_tank'Unchecked_Access); seed_tank : aliased Thin.IC.char_array := convert (seed); seed_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (seed_tank'Unchecked_Access); begin res := Thin.crypto_sign_seed_keypair (pk => public_pointer, sk => secret_pointer, seed => seed_pointer); sign_key_public := convert (public_key_tank); sign_key_secret := convert (secret_key_tank); end Generate_Sign_Keys; ------------------------ -- Obtain_Signature -- ------------------------ function Obtain_Signature (plain_text_message : String; sign_key_secret : Secret_Sign_Key) return Signature is res : Thin.IC.int; message_tank : aliased Thin.IC.char_array := convert (plain_text_message); message_size : Thin.NaCl_uint64 := Thin.NaCl_uint64 (message_tank'Length); message_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (message_tank'Unchecked_Access); secret_tank : aliased Thin.IC.char_array := convert (sign_key_secret); secret_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (secret_tank'Unchecked_Access); result_size : Thin.IC.size_t := Thin.IC.size_t (Signature'Length); result_tank : aliased Thin.IC.char_array := (1 .. result_size => Thin.IC.nul); result_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (result_tank'Unchecked_Access); begin res := Thin.crypto_sign_detached (sig => result_pointer, siglen => Thin.ICS.Null_Ptr, m => message_pointer, mlen => message_size, sk => secret_pointer); return convert (result_tank); end Obtain_Signature; ------------------------- -- Signature_Matches -- ------------------------- function Signature_Matches (plain_text_message : String; sender_signature : Signature; sender_sign_key : Public_Sign_Key) return Boolean is use type Thin.IC.int; res : Thin.IC.int; message_tank : aliased Thin.IC.char_array := convert (plain_text_message); message_size : Thin.NaCl_uint64 := Thin.NaCl_uint64 (message_tank'Length); message_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (message_tank'Unchecked_Access); sendsig_tank : aliased Thin.IC.char_array := convert (sender_signature); sendsig_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (sendsig_tank'Unchecked_Access); sendkey_tank : aliased Thin.IC.char_array := convert (sender_sign_key); sendkey_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (sendkey_tank'Unchecked_Access); begin res := Thin.crypto_sign_verify_detached (sig => sendsig_pointer, m => message_pointer, mlen => message_size, pk => sendkey_pointer); return (res = 0); end Signature_Matches; ---------------------------- -- Generate_Box_Keys #1 -- ---------------------------- procedure Generate_Box_Keys (box_key_public : out Public_Box_Key; box_key_secret : out Secret_Box_Key) is res : Thin.IC.int; public_key_size : Thin.IC.size_t := Thin.IC.size_t (Thin.crypto_box_PUBLICKEYBYTES); public_key_tank : aliased Thin.IC.char_array := (1 .. public_key_size => Thin.IC.nul); public_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (public_key_tank'Unchecked_Access); secret_key_size : Thin.IC.size_t := Thin.IC.size_t (Thin.crypto_box_SECRETKEYBYTES); secret_key_tank : aliased Thin.IC.char_array := (1 .. secret_key_size => Thin.IC.nul); secret_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (secret_key_tank'Unchecked_Access); begin res := Thin.crypto_box_keypair (pk => public_pointer, sk => secret_pointer); box_key_public := convert (public_key_tank); box_key_secret := convert (secret_key_tank); end Generate_Box_Keys; ---------------------------- -- Generate_Box_Keys #2 -- ---------------------------- procedure Generate_Box_Keys (box_key_public : out Public_Box_Key; box_key_secret : out Secret_Box_Key; seed : Box_Key_Seed) is res : Thin.IC.int; public_key_size : Thin.IC.size_t := Thin.IC.size_t (Thin.crypto_box_PUBLICKEYBYTES); public_key_tank : aliased Thin.IC.char_array := (1 .. public_key_size => Thin.IC.nul); public_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (public_key_tank'Unchecked_Access); secret_key_size : Thin.IC.size_t := Thin.IC.size_t (Thin.crypto_box_SECRETKEYBYTES); secret_key_tank : aliased Thin.IC.char_array := (1 .. secret_key_size => Thin.IC.nul); secret_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (secret_key_tank'Unchecked_Access); seed_tank : aliased Thin.IC.char_array := convert (seed); seed_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (seed_tank'Unchecked_Access); begin res := Thin.crypto_box_seed_keypair (pk => public_pointer, sk => secret_pointer, seed => seed_pointer); box_key_public := convert (public_key_tank); box_key_secret := convert (secret_key_tank); end Generate_Box_Keys; --------------------------- -- Generate_Shared_Key -- --------------------------- function Generate_Shared_Key (recipient_public_key : Public_Box_Key; sender_secret_key : Secret_Box_Key) return Box_Shared_Key is res : Thin.IC.int; public_key_tank : aliased Thin.IC.char_array := convert (recipient_public_key); public_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (public_key_tank'Unchecked_Access); secret_key_tank : aliased Thin.IC.char_array := convert (sender_secret_key); secret_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (secret_key_tank'Unchecked_Access); shared_key_size : Thin.IC.size_t := Thin.IC.size_t (Thin.crypto_box_BEFORENMBYTES); shared_key_tank : aliased Thin.IC.char_array := (1 .. shared_key_size => Thin.IC.nul); shared_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (shared_key_tank'Unchecked_Access); begin res := Thin.crypto_box_beforenm (k => shared_pointer, pk => public_pointer, sk => secret_pointer); return convert (shared_key_tank); end Generate_Shared_Key; -------------------------- -- Encrypt_Message #1 -- -------------------------- function Encrypt_Message (plain_text_message : String; shared_key : Box_Shared_Key; unique_nonce : Box_Nonce) return Encrypted_Data is use type Thin.IC.size_t; res : Thin.IC.int; message_tank : aliased Thin.IC.char_array := convert (plain_text_message); message_size : Thin.NaCl_uint64 := Thin.NaCl_uint64 (message_tank'Length); message_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (message_tank'Unchecked_Access); nonce_tank : aliased Thin.IC.char_array := convert (unique_nonce); nonce_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (nonce_tank'Unchecked_Access); skey_tank : aliased Thin.IC.char_array := convert (shared_key); skey_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (skey_tank'Unchecked_Access); product_size : Thin.IC.size_t := Thin.IC.size_t (Cipher_Length (plain_text_message)); product_tank : aliased Thin.IC.char_array := (1 .. product_size => Thin.IC.nul); product_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (product_tank'Unchecked_Access); begin res := Thin.crypto_box_easy_afternm (c => product_pointer, m => message_pointer, mlen => message_size, n => nonce_pointer, k => skey_pointer); return convert (product_tank); end Encrypt_Message; -------------------------- -- Encrypt_Message #2 -- -------------------------- function Encrypt_Message (plain_text_message : String; recipient_public_key : Public_Box_Key; sender_secret_key : Secret_Box_Key; unique_nonce : Box_Nonce) return Encrypted_Data is use type Thin.IC.size_t; res : Thin.IC.int; message_tank : aliased Thin.IC.char_array := convert (plain_text_message); message_size : Thin.NaCl_uint64 := Thin.NaCl_uint64 (message_tank'Length); message_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (message_tank'Unchecked_Access); nonce_tank : aliased Thin.IC.char_array := convert (unique_nonce); nonce_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (nonce_tank'Unchecked_Access); pkey_tank : aliased Thin.IC.char_array := convert (recipient_public_key); pkey_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (pkey_tank'Unchecked_Access); skey_tank : aliased Thin.IC.char_array := convert (sender_secret_key); skey_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (skey_tank'Unchecked_Access); product_size : Thin.IC.size_t := Thin.IC.size_t (Cipher_Length (plain_text_message)); product_tank : aliased Thin.IC.char_array := (1 .. product_size => Thin.IC.nul); product_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (product_tank'Unchecked_Access); begin res := Thin.crypto_box_easy (c => product_pointer, m => message_pointer, mlen => message_size, n => nonce_pointer, pk => pkey_pointer, sk => skey_pointer); return convert (product_tank); end Encrypt_Message; -------------------------- -- Decrypt_Message #1 -- -------------------------- function Decrypt_Message (ciphertext : Encrypted_Data; shared_key : Box_Shared_Key; unique_nonce : Box_Nonce) return String is use type Thin.IC.size_t; res : Thin.IC.int; cipher_tank : aliased Thin.IC.char_array := convert (ciphertext); cipher_size : Thin.NaCl_uint64 := Thin.NaCl_uint64 (cipher_tank'Length); cipher_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (cipher_tank'Unchecked_Access); nonce_tank : aliased Thin.IC.char_array := convert (unique_nonce); nonce_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (nonce_tank'Unchecked_Access); skey_tank : aliased Thin.IC.char_array := convert (shared_key); skey_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (skey_tank'Unchecked_Access); product_size : Thin.IC.size_t := Thin.IC.size_t (Clear_Text_Length (ciphertext)); product_tank : aliased Thin.IC.char_array := (1 .. product_size => Thin.IC.nul); product_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (product_tank'Unchecked_Access); begin res := Thin.crypto_box_open_easy_afternm (m => product_pointer, c => cipher_pointer, clen => cipher_size, n => nonce_pointer, k => skey_pointer); return convert (product_tank); end Decrypt_Message; -------------------------- -- Decrypt_Message #2 -- -------------------------- function Decrypt_Message (ciphertext : Encrypted_Data; sender_public_key : Public_Box_Key; recipient_secret_key : Secret_Box_Key; unique_nonce : Box_Nonce) return String is use type Thin.IC.size_t; res : Thin.IC.int; cipher_tank : aliased Thin.IC.char_array := convert (ciphertext); cipher_size : Thin.NaCl_uint64 := Thin.NaCl_uint64 (cipher_tank'Length); cipher_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (cipher_tank'Unchecked_Access); nonce_tank : aliased Thin.IC.char_array := convert (unique_nonce); nonce_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (nonce_tank'Unchecked_Access); pkey_tank : aliased Thin.IC.char_array := convert (sender_public_key); pkey_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (pkey_tank'Unchecked_Access); skey_tank : aliased Thin.IC.char_array := convert (recipient_secret_key); skey_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (skey_tank'Unchecked_Access); product_size : Thin.IC.size_t := Thin.IC.size_t (Clear_Text_Length (ciphertext)); product_tank : aliased Thin.IC.char_array := (1 .. product_size => Thin.IC.nul); product_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (product_tank'Unchecked_Access); begin res := Thin.crypto_box_open_easy (m => product_pointer, c => cipher_pointer, clen => cipher_size, n => nonce_pointer, pk => pkey_pointer, sk => skey_pointer); return convert (product_tank); end Decrypt_Message; --------------------- -- Cipher_Length -- --------------------- function Cipher_Length (plain_text_message : String) return Positive is begin return plain_text_message'Length + Positive (Thin.crypto_box_MACBYTES); end Cipher_Length; ------------------------- -- Clear_Text_Length -- ------------------------- function Clear_Text_Length (ciphertext : Encrypted_Data) return Positive is begin return ciphertext'Length - Positive (Thin.crypto_box_MACBYTES); end Clear_Text_Length; ---------------------------- -- Sealed_Cipher_Length -- ---------------------------- function Sealed_Cipher_Length (plain_text : String) return Positive is begin return plain_text'Length + Positive (Thin.crypto_box_SEALBYTES); end Sealed_Cipher_Length; -------------------------------- -- Sealed_Clear_Text_Length -- -------------------------------- function Sealed_Clear_Text_Length (ciphertext : Sealed_Data) return Positive is begin return ciphertext'Length - Positive (Thin.crypto_box_SEALBYTES); end Sealed_Clear_Text_Length; -------------------- -- Seal_Message -- -------------------- function Seal_Message (plain_text_message : String; recipient_public_key : Public_Box_Key) return Sealed_Data is use type Thin.IC.size_t; res : Thin.IC.int; message_tank : aliased Thin.IC.char_array := convert (plain_text_message); message_size : Thin.NaCl_uint64 := Thin.NaCl_uint64 (message_tank'Length); message_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (message_tank'Unchecked_Access); pkey_tank : aliased Thin.IC.char_array := convert (recipient_public_key); pkey_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (pkey_tank'Unchecked_Access); product_size : Thin.IC.size_t := Thin.IC.size_t (Sealed_Cipher_Length (plain_text_message)); product_tank : aliased Thin.IC.char_array := (1 .. product_size => Thin.IC.nul); product_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (product_tank'Unchecked_Access); begin res := Thin.crypto_box_seal (c => product_pointer, m => message_pointer, mlen => message_size, pk => pkey_pointer); return convert (product_tank); end Seal_Message; ---------------------- -- Unseal_Message -- ---------------------- function Unseal_Message (ciphertext : Sealed_Data; recipient_public_key : Public_Box_Key; recipient_secret_key : Secret_Box_Key) return String is use type Thin.IC.int; use type Thin.IC.size_t; res : Thin.IC.int; cipher_tank : aliased Thin.IC.char_array := convert (ciphertext); cipher_size : Thin.NaCl_uint64 := Thin.NaCl_uint64 (cipher_tank'Length); cipher_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (cipher_tank'Unchecked_Access); pkey_tank : aliased Thin.IC.char_array := convert (recipient_public_key); pkey_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (pkey_tank'Unchecked_Access); skey_tank : aliased Thin.IC.char_array := convert (recipient_secret_key); skey_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (skey_tank'Unchecked_Access); product_size : Thin.IC.size_t := Thin.IC.size_t (Sealed_Clear_Text_Length (ciphertext)); product_tank : aliased Thin.IC.char_array := (1 .. product_size => Thin.IC.nul); product_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (product_tank'Unchecked_Access); begin res := Thin.crypto_box_seal_open (m => product_pointer, c => cipher_pointer, clen => cipher_size, pk => pkey_pointer, sk => skey_pointer); if res = 0 then return convert (product_tank); end if; raise Sodium_Wrong_Recipient; end Unseal_Message; ------------------------------- -- Symmetric_Cipher_Length -- ------------------------------- function Symmetric_Cipher_Length (plain_text : String) return Positive is begin return plain_text'Length + Positive (Thin.crypto_secretbox_MACBYTES); end Symmetric_Cipher_Length; ----------------------------------- -- Symmetric_Clear_Text_Length -- ----------------------------------- function Symmetric_Clear_Text_Length (ciphertext : Encrypted_Data) return Positive is begin return ciphertext'Length - Positive (Thin.crypto_secretbox_MACBYTES); end Symmetric_Clear_Text_Length; ------------------------- -- Symmetric_Encrypt -- ------------------------- function Symmetric_Encrypt (clear_text : String; secret_key : Symmetric_Key; unique_nonce : Symmetric_Nonce) return Encrypted_Data is res : Thin.IC.int; message_tank : aliased Thin.IC.char_array := convert (clear_text); message_size : Thin.NaCl_uint64 := Thin.NaCl_uint64 (message_tank'Length); message_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (message_tank'Unchecked_Access); nonce_tank : aliased Thin.IC.char_array := convert (unique_nonce); nonce_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (nonce_tank'Unchecked_Access); skey_tank : aliased Thin.IC.char_array := convert (secret_key); skey_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (skey_tank'Unchecked_Access); product_size : Thin.IC.size_t := Thin.IC.size_t (Symmetric_Cipher_Length (clear_text)); product_tank : aliased Thin.IC.char_array := (1 .. product_size => Thin.IC.nul); product_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (product_tank'Unchecked_Access); begin res := Thin.crypto_secretbox_easy (c => product_pointer, m => message_pointer, mlen => message_size, n => nonce_pointer, k => skey_pointer); return convert (product_tank); end Symmetric_Encrypt; ------------------------- -- Symmetric_Decrypt -- ------------------------- function Symmetric_Decrypt (ciphertext : Encrypted_Data; secret_key : Symmetric_Key; unique_nonce : Symmetric_Nonce) return String is use type Thin.IC.int; res : Thin.IC.int; cipher_tank : aliased Thin.IC.char_array := convert (ciphertext); cipher_size : Thin.NaCl_uint64 := Thin.NaCl_uint64 (cipher_tank'Length); cipher_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (cipher_tank'Unchecked_Access); nonce_tank : aliased Thin.IC.char_array := convert (unique_nonce); nonce_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (nonce_tank'Unchecked_Access); skey_tank : aliased Thin.IC.char_array := convert (secret_key); skey_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (skey_tank'Unchecked_Access); product_size : Thin.IC.size_t := Thin.IC.size_t (Symmetric_Clear_Text_Length (ciphertext)); product_tank : aliased Thin.IC.char_array := (1 .. product_size => Thin.IC.nul); product_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (product_tank'Unchecked_Access); begin res := Thin.crypto_secretbox_open_easy (m => product_pointer, c => cipher_pointer, clen => cipher_size, n => nonce_pointer, k => skey_pointer); if res = 0 then return convert (product_tank); end if; raise Sodium_Symmetric_Failed with "Message forged or incorrect secret key"; end Symmetric_Decrypt; ----------------------------------- -- Generate_Authentication_Tag -- ----------------------------------- function Generate_Authentication_Tag (message : String; authentication_key : Auth_Key) return Auth_Tag is res : Thin.IC.int; message_tank : aliased Thin.IC.char_array := convert (message); message_size : Thin.NaCl_uint64 := Thin.NaCl_uint64 (message_tank'Length); message_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (message_tank'Unchecked_Access); skey_tank : aliased Thin.IC.char_array := convert (authentication_key); skey_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (skey_tank'Unchecked_Access); product_tank : aliased Thin.IC.char_array := (1 .. Auth_Tag'Length => Thin.IC.nul); product_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (product_tank'Unchecked_Access); begin res := Thin.crypto_auth (tag => product_pointer, text_in => message_pointer, inlen => message_size, k => skey_pointer); return convert (product_tank); end Generate_Authentication_Tag; ------------------------- -- Authentic_Message -- ------------------------- function Authentic_Message (message : String; authentication_tag : Auth_Tag; authentication_key : Auth_Key) return Boolean is use type Thin.IC.int; res : Thin.IC.int; message_tank : aliased Thin.IC.char_array := convert (message); message_size : Thin.NaCl_uint64 := Thin.NaCl_uint64 (message_tank'Length); message_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (message_tank'Unchecked_Access); skey_tank : aliased Thin.IC.char_array := convert (authentication_key); skey_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (skey_tank'Unchecked_Access); tag_tank : aliased Thin.IC.char_array := convert (authentication_tag); tag_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (tag_tank'Unchecked_Access); begin res := Thin.crypto_auth_verify (tag => tag_pointer, text_in => message_pointer, inlen => message_size, k => skey_pointer); return (res = 0); end Authentic_Message; ----------------------- -- increment_nonce -- ----------------------- procedure increment_nonce (nonce : in out String) is arrow : Natural := nonce'Last; value : Natural; FF : constant Character := Character'Val (16#FF#); ultimate : constant String (nonce'Range) := (others => FF); begin if nonce = ultimate then for z in nonce'Range loop nonce (z) := ASCII.NUL; end loop; return; end if; loop if nonce (arrow) = FF then nonce (arrow) := ASCII.NUL; arrow := arrow - 1; else value := Character'Pos (nonce (arrow)); nonce (arrow) := Character'Val (value + 1); exit; end if; end loop; end increment_nonce; -------------------------- -- AEAD_Cipher_Length -- -------------------------- function AEAD_Cipher_Length (plain_text : String; construction : AEAD_Construction := ChaCha20_Poly1305) return Positive is begin case construction is when ChaCha20_Poly1305 => return plain_text'Length + Positive (Thin.crypto_aead_chacha20poly1305_ABYTES); when ChaCha20_Poly1305_IETF => return plain_text'Length + Positive (Thin.crypto_aead_chacha20poly1305_ietf_ABYTES); when AES256_GCM => return plain_text'Length + Positive (Thin.crypto_aead_aes256gcm_ABYTES); end case; end AEAD_Cipher_Length; ------------------------------ -- AEAD_Clear_Text_Length -- ------------------------------ function AEAD_Clear_Text_Length (ciphertext : Encrypted_Data; construction : AEAD_Construction := ChaCha20_Poly1305) return Positive is begin case construction is when ChaCha20_Poly1305 => return ciphertext'Length - Positive (Thin.crypto_aead_chacha20poly1305_ABYTES); when ChaCha20_Poly1305_IETF => return ciphertext'Length - Positive (Thin.crypto_aead_chacha20poly1305_ietf_ABYTES); when AES256_GCM => return ciphertext'Length - Positive (Thin.crypto_aead_aes256gcm_ABYTES); end case; end AEAD_Clear_Text_Length; -------------------- -- AEAD_Encrypt -- -------------------- function AEAD_Encrypt (data_to_encrypt : String; additional_data : String; secret_key : AEAD_Key; unique_nonce : AEAD_Nonce; construction : AEAD_Construction := ChaCha20_Poly1305) return Encrypted_Data is res : Thin.IC.int; message_tank : aliased Thin.IC.char_array := convert (data_to_encrypt); message_size : Thin.NaCl_uint64 := Thin.NaCl_uint64 (message_tank'Length); message_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (message_tank'Unchecked_Access); metadata_tank : aliased Thin.IC.char_array := convert (additional_data); metadata_size : Thin.NaCl_uint64 := Thin.NaCl_uint64 (metadata_tank'Length); metadata_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (metadata_tank'Unchecked_Access); nonce_tank : aliased Thin.IC.char_array := convert (unique_nonce); nonce_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (nonce_tank'Unchecked_Access); skey_tank : aliased Thin.IC.char_array := convert (secret_key); skey_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (skey_tank'Unchecked_Access); product_size : Thin.IC.size_t := Thin.IC.size_t (AEAD_Cipher_Length (data_to_encrypt, construction)); product_tank : aliased Thin.IC.char_array := (1 .. product_size => Thin.IC.nul); product_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (product_tank'Unchecked_Access); product_realsize : aliased Thin.NaCl_uint64; begin case construction is when ChaCha20_Poly1305 => res := Thin.crypto_aead_chacha20poly1305_encrypt (c => product_pointer, clen_p => product_realsize'Unchecked_Access, m => message_pointer, mlen => message_size, ad => metadata_pointer, adlen => metadata_size, nsec => Thin.ICS.Null_Ptr, npub => nonce_pointer, k => skey_pointer); when ChaCha20_Poly1305_IETF => res := Thin.crypto_aead_chacha20poly1305_ietf_encrypt (c => product_pointer, clen_p => product_realsize'Unchecked_Access, m => message_pointer, mlen => message_size, ad => metadata_pointer, adlen => metadata_size, nsec => Thin.ICS.Null_Ptr, npub => nonce_pointer, k => skey_pointer); when AES256_GCM => res := Thin.crypto_aead_aes256gcm_encrypt (c => product_pointer, clen_p => product_realsize'Unchecked_Access, m => message_pointer, mlen => message_size, ad => metadata_pointer, adlen => metadata_size, nsec => Thin.ICS.Null_Ptr, npub => nonce_pointer, k => skey_pointer); end case; declare result : constant String := convert (product_tank); begin return result (1 .. Natural (product_realsize)); end; end AEAD_Encrypt; -------------------- -- AEAD_Decrypt -- -------------------- function AEAD_Decrypt (ciphertext : Encrypted_Data; additional_data : String; secret_key : AEAD_Key; unique_nonce : AEAD_Nonce; construction : AEAD_Construction := ChaCha20_Poly1305) return String is use type Thin.IC.int; res : Thin.IC.int; cipher_tank : aliased Thin.IC.char_array := convert (ciphertext); cipher_size : Thin.NaCl_uint64 := Thin.NaCl_uint64 (cipher_tank'Length); cipher_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (cipher_tank'Unchecked_Access); metadata_tank : aliased Thin.IC.char_array := convert (additional_data); metadata_size : Thin.NaCl_uint64 := Thin.NaCl_uint64 (metadata_tank'Length); metadata_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (metadata_tank'Unchecked_Access); nonce_tank : aliased Thin.IC.char_array := convert (unique_nonce); nonce_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (nonce_tank'Unchecked_Access); skey_tank : aliased Thin.IC.char_array := convert (secret_key); skey_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (skey_tank'Unchecked_Access); product_size : Thin.IC.size_t := Thin.IC.size_t (AEAD_Clear_Text_Length (ciphertext, construction)); product_tank : aliased Thin.IC.char_array := (1 .. product_size => Thin.IC.nul); product_pointer : Thin.ICS.chars_ptr := Thin.ICS.To_Chars_Ptr (product_tank'Unchecked_Access); product_realsize : aliased Thin.NaCl_uint64; begin case construction is when ChaCha20_Poly1305 => res := Thin.crypto_aead_chacha20poly1305_decrypt (m => product_pointer, mlen_p => product_realsize'Unchecked_Access, nsec => Thin.ICS.Null_Ptr, c => cipher_pointer, clen => cipher_size, ad => metadata_pointer, adlen => metadata_size, npub => nonce_pointer, k => skey_pointer); when ChaCha20_Poly1305_IETF => res := Thin.crypto_aead_chacha20poly1305_ietf_decrypt (m => product_pointer, mlen_p => product_realsize'Unchecked_Access, nsec => Thin.ICS.Null_Ptr, c => cipher_pointer, clen => cipher_size, ad => metadata_pointer, adlen => metadata_size, npub => nonce_pointer, k => skey_pointer); when AES256_GCM => res := Thin.crypto_aead_aes256gcm_decrypt (m => product_pointer, mlen_p => product_realsize'Unchecked_Access, nsec => Thin.ICS.Null_Ptr, c => cipher_pointer, clen => cipher_size, ad => metadata_pointer, adlen => metadata_size, npub => nonce_pointer, k => skey_pointer); end case; if res = 0 then declare result : constant String := convert (product_tank); begin return result (1 .. Natural (product_realsize)); end; end if; raise Sodium_AEAD_Failed with "Message verification failed"; end AEAD_Decrypt; ---------------------------- -- AES256_GCM_Available -- ---------------------------- function AES256_GCM_Available return Boolean is use type Thin.IC.int; res : Thin.IC.int; begin res := Thin.crypto_aead_aes256gcm_is_available; return (res = 1); end AES256_GCM_Available; end Sodium.Functions;
src/fltk-widgets-valuators-adjusters.ads
micahwelf/FLTK-Ada
1
8219
package FLTK.Widgets.Valuators.Adjusters is type Adjuster is new Valuator with private; type Adjuster_Reference (Data : not null access Adjuster'Class) is limited null record with Implicit_Dereference => Data; package Forge is function Create (X, Y, W, H : in Integer; Text : in String) return Adjuster; end Forge; function Is_Soft (This : in Adjuster) return Boolean; procedure Set_Soft (This : in out Adjuster; To : in Boolean); procedure Draw (This : in out Adjuster); function Handle (This : in out Adjuster; Event : in Event_Kind) return Event_Outcome; private type Adjuster is new Valuator with null record; overriding procedure Finalize (This : in out Adjuster); pragma Inline (Is_Soft); pragma Inline (Set_Soft); pragma Inline (Draw); pragma Inline (Handle); end FLTK.Widgets.Valuators.Adjusters;
ListThms.agda
amal029/agda-tutorial-dybjer
1
620
module ListThms where open import Sec4 import Sec2 {- Definition of a list -} data List (A : Set) : Set where [] : List A -- Empty list _∷_ : A → List A → List A -- Cons infixr 4 _∷_ -- Proposition stating what is a non empty list nelist : {A : Set} → (List A) → Prop nelist [] = ⊥ nelist (x ∷ x₁) = ⊤ -- Head function that only works on non empty list head : {A : Set} → (l : List A) → (p : nelist l) → A head [] () -- This can never happen head (x ∷ _) ⋆ = x -- This is the head of the list -- The tail of the list only works on non empty list tail : {A : Set} → (l : List A) → (p : nelist l) → (List A) tail [] () tail (_ ∷ l) ⋆ = l -- definition of a map map : {A B : Set} → (A → B) → (List A) → List B map f [] = [] map f (x ∷ l) = (f x) ∷ map f l -- definition of fold left fold : {A B : Set} → (A → B → B) → B → (List A) → B fold f x [] = x fold f x (x₁ ∷ l) = fold f (f x₁ x) l -- reduce only works on lists of length > 0 reduce : {A : Set} → (l : List A) → (p : nelist l) → (A → A → A) → A reduce [] () reduce (x ∷ l) _ f = fold f x l -- length of a list length : {A : Set} → (List A) → Sec2.ℕ length [] = Sec2.Z length (x ∷ l) = (Sec2.S Sec2.Z) Sec2.+ (length l) -- Proposition on ≤ _<=_ : Sec2.ℕ → Sec2.ℕ → Prop Sec2.Z <= Sec2.Z = ⊤ Sec2.Z <= Sec2.S y = ⊤ Sec2.S x <= y = x <= y _>=_ : Sec2.ℕ → Sec2.ℕ → Prop Sec2.Z >= Sec2.Z = ⊤ Sec2.Z >= Sec2.S y = ⊥ Sec2.S x >= y = x >= y -- Indexing into the list _!!_ : {A : Set} → ∀ (l : List A) → ∀ (i : Sec2.ℕ) → (nelist l) → Exists A (λ _ → ((i >= Sec2.Z) ∧ (i <= (length l)))) ([] !! i) () ((x ∷ l) !! i) ⋆ = [ x , (and (lem1 i) (lem (x ∷ l) i))] where cong-<= : (x y : Sec2.ℕ) → (x <= y) → (x <= Sec2.S y) cong-<= Sec2.Z y p = ⋆ cong-<= (Sec2.S x) Sec2.Z p = cong-<= x Sec2.Z p cong-<= (Sec2.S x) (Sec2.S y) p = cong-<= x (Sec2.S y) p lem1 : (i : Sec2.ℕ) → (i >= Sec2.Z) lem1 Sec2.Z = ⋆ lem1 (Sec2.S i) = lem1 i lem2 : (i : Sec2.ℕ) → (i <= Sec2.Z) lem2 Sec2.Z = ⋆ lem2 (Sec2.S i₁) = lem2 i₁ lem : {A : Set} → (l : List A) → (i : Sec2.ℕ) → (i <= (length l)) lem [] Sec2.Z = ⋆ lem [] (Sec2.S i) = lem2 i lem (x₁ ∷ l₁) i = cong-<= i (length l₁) (lem l₁ i) data Maybe (A : Set) : Set where Nothing : Maybe A Just : A → Maybe A index : {A : Set} → ∀ (l : List A) → (nelist l) → ∀ (i : Sec2.ℕ) → Sec2.So ((i Sec2.≥ Sec2.Z) Sec2.& (i Sec2.< (length l))) → Maybe A index l _ i _ = index' l i (Sec2.Z) where index' : {A : Set} → ∀ (l : List A) → ∀(i : Sec2.ℕ) → (c : Sec2.ℕ) → Maybe A index' [] i₁ c = Nothing index' (x₁ ∷ l₁) i₁ c with (i₁ Sec2.== c) index' (x₁ ∷ l₁) i₁ c | Sec2.T = Just x₁ index' (x₁ ∷ l₁) i₁ c | Sec2.F = index' l₁ i₁ (Sec2.S c) exx1 : Maybe Sec2.ℕ exx1 = index (1 ∷ []) ⋆ 0 Sec2.ok index'' : {A : Set} → ∀ (l : List A) → ∀ (i : Sec2.ℕ) → Sec2.So (i Sec2.< (length l)) → A index'' [] Sec2.Z () index'' [] (Sec2.S i) () index'' (x ∷ l) Sec2.Z Sec2.ok = x index'' (x ∷ l) (Sec2.S i) p = index'' l i p -- append two lists _++_ : {A : Set} → (l : List A) → (l' : List A) → (List A) [] ++ l' = l' (x ∷ l) ++ l' = (x ∷ (l ++ l')) -- composition of two functions _∘_ : {A B C : Set} → (A → B) → (B → C) → (A → C) f ∘ g = λ x → (g (f x)) cong : {A : Set} → (x : A) → (l m : List A) → (l Sec2.≡ m) → (x ∷ l) Sec2.≡ (x ∷ m) cong x l .l Sec2.refl = Sec2.refl cong2 : {A : Set} → (l m q : List A) → (l Sec2.≡ m) → (l ++ q) Sec2.≡ (m ++ q) cong2 l .l q Sec2.refl = Sec2.refl thm1-map : {A B : Set} → (f : A → B) → (l : List A) → (m : List A) → (map f (l ++ m)) Sec2.≡ (map f l) ++ (map f m) thm1-map f [] m = Sec2.refl thm1-map f (x ∷ l) m with (f x) thm1-map f (x ∷ l) m | p = cong p (map f (l ++ m)) (map f l ++ map f m) (thm1-map f l m) -- map ∘ thm2-map : {A B C : Set} → (f : A → B) → (g : B → C) → (l : List A) → (map (f ∘ g) l Sec2.≡ ((map f) ∘ (map g)) l) thm2-map f₁ g₁ [] = Sec2.refl thm2-map f₁ g₁ (x ∷ l) with (thm2-map f₁ g₁ l) thm2-map f₁ g₁ (x ∷ l) | p = cong (g₁ (f₁ x)) (map (λ z → g₁ (f₁ z)) l) (map g₁ (map f₁ l)) p -- Non empty list by construction data NeList (A : Set) : Set where ^_^ : A → NeList A _∶_ : A → NeList A → NeList A infixr 60 ^_^ infixr 60 _∶_ -- XXX: Prove these in Coq along with the other theorem from <NAME>'s -- tutorial in Agda.
oeis/119/A119786.asm
neoneye/loda-programs
11
9354
; A119786: Numerator of the product of the n-th triangular number and the n-th harmonic number. ; Submitted by <NAME> ; 1,9,11,125,137,1029,363,6849,7129,81191,83711,1118273,1145993,1171733,1195757,41421503,42142223,813635157,275295799,279175675,56574159,439143531,1332950097,33695573875,34052522467,309561680403,312536252003,9146733078187,9227046511387,288445167734557,290774257297357,586061125622639,590436990861839,54062195834749,54437269998109,2027671241084233,2040798836801833,2053580969474233,2066035355155033,85205313628946333,85691034670497533,3705103209789840719,5853599356775405587,5884182435213075787 add $0,1 mov $2,1 mov $3,$0 lpb $3 mul $1,$3 add $4,1 mul $2,$4 add $1,$2 sub $3,1 add $0,$3 mov $4,$3 lpe mul $1,$0 gcd $2,$1 div $1,$2 mov $0,$1
NT.g4
aucampia/rdf4go
1
2970
<gh_stars>1-10 // SPDX-FileCopyrightText: 2021 <NAME> // // SPDX-License-Identifier: CC0-1.0 OR Apache-2.0 // https://www.w3.org/TR/n-triples/#n-triples-grammar // https://www.dajobe.org/2001/06/ntriples/ grammar NT; // https://github.com/antlr/antlr4/blob/master/doc/parser-rules.md //ntriplesDoc: triple? (EOL triple)* EOL?; ntriplesDoc: line (EOL line)* EOL?; line: triple? comment?; comment: WS* COMMENT; triple: WS* subject WS* predicate WS* object WS* '.'; subject: IRIREF | BLANK_NODE_LABEL; predicate: IRIREF; object: IRIREF | BLANK_NODE_LABEL | literal; literal: STRING_LITERAL_QUOTE ( '^^' IRIREF | LANGTAG)?; // https://github.com/antlr/antlr4/blob/master/doc/lexer-rules.md COMMENT : '#' (~[\r\n]+)* ; LANGTAG: '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)*; EOL: [\r\n]+; IRIREF: '<' ( PN_CHARS | '.' | ':' | '/' | '\\' | '#' | '@' | '%' | '&' | UCHAR )* '>'; STRING_LITERAL_QUOTE: '"' (~ ["\\\r\n] | '\'' | '\\"')* '"'; BLANK_NODE_LABEL: '_:' (PN_CHARS_U | [0-9]) ((PN_CHARS | '.')* PN_CHARS)?; UCHAR: '\\u' HEX HEX HEX HEX | '\\U' HEX HEX HEX HEX HEX HEX HEX HEX; ECHAR: '\\' [tbnrf"'\\]; PN_CHARS_BASE: [A-Z] | [a-z] | '\u00C0' .. '\u00D6' | '\u00D8' .. '\u00F6' | '\u00F8' .. '\u02FF' | '\u0370' .. '\u037D' | '\u037F' .. '\u1FFF' | '\u200C' .. '\u200D' | '\u2070' .. '\u218F' | '\u2C00' .. '\u2FEF' | '\u3001' .. '\uD7FF' | '\uF900' .. '\uFDCF' | '\uFDF0' .. '\uFFFD' | '\u{10000}' .. '\u{EFFFF}'; PN_CHARS_U: PN_CHARS_BASE | '_' | ':'; PN_CHARS: PN_CHARS_U | '-' | [0-9] | '\u00B7' | '\u0300' .. '\u036F' | '\u203F' .. '\u2040'; HEX: [0-9] | [A-F] | [a-f]; WS: [ \t];
wasm/part0701/main.asm
Bigsby/slae
0
16320
.386 .model flat, stdcall option casemap :none include \masm32\include\windows.inc include \masm32\include\kernel32.inc include \masm32\include\masm32.inc includelib \masm32\lib\kernel32.lib includelib \masm32\lib\masm32.lib .data SampleString db "The string to invert.", 0 TempString db 2 DUP(0) .code start: invoke szLen, addr SampleString PrintNextChar: xor ebx, ebx mov bl, SampleString[eax-1] mov TempString, bl push eax invoke StdOut, addr TempString pop eax dec eax jne PrintNextChar invoke ExitProcess, 0 end start