max_stars_repo_path
stringlengths
4
261
max_stars_repo_name
stringlengths
6
106
max_stars_count
int64
0
38.8k
id
stringlengths
1
6
text
stringlengths
7
1.05M
src/lang/stemmer-portuguese.adb
stcarrez/ada-stemmer
3
25451
-- Generated by Snowball 2.2.0 - https://snowballstem.org/ package body Stemmer.Portuguese is pragma Style_Checks ("-mr"); pragma Warnings (Off, "*variable*is never read and never assigned*"); pragma Warnings (Off, "*mode could be*instead of*"); pragma Warnings (Off, "*formal parameter.*is not modified*"); pragma Warnings (Off, "*this line is too long*"); pragma Warnings (Off, "*is not referenced*"); procedure R_Residual_form (Z : in out Context_Type; Result : out Boolean); procedure R_Residual_suffix (Z : in out Context_Type; Result : out Boolean); procedure R_Verb_suffix (Z : in out Context_Type; Result : out Boolean); procedure R_Standard_suffix (Z : in out Context_Type; Result : out Boolean); procedure R_R2 (Z : in out Context_Type; Result : out Boolean); procedure R_R1 (Z : in out Context_Type; Result : out Boolean); procedure R_RV (Z : in out Context_Type; Result : out Boolean); procedure R_Mark_regions (Z : in out Context_Type; Result : out Boolean); procedure R_Postlude (Z : in out Context_Type; Result : out Boolean); procedure R_Prelude (Z : in out Context_Type; Result : out Boolean); G_V : constant Grouping_Array (0 .. 159) := ( True, False, False, False, True, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, True, False, False, False, False, False, False, True, True, False, False, True, False, False, False, False, False, True, True, False, False, False, False, False, True, False, False, False, False, False, False ); Among_String : constant String := "" & "ã" & "õ" & "" & "a~" & "o~" & "ic" & "ad" & "os" & "iv" & "ante" & "avel" & "ível" & "ic" & "abil" & "iv" & "ica" & "ância" & "ência" & "logia" & "ira" & "adora" & "osa" & "ista" & "iva" & "eza" & "idade" & "ante" & "mente" & "amente" & "ável" & "ível" & "ico" & "ismo" & "oso" & "amento" & "imento" & "ivo" & "aça~o" & "uça~o" & "ador" & "icas" & "ências" & "logias" & "iras" & "adoras" & "osas" & "istas" & "ivas" & "ezas" & "idades" & "adores" & "antes" & "aço~es" & "uço~es" & "icos" & "ismos" & "osos" & "amentos" & "imentos" & "ivos" & "ada" & "ida" & "ia" & "aria" & "eria" & "iria" & "ara" & "era" & "ira" & "ava" & "asse" & "esse" & "isse" & "aste" & "este" & "iste" & "ei" & "arei" & "erei" & "irei" & "am" & "iam" & "ariam" & "eriam" & "iriam" & "aram" & "eram" & "iram" & "avam" & "em" & "arem" & "erem" & "irem" & "assem" & "essem" & "issem" & "ado" & "ido" & "ando" & "endo" & "indo" & "ara~o" & "era~o" & "ira~o" & "ar" & "er" & "ir" & "as" & "adas" & "idas" & "ias" & "arias" & "erias" & "irias" & "aras" & "eras" & "iras" & "avas" & "es" & "ardes" & "erdes" & "irdes" & "ares" & "eres" & "ires" & "asses" & "esses" & "isses" & "astes" & "estes" & "istes" & "is" & "ais" & "eis" & "areis" & "ereis" & "ireis" & "áreis" & "éreis" & "íreis" & "ásseis" & "ésseis" & "ísseis" & "áveis" & "íeis" & "aríeis" & "eríeis" & "iríeis" & "ados" & "idos" & "amos" & "áramos" & "éramos" & "íramos" & "ávamos" & "íamos" & "aríamos" & "eríamos" & "iríamos" & "emos" & "aremos" & "eremos" & "iremos" & "ássemos" & "êssemos" & "íssemos" & "imos" & "armos" & "ermos" & "irmos" & "ámos" & "arás" & "erás" & "irás" & "eu" & "iu" & "ou" & "ará" & "erá" & "irá" & "a" & "i" & "o" & "os" & "á" & "í" & "ó" & "e" & "ç" & "é" & "ê"; A_0 : constant Among_Array_Type (0 .. 2) := ( (1, 0, -1, 3, 0), (1, 2, 0, 1, 0), (3, 4, 0, 2, 0)); A_1 : constant Among_Array_Type (0 .. 2) := ( (5, 4, -1, 3, 0), (5, 6, 0, 1, 0), (7, 8, 0, 2, 0)); A_2 : constant Among_Array_Type (0 .. 3) := ( (9, 10, -1, -1, 0), (11, 12, -1, -1, 0), (13, 14, -1, -1, 0), (15, 16, -1, 1, 0)); A_3 : constant Among_Array_Type (0 .. 2) := ( (17, 20, -1, 1, 0), (21, 24, -1, 1, 0), (25, 29, -1, 1, 0)); A_4 : constant Among_Array_Type (0 .. 2) := ( (30, 31, -1, 1, 0), (32, 35, -1, 1, 0), (36, 37, -1, 1, 0)); A_5 : constant Among_Array_Type (0 .. 44) := ( (38, 40, -1, 1, 0), (41, 46, -1, 1, 0), (47, 52, -1, 4, 0), (53, 57, -1, 2, 0), (58, 60, -1, 9, 0), (61, 65, -1, 1, 0), (66, 68, -1, 1, 0), (69, 72, -1, 1, 0), (73, 75, -1, 8, 0), (76, 78, -1, 1, 0), (79, 83, -1, 7, 0), (84, 87, -1, 1, 0), (88, 92, -1, 6, 0), (93, 98, 12, 5, 0), (99, 103, -1, 1, 0), (104, 108, -1, 1, 0), (109, 111, -1, 1, 0), (112, 115, -1, 1, 0), (116, 118, -1, 1, 0), (119, 124, -1, 1, 0), (125, 130, -1, 1, 0), (131, 133, -1, 8, 0), (134, 139, -1, 1, 0), (140, 145, -1, 3, 0), (146, 149, -1, 1, 0), (150, 153, -1, 1, 0), (154, 160, -1, 4, 0), (161, 166, -1, 2, 0), (167, 170, -1, 9, 0), (171, 176, -1, 1, 0), (177, 180, -1, 1, 0), (181, 185, -1, 1, 0), (186, 189, -1, 8, 0), (190, 193, -1, 1, 0), (194, 199, -1, 7, 0), (200, 205, -1, 1, 0), (206, 210, -1, 1, 0), (211, 217, -1, 1, 0), (218, 224, -1, 3, 0), (225, 228, -1, 1, 0), (229, 233, -1, 1, 0), (234, 237, -1, 1, 0), (238, 244, -1, 1, 0), (245, 251, -1, 1, 0), (252, 255, -1, 8, 0)); A_6 : constant Among_Array_Type (0 .. 119) := ( (256, 258, -1, 1, 0), (259, 261, -1, 1, 0), (262, 263, -1, 1, 0), (264, 267, 2, 1, 0), (268, 271, 2, 1, 0), (272, 275, 2, 1, 0), (276, 278, -1, 1, 0), (279, 281, -1, 1, 0), (282, 284, -1, 1, 0), (285, 287, -1, 1, 0), (288, 291, -1, 1, 0), (292, 295, -1, 1, 0), (296, 299, -1, 1, 0), (300, 303, -1, 1, 0), (304, 307, -1, 1, 0), (308, 311, -1, 1, 0), (312, 313, -1, 1, 0), (314, 317, 16, 1, 0), (318, 321, 16, 1, 0), (322, 325, 16, 1, 0), (326, 327, -1, 1, 0), (328, 330, 20, 1, 0), (331, 335, 21, 1, 0), (336, 340, 21, 1, 0), (341, 345, 21, 1, 0), (346, 349, 20, 1, 0), (350, 353, 20, 1, 0), (354, 357, 20, 1, 0), (358, 361, 20, 1, 0), (362, 363, -1, 1, 0), (364, 367, 29, 1, 0), (368, 371, 29, 1, 0), (372, 375, 29, 1, 0), (376, 380, 29, 1, 0), (381, 385, 29, 1, 0), (386, 390, 29, 1, 0), (391, 393, -1, 1, 0), (394, 396, -1, 1, 0), (397, 400, -1, 1, 0), (401, 404, -1, 1, 0), (405, 408, -1, 1, 0), (409, 413, -1, 1, 0), (414, 418, -1, 1, 0), (419, 423, -1, 1, 0), (424, 425, -1, 1, 0), (426, 427, -1, 1, 0), (428, 429, -1, 1, 0), (430, 431, -1, 1, 0), (432, 435, 47, 1, 0), (436, 439, 47, 1, 0), (440, 442, 47, 1, 0), (443, 447, 50, 1, 0), (448, 452, 50, 1, 0), (453, 457, 50, 1, 0), (458, 461, 47, 1, 0), (462, 465, 47, 1, 0), (466, 469, 47, 1, 0), (470, 473, 47, 1, 0), (474, 475, -1, 1, 0), (476, 480, 58, 1, 0), (481, 485, 58, 1, 0), (486, 490, 58, 1, 0), (491, 494, 58, 1, 0), (495, 498, 58, 1, 0), (499, 502, 58, 1, 0), (503, 507, 58, 1, 0), (508, 512, 58, 1, 0), (513, 517, 58, 1, 0), (518, 522, 58, 1, 0), (523, 527, 58, 1, 0), (528, 532, 58, 1, 0), (533, 534, -1, 1, 0), (535, 537, 71, 1, 0), (538, 540, 71, 1, 0), (541, 545, 73, 1, 0), (546, 550, 73, 1, 0), (551, 555, 73, 1, 0), (556, 561, 73, 1, 0), (562, 567, 73, 1, 0), (568, 573, 73, 1, 0), (574, 580, 73, 1, 0), (581, 587, 73, 1, 0), (588, 594, 73, 1, 0), (595, 600, 73, 1, 0), (601, 605, 73, 1, 0), (606, 612, 84, 1, 0), (613, 619, 84, 1, 0), (620, 626, 84, 1, 0), (627, 630, -1, 1, 0), (631, 634, -1, 1, 0), (635, 638, -1, 1, 0), (639, 645, 90, 1, 0), (646, 652, 90, 1, 0), (653, 659, 90, 1, 0), (660, 666, 90, 1, 0), (667, 672, 90, 1, 0), (673, 680, 95, 1, 0), (681, 688, 95, 1, 0), (689, 696, 95, 1, 0), (697, 700, -1, 1, 0), (701, 706, 99, 1, 0), (707, 712, 99, 1, 0), (713, 718, 99, 1, 0), (719, 726, 99, 1, 0), (727, 734, 99, 1, 0), (735, 742, 99, 1, 0), (743, 746, -1, 1, 0), (747, 751, -1, 1, 0), (752, 756, -1, 1, 0), (757, 761, -1, 1, 0), (762, 766, -1, 1, 0), (767, 771, -1, 1, 0), (772, 776, -1, 1, 0), (777, 781, -1, 1, 0), (782, 783, -1, 1, 0), (784, 785, -1, 1, 0), (786, 787, -1, 1, 0), (788, 791, -1, 1, 0), (792, 795, -1, 1, 0), (796, 799, -1, 1, 0)); A_7 : constant Among_Array_Type (0 .. 6) := ( (800, 800, -1, 1, 0), (801, 801, -1, 1, 0), (802, 802, -1, 1, 0), (803, 804, -1, 1, 0), (805, 806, -1, 1, 0), (807, 808, -1, 1, 0), (809, 810, -1, 1, 0)); A_8 : constant Among_Array_Type (0 .. 3) := ( (811, 811, -1, 1, 0), (812, 813, -1, 2, 0), (814, 815, -1, 1, 0), (816, 817, -1, 1, 0)); procedure R_Prelude (Z : in out Context_Type; Result : out Boolean) is C : Result_Index; A : Integer; v_1 : Char_Index; begin -- repeat, line 36 <<lab0>> loop v_1 := Z.C; -- (, line 36 Z.Bra := Z.C; -- [, line 37 -- substring, line 37 if Z.C + 1 >= Z.L or else (Character'Pos (Z.P (Z.C + 1 + 1)) /= 163 and then Character'Pos (Z.P (Z.C + 1 + 1)) /= 181) then A := 3; else -- substring, line 37 Find_Among (Z, A_0, Among_String, null, A); if A = 0 then goto lab1; end if; end if; Z.Ket := Z.C; -- ], line 37 -- among, line 37 case A is when 1 => -- (, line 38 -- <-, line 38 Slice_From (Z, "a~"); when 2 => -- (, line 39 -- <-, line 39 Slice_From (Z, "o~"); when 3 => -- (, line 40 -- next, line 40 C := Skip_Utf8 (Z); if C < 0 then goto lab1; end if; Z.C := C; when others => null; end case; goto lab0; <<lab1>> Z.C := v_1; exit; end loop; Result := True; end R_Prelude; procedure R_Mark_regions (Z : in out Context_Type; Result : out Boolean) is C : Result_Index; A : Integer; v_1 : Char_Index; v_2 : Char_Index; v_3 : Char_Index; v_4 : Char_Index; v_5 : Char_Index; begin -- (, line 44 Z.I_PV := Z.L; Z.I_P1 := Z.L; Z.I_P2 := Z.L; -- do, line 50 v_1 := Z.C; -- (, line 50 -- or, line 52 v_2 := Z.C; -- (, line 51 In_Grouping (Z, G_V, 97, 250, False, C); if C /= 0 then goto lab2; end if; -- or, line 51 v_3 := Z.C; -- (, line 51 Out_Grouping (Z, G_V, 97, 250, False, C); if C /= 0 then goto lab4; end if; -- gopast, line 51 -- grouping v, line 51 Out_Grouping (Z, G_V, 97, 250, True, C); if C < 0 then goto lab4; end if; Z.C := Z.C + C; goto lab3; <<lab4>> Z.C := v_3; -- (, line 51 In_Grouping (Z, G_V, 97, 250, False, C); if C /= 0 then goto lab2; end if; -- gopast, line 51 -- non v, line 51 In_Grouping (Z, G_V, 97, 250, True, C); if C < 0 then goto lab2; end if; Z.C := Z.C + C; <<lab3>> goto lab1; <<lab2>> Z.C := v_2; -- (, line 53 Out_Grouping (Z, G_V, 97, 250, False, C); if C /= 0 then goto lab0; end if; -- or, line 53 v_4 := Z.C; -- (, line 53 Out_Grouping (Z, G_V, 97, 250, False, C); if C /= 0 then goto lab8; end if; -- gopast, line 53 -- grouping v, line 53 Out_Grouping (Z, G_V, 97, 250, True, C); if C < 0 then goto lab8; end if; Z.C := Z.C + C; goto lab7; <<lab8>> Z.C := v_4; -- (, line 53 In_Grouping (Z, G_V, 97, 250, False, C); if C /= 0 then goto lab0; end if; -- next, line 53 C := Skip_Utf8 (Z); if C < 0 then goto lab0; end if; Z.C := C; <<lab7>> <<lab1>> -- setmark pV, line 54 Z.I_PV := Z.C; <<lab0>> Z.C := v_1; -- do, line 56 v_5 := Z.C; -- (, line 56 -- gopast, line 57 -- grouping v, line 57 Out_Grouping (Z, G_V, 97, 250, True, C); if C < 0 then goto lab10; end if; Z.C := Z.C + C; -- gopast, line 57 -- non v, line 57 In_Grouping (Z, G_V, 97, 250, True, C); if C < 0 then goto lab10; end if; Z.C := Z.C + C; -- setmark p1, line 57 Z.I_P1 := Z.C; -- gopast, line 58 -- grouping v, line 58 Out_Grouping (Z, G_V, 97, 250, True, C); if C < 0 then goto lab10; end if; Z.C := Z.C + C; -- gopast, line 58 -- non v, line 58 In_Grouping (Z, G_V, 97, 250, True, C); if C < 0 then goto lab10; end if; Z.C := Z.C + C; -- setmark p2, line 58 Z.I_P2 := Z.C; <<lab10>> Z.C := v_5; Result := True; end R_Mark_regions; procedure R_Postlude (Z : in out Context_Type; Result : out Boolean) is C : Result_Index; A : Integer; v_1 : Char_Index; begin -- repeat, line 62 <<lab0>> loop v_1 := Z.C; -- (, line 62 Z.Bra := Z.C; -- [, line 63 -- substring, line 63 if Z.C + 1 >= Z.L or else Character'Pos (Z.P (Z.C + 1 + 1)) /= 126 then A := 3; else -- substring, line 63 Find_Among (Z, A_1, Among_String, null, A); if A = 0 then goto lab1; end if; end if; Z.Ket := Z.C; -- ], line 63 -- among, line 63 case A is when 1 => -- (, line 64 -- <-, line 64 Slice_From (Z, "ã"); when 2 => -- (, line 65 -- <-, line 65 Slice_From (Z, "õ"); when 3 => -- (, line 66 -- next, line 66 C := Skip_Utf8 (Z); if C < 0 then goto lab1; end if; Z.C := C; when others => null; end case; goto lab0; <<lab1>> Z.C := v_1; exit; end loop; Result := True; end R_Postlude; procedure R_RV (Z : in out Context_Type; Result : out Boolean) is begin Result := (Z.I_PV <= Z.C); end R_RV; procedure R_R1 (Z : in out Context_Type; Result : out Boolean) is begin Result := (Z.I_P1 <= Z.C); end R_R1; procedure R_R2 (Z : in out Context_Type; Result : out Boolean) is begin Result := (Z.I_P2 <= Z.C); end R_R2; procedure R_Standard_suffix (Z : in out Context_Type; Result : out Boolean) is C : Result_Index; A : Integer; v_1 : Char_Index; v_2 : Char_Index; v_3 : Char_Index; v_4 : Char_Index; begin -- (, line 76 Z.Ket := Z.C; -- [, line 77 -- substring, line 77 if Z.C - 2 <= Z.Lb or else Check_Among (Z, Z.C - 1, 3, 16#c9022#) then Result := False; return; -- substring, line 77 end if; Find_Among_Backward (Z, A_5, Among_String, null, A); if A = 0 then Result := False; return; end if; Z.Bra := Z.C; -- ], line 77 -- among, line 77 case A is when 1 => -- (, line 92 -- call R2, line 93 R_R2 (Z, Result); if not Result then Result := False; return; end if; -- delete, line 93 Slice_Del (Z); when 2 => -- (, line 97 -- call R2, line 98 R_R2 (Z, Result); if not Result then Result := False; return; end if; -- <-, line 98 Slice_From (Z, "log"); when 3 => -- (, line 101 -- call R2, line 102 R_R2 (Z, Result); if not Result then Result := False; return; end if; -- <-, line 102 Slice_From (Z, "u"); when 4 => -- (, line 105 -- call R2, line 106 R_R2 (Z, Result); if not Result then Result := False; return; end if; -- <-, line 106 Slice_From (Z, "ente"); when 5 => -- (, line 109 -- call R1, line 110 R_R1 (Z, Result); if not Result then Result := False; return; end if; -- delete, line 110 Slice_Del (Z); -- try, line 111 v_1 := Z.L - Z.C; -- (, line 111 Z.Ket := Z.C; -- [, line 112 -- substring, line 112 if Z.C - 1 <= Z.Lb or else Check_Among (Z, Z.C - 1, 3, 16#480018#) then Z.C := Z.L - v_1; goto lab0; -- substring, line 112 end if; Find_Among_Backward (Z, A_2, Among_String, null, A); if A = 0 then Z.C := Z.L - v_1; goto lab0; end if; Z.Bra := Z.C; -- ], line 112 -- call R2, line 112 R_R2 (Z, Result); if not Result then Z.C := Z.L - v_1; goto lab0; end if; -- delete, line 112 Slice_Del (Z); -- among, line 112 case A is when 1 => -- (, line 113 Z.Ket := Z.C; -- [, line 113 -- literal, line 113 C := Eq_S_Backward (Z, "at"); if C = 0 then Z.C := Z.L - v_1; goto lab0; end if; Z.C := Z.C - C; Z.Bra := Z.C; -- ], line 113 -- call R2, line 113 R_R2 (Z, Result); if not Result then Z.C := Z.L - v_1; goto lab0; end if; -- delete, line 113 Slice_Del (Z); when others => null; end case; <<lab0>> when 6 => -- (, line 121 -- call R2, line 122 R_R2 (Z, Result); if not Result then Result := False; return; end if; -- delete, line 122 Slice_Del (Z); -- try, line 123 v_2 := Z.L - Z.C; -- (, line 123 Z.Ket := Z.C; -- [, line 124 -- substring, line 124 if Z.C - 3 <= Z.Lb or else (Character'Pos (Z.P (Z.C)) /= 101 and then Character'Pos (Z.P (Z.C)) /= 108) then Z.C := Z.L - v_2; goto lab1; -- substring, line 124 end if; Find_Among_Backward (Z, A_3, Among_String, null, A); if A = 0 then Z.C := Z.L - v_2; goto lab1; end if; Z.Bra := Z.C; -- ], line 124 -- (, line 127 -- call R2, line 127 R_R2 (Z, Result); if not Result then Z.C := Z.L - v_2; goto lab1; end if; -- delete, line 127 Slice_Del (Z); <<lab1>> when 7 => -- (, line 133 -- call R2, line 134 R_R2 (Z, Result); if not Result then Result := False; return; end if; -- delete, line 134 Slice_Del (Z); -- try, line 135 v_3 := Z.L - Z.C; -- (, line 135 Z.Ket := Z.C; -- [, line 136 -- substring, line 136 if Z.C - 1 <= Z.Lb or else Check_Among (Z, Z.C - 1, 3, 16#401008#) then Z.C := Z.L - v_3; goto lab2; -- substring, line 136 end if; Find_Among_Backward (Z, A_4, Among_String, null, A); if A = 0 then Z.C := Z.L - v_3; goto lab2; end if; Z.Bra := Z.C; -- ], line 136 -- (, line 139 -- call R2, line 139 R_R2 (Z, Result); if not Result then Z.C := Z.L - v_3; goto lab2; end if; -- delete, line 139 Slice_Del (Z); <<lab2>> when 8 => -- (, line 145 -- call R2, line 146 R_R2 (Z, Result); if not Result then Result := False; return; end if; -- delete, line 146 Slice_Del (Z); -- try, line 147 v_4 := Z.L - Z.C; -- (, line 147 Z.Ket := Z.C; -- [, line 148 -- literal, line 148 C := Eq_S_Backward (Z, "at"); if C = 0 then Z.C := Z.L - v_4; goto lab3; end if; Z.C := Z.C - C; Z.Bra := Z.C; -- ], line 148 -- call R2, line 148 R_R2 (Z, Result); if not Result then Z.C := Z.L - v_4; goto lab3; end if; -- delete, line 148 Slice_Del (Z); <<lab3>> when 9 => -- (, line 152 -- call RV, line 153 R_RV (Z, Result); if not Result then Result := False; return; end if; -- literal, line 153 C := Eq_S_Backward (Z, "e"); if C = 0 then Result := False; return; end if; Z.C := Z.C - C; -- <-, line 154 Slice_From (Z, "ir"); when others => null; end case; Result := True; end R_Standard_suffix; procedure R_Verb_suffix (Z : in out Context_Type; Result : out Boolean) is C : Result_Index; A : Integer; v_2 : Integer; begin if Z.C < Z.I_PV then Result := False; return; end if; v_2 := Z.Lb; Z.Lb := Z.I_PV; -- (, line 159 Z.Ket := Z.C; -- [, line 160 -- substring, line 160 Find_Among_Backward (Z, A_6, Among_String, null, A); if A = 0 then Z.Lb := v_2; Result := False; return; end if; Z.Bra := Z.C; -- ], line 160 -- (, line 179 -- delete, line 179 Slice_Del (Z); Z.Lb := v_2; Result := True; end R_Verb_suffix; procedure R_Residual_suffix (Z : in out Context_Type; Result : out Boolean) is C : Result_Index; A : Integer; begin -- (, line 183 Z.Ket := Z.C; -- [, line 184 -- substring, line 184 Find_Among_Backward (Z, A_7, Among_String, null, A); if A = 0 then Result := False; return; end if; Z.Bra := Z.C; -- ], line 184 -- (, line 187 -- call RV, line 187 R_RV (Z, Result); if not Result then Result := False; return; end if; -- delete, line 187 Slice_Del (Z); Result := True; end R_Residual_suffix; procedure R_Residual_form (Z : in out Context_Type; Result : out Boolean) is C : Result_Index; A : Integer; v_1 : Char_Index; v_2 : Char_Index; v_3 : Char_Index; begin -- (, line 191 Z.Ket := Z.C; -- [, line 192 -- substring, line 192 Find_Among_Backward (Z, A_8, Among_String, null, A); if A = 0 then Result := False; return; end if; Z.Bra := Z.C; -- ], line 192 -- among, line 192 case A is when 1 => -- (, line 194 -- call RV, line 194 R_RV (Z, Result); if not Result then Result := False; return; end if; -- delete, line 194 Slice_Del (Z); Z.Ket := Z.C; -- [, line 194 -- or, line 194 v_1 := Z.L - Z.C; -- (, line 194 -- literal, line 194 C := Eq_S_Backward (Z, "u"); if C = 0 then goto lab1; end if; Z.C := Z.C - C; Z.Bra := Z.C; -- ], line 194 -- test, line 194 v_2 := Z.L - Z.C; -- literal, line 194 C := Eq_S_Backward (Z, "g"); if C = 0 then goto lab1; end if; Z.C := Z.C - C; Z.C := Z.L - v_2; goto lab0; <<lab1>> Z.C := Z.L - v_1; -- (, line 195 -- literal, line 195 C := Eq_S_Backward (Z, "i"); if C = 0 then Result := False; return; end if; Z.C := Z.C - C; Z.Bra := Z.C; -- ], line 195 -- test, line 195 v_3 := Z.L - Z.C; -- literal, line 195 C := Eq_S_Backward (Z, "c"); if C = 0 then Result := False; return; end if; Z.C := Z.C - C; Z.C := Z.L - v_3; <<lab0>> -- call RV, line 195 R_RV (Z, Result); if not Result then Result := False; return; end if; -- delete, line 195 Slice_Del (Z); when 2 => -- (, line 196 -- <-, line 196 Slice_From (Z, "c"); when others => null; end case; Result := True; end R_Residual_form; procedure Stem (Z : in out Context_Type; Result : out Boolean) is C : Result_Index; A : Integer; v_1 : Char_Index; v_3 : Char_Index; v_4 : Char_Index; v_5 : Char_Index; v_6 : Char_Index; v_7 : Char_Index; v_8 : Char_Index; v_9 : Char_Index; v_10 : Char_Index; begin -- (, line 201 -- do, line 202 v_1 := Z.C; -- call prelude, line 202 R_Prelude (Z, Result); Z.C := v_1; -- do, line 203 -- call mark_regions, line 203 R_Mark_regions (Z, Result); Z.Lb := Z.C; Z.C := Z.L; -- backwards, line 204 -- (, line 204 -- do, line 205 v_3 := Z.L - Z.C; -- or, line 209 v_4 := Z.L - Z.C; -- and, line 207 v_5 := Z.L - Z.C; -- or, line 206 v_6 := Z.L - Z.C; -- call standard_suffix, line 206 R_Standard_suffix (Z, Result); if not Result then goto lab4; end if; goto lab3; <<lab4>> Z.C := Z.L - v_6; -- call verb_suffix, line 206 R_Verb_suffix (Z, Result); if not Result then goto lab2; end if; <<lab3>> Z.C := Z.L - v_5; -- do, line 207 v_7 := Z.L - Z.C; -- (, line 207 Z.Ket := Z.C; -- [, line 207 -- literal, line 207 C := Eq_S_Backward (Z, "i"); if C = 0 then goto lab5; end if; Z.C := Z.C - C; Z.Bra := Z.C; -- ], line 207 -- test, line 207 v_8 := Z.L - Z.C; -- literal, line 207 C := Eq_S_Backward (Z, "c"); if C = 0 then goto lab5; end if; Z.C := Z.C - C; Z.C := Z.L - v_8; -- call RV, line 207 R_RV (Z, Result); if not Result then goto lab5; end if; -- delete, line 207 Slice_Del (Z); <<lab5>> Z.C := Z.L - v_7; goto lab1; <<lab2>> Z.C := Z.L - v_4; -- call residual_suffix, line 209 R_Residual_suffix (Z, Result); if not Result then goto lab0; end if; <<lab1>> <<lab0>> Z.C := Z.L - v_3; -- do, line 211 v_9 := Z.L - Z.C; -- call residual_form, line 211 R_Residual_form (Z, Result); Z.C := Z.L - v_9; Z.C := Z.Lb; -- do, line 213 v_10 := Z.C; -- call postlude, line 213 R_Postlude (Z, Result); Z.C := v_10; Result := True; end Stem; end Stemmer.Portuguese;
archive/agda-2/Oscar/Class/Monoid.agda
m0davis/oscar
0
10321
module Oscar.Class.Monoid where open import Oscar.Data.Equality open import Oscar.Level record Monoid {a} {A : Set a} {b} (_↠_ : A → A → Set b) : Set (a ⊔ b) where field ε : ∀ {m} → m ↠ m _◇_ : ∀ {l m n} → m ↠ n → l ↠ m → l ↠ n ◇-left-identity : ∀ {m n} → (f : m ↠ n) → ε ◇ f ≡ f ◇-right-identity : ∀ {m n} → (f : m ↠ n) → f ◇ ε ≡ f ◇-associativity : ∀ {k l m n} (f : k ↠ l) (g : l ↠ m) (h : m ↠ n) → h ◇ (g ◇ f) ≡ (h ◇ g) ◇ f open Monoid ⦃ … ⦄ public
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_143_407.asm
ljhsiun2/medusa
9
24359
.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_WC_ht+0x1748f, %r8 nop nop add $10235, %r15 movl $0x61626364, (%r8) nop nop nop nop nop xor $54672, %r14 lea addresses_D_ht+0x884f, %rsi lea addresses_WT_ht+0x1906f, %rdi clflush (%rdi) nop and %rdx, %rdx mov $0, %rcx rep movsl nop nop sub $40135, %r8 lea addresses_A_ht+0xecef, %rsi lea addresses_WC_ht+0xecef, %rdi clflush (%rsi) nop nop dec %r8 mov $27, %rcx rep movsl nop cmp $59583, %r15 lea addresses_WC_ht+0x158d1, %rsi lea addresses_normal_ht+0x10fbc, %rdi nop nop nop nop nop xor $54957, %r8 mov $72, %rcx rep movsw nop and %rdi, %rdi lea addresses_A_ht+0x1960f, %r14 nop nop nop nop add $1733, %rdi movb (%r14), %dl xor %r14, %r14 lea addresses_WC_ht+0xb8ef, %rcx nop nop nop cmp $17616, %r8 vmovups (%rcx), %ymm3 vextracti128 $0, %ymm3, %xmm3 vpextrq $1, %xmm3, %rdi nop nop add %r8, %r8 lea addresses_D_ht+0x154ef, %rsi nop nop add $23440, %rcx mov (%rsi), %rdi nop nop and $6144, %rdi lea addresses_WC_ht+0x178ef, %rsi lea addresses_WT_ht+0x13228, %rdi nop nop nop xor %r10, %r10 mov $63, %rcx rep movsw nop sub $7238, %r8 lea addresses_WT_ht+0x16d2f, %r15 nop nop nop add %r14, %r14 movb $0x61, (%r15) sub $50144, %r15 lea addresses_WC_ht+0x100ef, %rdi nop nop xor $7165, %r8 and $0xffffffffffffffc0, %rdi movaps (%rdi), %xmm6 vpextrq $0, %xmm6, %rsi nop nop nop add %rsi, %rsi lea addresses_WC_ht+0x3cef, %rsi lea addresses_WT_ht+0xef7f, %rdi nop nop nop nop nop xor $2808, %r14 mov $22, %rcx rep movsw nop nop sub $299, %r14 lea addresses_WC_ht+0x80ef, %r15 nop nop add %r14, %r14 movb $0x61, (%r15) and %r10, %r10 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 %r11 push %r12 push %r14 push %rbx push %rcx push %rsi // Store mov $0x29efb100000004ef, %r10 cmp %r11, %r11 movl $0x51525354, (%r10) and %rsi, %rsi // Store mov $0x2f, %r12 nop nop sub %r14, %r14 movw $0x5152, (%r12) nop nop nop nop nop cmp %rsi, %rsi // Store lea addresses_normal+0x4c83, %rbx nop nop nop nop nop xor $33056, %r12 movl $0x51525354, (%rbx) nop xor $51809, %rcx // Load lea addresses_normal+0xdc6f, %rbx nop cmp $48830, %rcx mov (%rbx), %r14w nop nop nop and %r10, %r10 // Faulty Load lea addresses_RW+0x138ef, %r11 xor %r12, %r12 movb (%r11), %cl lea oracles, %r11 and $0xff, %rcx shlq $12, %rcx mov (%r11,%rcx,1), %rcx pop %rsi pop %rcx pop %rbx pop %r14 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_RW', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 7}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 6}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 2}} {'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 7}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_RW', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 4}} {'src': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}} {'src': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}} {'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}} {'src': {'type': 'addresses_A_ht', 'AVXalign': True, 'size': 1, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 3}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 6}} {'src': {'type': 'addresses_WC_ht', 'AVXalign': True, 'size': 16, 'NT': False, 'same': False, 'congruent': 11}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 11}} {'32': 143} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
src/test/resources/AllGrammarsParser.g4
google/polymorphicDSL
3
450
<reponame>google/polymorphicDSL<filename>src/test/resources/AllGrammarsParser.g4 parser grammar AllGrammarsParser; options {tokenVocab=AllGrammarsLexer; } polymorphicDslAllRules : ALL_INPUTS+;
ln.asm
MahtabEK/OS---XV6
0
10139
<gh_stars>0 _ln: file format elf32-i386 Disassembly of section .text: 00000000 <main>: #include "stat.h" #include "user.h" int main(int argc, char *argv[]) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 53 push %ebx e: 51 push %ecx f: 89 cb mov %ecx,%ebx if(argc != 3){ 11: 83 3b 03 cmpl $0x3,(%ebx) 14: 74 17 je 2d <main+0x2d> printf(2, "Usage: ln old new\n"); 16: 83 ec 08 sub $0x8,%esp 19: 68 10 08 00 00 push $0x810 1e: 6a 02 push $0x2 20: e8 35 04 00 00 call 45a <printf> 25: 83 c4 10 add $0x10,%esp exit(); 28: e8 9e 02 00 00 call 2cb <exit> } if(link(argv[1], argv[2]) < 0) 2d: 8b 43 04 mov 0x4(%ebx),%eax 30: 83 c0 08 add $0x8,%eax 33: 8b 10 mov (%eax),%edx 35: 8b 43 04 mov 0x4(%ebx),%eax 38: 83 c0 04 add $0x4,%eax 3b: 8b 00 mov (%eax),%eax 3d: 83 ec 08 sub $0x8,%esp 40: 52 push %edx 41: 50 push %eax 42: e8 e4 02 00 00 call 32b <link> 47: 83 c4 10 add $0x10,%esp 4a: 85 c0 test %eax,%eax 4c: 79 21 jns 6f <main+0x6f> printf(2, "link %s %s: failed\n", argv[1], argv[2]); 4e: 8b 43 04 mov 0x4(%ebx),%eax 51: 83 c0 08 add $0x8,%eax 54: 8b 10 mov (%eax),%edx 56: 8b 43 04 mov 0x4(%ebx),%eax 59: 83 c0 04 add $0x4,%eax 5c: 8b 00 mov (%eax),%eax 5e: 52 push %edx 5f: 50 push %eax 60: 68 23 08 00 00 push $0x823 65: 6a 02 push $0x2 67: e8 ee 03 00 00 call 45a <printf> 6c: 83 c4 10 add $0x10,%esp exit(); 6f: e8 57 02 00 00 call 2cb <exit> 00000074 <stosb>: "cc"); } static inline void stosb(void *addr, int data, int cnt) { 74: 55 push %ebp 75: 89 e5 mov %esp,%ebp 77: 57 push %edi 78: 53 push %ebx asm volatile("cld; rep stosb" : 79: 8b 4d 08 mov 0x8(%ebp),%ecx 7c: 8b 55 10 mov 0x10(%ebp),%edx 7f: 8b 45 0c mov 0xc(%ebp),%eax 82: 89 cb mov %ecx,%ebx 84: 89 df mov %ebx,%edi 86: 89 d1 mov %edx,%ecx 88: fc cld 89: f3 aa rep stos %al,%es:(%edi) 8b: 89 ca mov %ecx,%edx 8d: 89 fb mov %edi,%ebx 8f: 89 5d 08 mov %ebx,0x8(%ebp) 92: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 95: 90 nop 96: 5b pop %ebx 97: 5f pop %edi 98: 5d pop %ebp 99: c3 ret 0000009a <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 9a: 55 push %ebp 9b: 89 e5 mov %esp,%ebp 9d: 83 ec 10 sub $0x10,%esp char *os; os = s; a0: 8b 45 08 mov 0x8(%ebp),%eax a3: 89 45 fc mov %eax,-0x4(%ebp) while((*s++ = *t++) != 0) a6: 90 nop a7: 8b 45 08 mov 0x8(%ebp),%eax aa: 8d 50 01 lea 0x1(%eax),%edx ad: 89 55 08 mov %edx,0x8(%ebp) b0: 8b 55 0c mov 0xc(%ebp),%edx b3: 8d 4a 01 lea 0x1(%edx),%ecx b6: 89 4d 0c mov %ecx,0xc(%ebp) b9: 0f b6 12 movzbl (%edx),%edx bc: 88 10 mov %dl,(%eax) be: 0f b6 00 movzbl (%eax),%eax c1: 84 c0 test %al,%al c3: 75 e2 jne a7 <strcpy+0xd> ; return os; c5: 8b 45 fc mov -0x4(%ebp),%eax } c8: c9 leave c9: c3 ret 000000ca <strcmp>: int strcmp(const char *p, const char *q) { ca: 55 push %ebp cb: 89 e5 mov %esp,%ebp while(*p && *p == *q) cd: eb 08 jmp d7 <strcmp+0xd> p++, q++; cf: 83 45 08 01 addl $0x1,0x8(%ebp) d3: 83 45 0c 01 addl $0x1,0xc(%ebp) } int strcmp(const char *p, const char *q) { while(*p && *p == *q) d7: 8b 45 08 mov 0x8(%ebp),%eax da: 0f b6 00 movzbl (%eax),%eax dd: 84 c0 test %al,%al df: 74 10 je f1 <strcmp+0x27> e1: 8b 45 08 mov 0x8(%ebp),%eax e4: 0f b6 10 movzbl (%eax),%edx e7: 8b 45 0c mov 0xc(%ebp),%eax ea: 0f b6 00 movzbl (%eax),%eax ed: 38 c2 cmp %al,%dl ef: 74 de je cf <strcmp+0x5> p++, q++; return (uchar)*p - (uchar)*q; f1: 8b 45 08 mov 0x8(%ebp),%eax f4: 0f b6 00 movzbl (%eax),%eax f7: 0f b6 d0 movzbl %al,%edx fa: 8b 45 0c mov 0xc(%ebp),%eax fd: 0f b6 00 movzbl (%eax),%eax 100: 0f b6 c0 movzbl %al,%eax 103: 29 c2 sub %eax,%edx 105: 89 d0 mov %edx,%eax } 107: 5d pop %ebp 108: c3 ret 00000109 <strlen>: uint strlen(char *s) { 109: 55 push %ebp 10a: 89 e5 mov %esp,%ebp 10c: 83 ec 10 sub $0x10,%esp int n; for(n = 0; s[n]; n++) 10f: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 116: eb 04 jmp 11c <strlen+0x13> 118: 83 45 fc 01 addl $0x1,-0x4(%ebp) 11c: 8b 55 fc mov -0x4(%ebp),%edx 11f: 8b 45 08 mov 0x8(%ebp),%eax 122: 01 d0 add %edx,%eax 124: 0f b6 00 movzbl (%eax),%eax 127: 84 c0 test %al,%al 129: 75 ed jne 118 <strlen+0xf> ; return n; 12b: 8b 45 fc mov -0x4(%ebp),%eax } 12e: c9 leave 12f: c3 ret 00000130 <memset>: void* memset(void *dst, int c, uint n) { 130: 55 push %ebp 131: 89 e5 mov %esp,%ebp stosb(dst, c, n); 133: 8b 45 10 mov 0x10(%ebp),%eax 136: 50 push %eax 137: ff 75 0c pushl 0xc(%ebp) 13a: ff 75 08 pushl 0x8(%ebp) 13d: e8 32 ff ff ff call 74 <stosb> 142: 83 c4 0c add $0xc,%esp return dst; 145: 8b 45 08 mov 0x8(%ebp),%eax } 148: c9 leave 149: c3 ret 0000014a <strchr>: char* strchr(const char *s, char c) { 14a: 55 push %ebp 14b: 89 e5 mov %esp,%ebp 14d: 83 ec 04 sub $0x4,%esp 150: 8b 45 0c mov 0xc(%ebp),%eax 153: 88 45 fc mov %al,-0x4(%ebp) for(; *s; s++) 156: eb 14 jmp 16c <strchr+0x22> if(*s == c) 158: 8b 45 08 mov 0x8(%ebp),%eax 15b: 0f b6 00 movzbl (%eax),%eax 15e: 3a 45 fc cmp -0x4(%ebp),%al 161: 75 05 jne 168 <strchr+0x1e> return (char*)s; 163: 8b 45 08 mov 0x8(%ebp),%eax 166: eb 13 jmp 17b <strchr+0x31> } char* strchr(const char *s, char c) { for(; *s; s++) 168: 83 45 08 01 addl $0x1,0x8(%ebp) 16c: 8b 45 08 mov 0x8(%ebp),%eax 16f: 0f b6 00 movzbl (%eax),%eax 172: 84 c0 test %al,%al 174: 75 e2 jne 158 <strchr+0xe> if(*s == c) return (char*)s; return 0; 176: b8 00 00 00 00 mov $0x0,%eax } 17b: c9 leave 17c: c3 ret 0000017d <gets>: char* gets(char *buf, int max) { 17d: 55 push %ebp 17e: 89 e5 mov %esp,%ebp 180: 83 ec 18 sub $0x18,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 183: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 18a: eb 42 jmp 1ce <gets+0x51> cc = read(0, &c, 1); 18c: 83 ec 04 sub $0x4,%esp 18f: 6a 01 push $0x1 191: 8d 45 ef lea -0x11(%ebp),%eax 194: 50 push %eax 195: 6a 00 push $0x0 197: e8 47 01 00 00 call 2e3 <read> 19c: 83 c4 10 add $0x10,%esp 19f: 89 45 f0 mov %eax,-0x10(%ebp) if(cc < 1) 1a2: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 1a6: 7e 33 jle 1db <gets+0x5e> break; buf[i++] = c; 1a8: 8b 45 f4 mov -0xc(%ebp),%eax 1ab: 8d 50 01 lea 0x1(%eax),%edx 1ae: 89 55 f4 mov %edx,-0xc(%ebp) 1b1: 89 c2 mov %eax,%edx 1b3: 8b 45 08 mov 0x8(%ebp),%eax 1b6: 01 c2 add %eax,%edx 1b8: 0f b6 45 ef movzbl -0x11(%ebp),%eax 1bc: 88 02 mov %al,(%edx) if(c == '\n' || c == '\r') 1be: 0f b6 45 ef movzbl -0x11(%ebp),%eax 1c2: 3c 0a cmp $0xa,%al 1c4: 74 16 je 1dc <gets+0x5f> 1c6: 0f b6 45 ef movzbl -0x11(%ebp),%eax 1ca: 3c 0d cmp $0xd,%al 1cc: 74 0e je 1dc <gets+0x5f> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 1ce: 8b 45 f4 mov -0xc(%ebp),%eax 1d1: 83 c0 01 add $0x1,%eax 1d4: 3b 45 0c cmp 0xc(%ebp),%eax 1d7: 7c b3 jl 18c <gets+0xf> 1d9: eb 01 jmp 1dc <gets+0x5f> cc = read(0, &c, 1); if(cc < 1) break; 1db: 90 nop buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 1dc: 8b 55 f4 mov -0xc(%ebp),%edx 1df: 8b 45 08 mov 0x8(%ebp),%eax 1e2: 01 d0 add %edx,%eax 1e4: c6 00 00 movb $0x0,(%eax) return buf; 1e7: 8b 45 08 mov 0x8(%ebp),%eax } 1ea: c9 leave 1eb: c3 ret 000001ec <stat>: int stat(char *n, struct stat *st) { 1ec: 55 push %ebp 1ed: 89 e5 mov %esp,%ebp 1ef: 83 ec 18 sub $0x18,%esp int fd; int r; fd = open(n, O_RDONLY); 1f2: 83 ec 08 sub $0x8,%esp 1f5: 6a 00 push $0x0 1f7: ff 75 08 pushl 0x8(%ebp) 1fa: e8 0c 01 00 00 call 30b <open> 1ff: 83 c4 10 add $0x10,%esp 202: 89 45 f4 mov %eax,-0xc(%ebp) if(fd < 0) 205: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 209: 79 07 jns 212 <stat+0x26> return -1; 20b: b8 ff ff ff ff mov $0xffffffff,%eax 210: eb 25 jmp 237 <stat+0x4b> r = fstat(fd, st); 212: 83 ec 08 sub $0x8,%esp 215: ff 75 0c pushl 0xc(%ebp) 218: ff 75 f4 pushl -0xc(%ebp) 21b: e8 03 01 00 00 call 323 <fstat> 220: 83 c4 10 add $0x10,%esp 223: 89 45 f0 mov %eax,-0x10(%ebp) close(fd); 226: 83 ec 0c sub $0xc,%esp 229: ff 75 f4 pushl -0xc(%ebp) 22c: e8 c2 00 00 00 call 2f3 <close> 231: 83 c4 10 add $0x10,%esp return r; 234: 8b 45 f0 mov -0x10(%ebp),%eax } 237: c9 leave 238: c3 ret 00000239 <atoi>: int atoi(const char *s) { 239: 55 push %ebp 23a: 89 e5 mov %esp,%ebp 23c: 83 ec 10 sub $0x10,%esp int n; n = 0; 23f: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) while('0' <= *s && *s <= '9') 246: eb 25 jmp 26d <atoi+0x34> n = n*10 + *s++ - '0'; 248: 8b 55 fc mov -0x4(%ebp),%edx 24b: 89 d0 mov %edx,%eax 24d: c1 e0 02 shl $0x2,%eax 250: 01 d0 add %edx,%eax 252: 01 c0 add %eax,%eax 254: 89 c1 mov %eax,%ecx 256: 8b 45 08 mov 0x8(%ebp),%eax 259: 8d 50 01 lea 0x1(%eax),%edx 25c: 89 55 08 mov %edx,0x8(%ebp) 25f: 0f b6 00 movzbl (%eax),%eax 262: 0f be c0 movsbl %al,%eax 265: 01 c8 add %ecx,%eax 267: 83 e8 30 sub $0x30,%eax 26a: 89 45 fc mov %eax,-0x4(%ebp) atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 26d: 8b 45 08 mov 0x8(%ebp),%eax 270: 0f b6 00 movzbl (%eax),%eax 273: 3c 2f cmp $0x2f,%al 275: 7e 0a jle 281 <atoi+0x48> 277: 8b 45 08 mov 0x8(%ebp),%eax 27a: 0f b6 00 movzbl (%eax),%eax 27d: 3c 39 cmp $0x39,%al 27f: 7e c7 jle 248 <atoi+0xf> n = n*10 + *s++ - '0'; return n; 281: 8b 45 fc mov -0x4(%ebp),%eax } 284: c9 leave 285: c3 ret 00000286 <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 286: 55 push %ebp 287: 89 e5 mov %esp,%ebp 289: 83 ec 10 sub $0x10,%esp char *dst, *src; dst = vdst; 28c: 8b 45 08 mov 0x8(%ebp),%eax 28f: 89 45 fc mov %eax,-0x4(%ebp) src = vsrc; 292: 8b 45 0c mov 0xc(%ebp),%eax 295: 89 45 f8 mov %eax,-0x8(%ebp) while(n-- > 0) 298: eb 17 jmp 2b1 <memmove+0x2b> *dst++ = *src++; 29a: 8b 45 fc mov -0x4(%ebp),%eax 29d: 8d 50 01 lea 0x1(%eax),%edx 2a0: 89 55 fc mov %edx,-0x4(%ebp) 2a3: 8b 55 f8 mov -0x8(%ebp),%edx 2a6: 8d 4a 01 lea 0x1(%edx),%ecx 2a9: 89 4d f8 mov %ecx,-0x8(%ebp) 2ac: 0f b6 12 movzbl (%edx),%edx 2af: 88 10 mov %dl,(%eax) { char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 2b1: 8b 45 10 mov 0x10(%ebp),%eax 2b4: 8d 50 ff lea -0x1(%eax),%edx 2b7: 89 55 10 mov %edx,0x10(%ebp) 2ba: 85 c0 test %eax,%eax 2bc: 7f dc jg 29a <memmove+0x14> *dst++ = *src++; return vdst; 2be: 8b 45 08 mov 0x8(%ebp),%eax } 2c1: c9 leave 2c2: c3 ret 000002c3 <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 2c3: b8 01 00 00 00 mov $0x1,%eax 2c8: cd 40 int $0x40 2ca: c3 ret 000002cb <exit>: SYSCALL(exit) 2cb: b8 02 00 00 00 mov $0x2,%eax 2d0: cd 40 int $0x40 2d2: c3 ret 000002d3 <wait>: SYSCALL(wait) 2d3: b8 03 00 00 00 mov $0x3,%eax 2d8: cd 40 int $0x40 2da: c3 ret 000002db <pipe>: SYSCALL(pipe) 2db: b8 04 00 00 00 mov $0x4,%eax 2e0: cd 40 int $0x40 2e2: c3 ret 000002e3 <read>: SYSCALL(read) 2e3: b8 05 00 00 00 mov $0x5,%eax 2e8: cd 40 int $0x40 2ea: c3 ret 000002eb <write>: SYSCALL(write) 2eb: b8 10 00 00 00 mov $0x10,%eax 2f0: cd 40 int $0x40 2f2: c3 ret 000002f3 <close>: SYSCALL(close) 2f3: b8 15 00 00 00 mov $0x15,%eax 2f8: cd 40 int $0x40 2fa: c3 ret 000002fb <kill>: SYSCALL(kill) 2fb: b8 06 00 00 00 mov $0x6,%eax 300: cd 40 int $0x40 302: c3 ret 00000303 <exec>: SYSCALL(exec) 303: b8 07 00 00 00 mov $0x7,%eax 308: cd 40 int $0x40 30a: c3 ret 0000030b <open>: SYSCALL(open) 30b: b8 0f 00 00 00 mov $0xf,%eax 310: cd 40 int $0x40 312: c3 ret 00000313 <mknod>: SYSCALL(mknod) 313: b8 11 00 00 00 mov $0x11,%eax 318: cd 40 int $0x40 31a: c3 ret 0000031b <unlink>: SYSCALL(unlink) 31b: b8 12 00 00 00 mov $0x12,%eax 320: cd 40 int $0x40 322: c3 ret 00000323 <fstat>: SYSCALL(fstat) 323: b8 08 00 00 00 mov $0x8,%eax 328: cd 40 int $0x40 32a: c3 ret 0000032b <link>: SYSCALL(link) 32b: b8 13 00 00 00 mov $0x13,%eax 330: cd 40 int $0x40 332: c3 ret 00000333 <mkdir>: SYSCALL(mkdir) 333: b8 14 00 00 00 mov $0x14,%eax 338: cd 40 int $0x40 33a: c3 ret 0000033b <chdir>: SYSCALL(chdir) 33b: b8 09 00 00 00 mov $0x9,%eax 340: cd 40 int $0x40 342: c3 ret 00000343 <dup>: SYSCALL(dup) 343: b8 0a 00 00 00 mov $0xa,%eax 348: cd 40 int $0x40 34a: c3 ret 0000034b <getpid>: SYSCALL(getpid) 34b: b8 0b 00 00 00 mov $0xb,%eax 350: cd 40 int $0x40 352: c3 ret 00000353 <sbrk>: SYSCALL(sbrk) 353: b8 0c 00 00 00 mov $0xc,%eax 358: cd 40 int $0x40 35a: c3 ret 0000035b <sleep>: SYSCALL(sleep) 35b: b8 0d 00 00 00 mov $0xd,%eax 360: cd 40 int $0x40 362: c3 ret 00000363 <uptime>: SYSCALL(uptime) 363: b8 0e 00 00 00 mov $0xe,%eax 368: cd 40 int $0x40 36a: c3 ret 0000036b <getppid>: SYSCALL(getppid) 36b: b8 16 00 00 00 mov $0x16,%eax 370: cd 40 int $0x40 372: c3 ret 00000373 <wait2>: SYSCALL(wait2) 373: b8 18 00 00 00 mov $0x18,%eax 378: cd 40 int $0x40 37a: c3 ret 0000037b <nice>: SYSCALL(nice) 37b: b8 17 00 00 00 mov $0x17,%eax 380: cd 40 int $0x40 382: c3 ret 00000383 <putc>: #include "stat.h" #include "user.h" static void putc(int fd, char c) { 383: 55 push %ebp 384: 89 e5 mov %esp,%ebp 386: 83 ec 18 sub $0x18,%esp 389: 8b 45 0c mov 0xc(%ebp),%eax 38c: 88 45 f4 mov %al,-0xc(%ebp) write(fd, &c, 1); 38f: 83 ec 04 sub $0x4,%esp 392: 6a 01 push $0x1 394: 8d 45 f4 lea -0xc(%ebp),%eax 397: 50 push %eax 398: ff 75 08 pushl 0x8(%ebp) 39b: e8 4b ff ff ff call 2eb <write> 3a0: 83 c4 10 add $0x10,%esp } 3a3: 90 nop 3a4: c9 leave 3a5: c3 ret 000003a6 <printint>: static void printint(int fd, int xx, int base, int sgn) { 3a6: 55 push %ebp 3a7: 89 e5 mov %esp,%ebp 3a9: 53 push %ebx 3aa: 83 ec 24 sub $0x24,%esp static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 3ad: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) if(sgn && xx < 0){ 3b4: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 3b8: 74 17 je 3d1 <printint+0x2b> 3ba: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 3be: 79 11 jns 3d1 <printint+0x2b> neg = 1; 3c0: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) x = -xx; 3c7: 8b 45 0c mov 0xc(%ebp),%eax 3ca: f7 d8 neg %eax 3cc: 89 45 ec mov %eax,-0x14(%ebp) 3cf: eb 06 jmp 3d7 <printint+0x31> } else { x = xx; 3d1: 8b 45 0c mov 0xc(%ebp),%eax 3d4: 89 45 ec mov %eax,-0x14(%ebp) } i = 0; 3d7: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) do{ buf[i++] = digits[x % base]; 3de: 8b 4d f4 mov -0xc(%ebp),%ecx 3e1: 8d 41 01 lea 0x1(%ecx),%eax 3e4: 89 45 f4 mov %eax,-0xc(%ebp) 3e7: 8b 5d 10 mov 0x10(%ebp),%ebx 3ea: 8b 45 ec mov -0x14(%ebp),%eax 3ed: ba 00 00 00 00 mov $0x0,%edx 3f2: f7 f3 div %ebx 3f4: 89 d0 mov %edx,%eax 3f6: 0f b6 80 8c 0a 00 00 movzbl 0xa8c(%eax),%eax 3fd: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1) }while((x /= base) != 0); 401: 8b 5d 10 mov 0x10(%ebp),%ebx 404: 8b 45 ec mov -0x14(%ebp),%eax 407: ba 00 00 00 00 mov $0x0,%edx 40c: f7 f3 div %ebx 40e: 89 45 ec mov %eax,-0x14(%ebp) 411: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 415: 75 c7 jne 3de <printint+0x38> if(neg) 417: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 41b: 74 2d je 44a <printint+0xa4> buf[i++] = '-'; 41d: 8b 45 f4 mov -0xc(%ebp),%eax 420: 8d 50 01 lea 0x1(%eax),%edx 423: 89 55 f4 mov %edx,-0xc(%ebp) 426: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1) while(--i >= 0) 42b: eb 1d jmp 44a <printint+0xa4> putc(fd, buf[i]); 42d: 8d 55 dc lea -0x24(%ebp),%edx 430: 8b 45 f4 mov -0xc(%ebp),%eax 433: 01 d0 add %edx,%eax 435: 0f b6 00 movzbl (%eax),%eax 438: 0f be c0 movsbl %al,%eax 43b: 83 ec 08 sub $0x8,%esp 43e: 50 push %eax 43f: ff 75 08 pushl 0x8(%ebp) 442: e8 3c ff ff ff call 383 <putc> 447: 83 c4 10 add $0x10,%esp buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 44a: 83 6d f4 01 subl $0x1,-0xc(%ebp) 44e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 452: 79 d9 jns 42d <printint+0x87> putc(fd, buf[i]); } 454: 90 nop 455: 8b 5d fc mov -0x4(%ebp),%ebx 458: c9 leave 459: c3 ret 0000045a <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 45a: 55 push %ebp 45b: 89 e5 mov %esp,%ebp 45d: 83 ec 28 sub $0x28,%esp char *s; int c, i, state; uint *ap; state = 0; 460: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) ap = (uint*)(void*)&fmt + 1; 467: 8d 45 0c lea 0xc(%ebp),%eax 46a: 83 c0 04 add $0x4,%eax 46d: 89 45 e8 mov %eax,-0x18(%ebp) for(i = 0; fmt[i]; i++){ 470: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 477: e9 59 01 00 00 jmp 5d5 <printf+0x17b> c = fmt[i] & 0xff; 47c: 8b 55 0c mov 0xc(%ebp),%edx 47f: 8b 45 f0 mov -0x10(%ebp),%eax 482: 01 d0 add %edx,%eax 484: 0f b6 00 movzbl (%eax),%eax 487: 0f be c0 movsbl %al,%eax 48a: 25 ff 00 00 00 and $0xff,%eax 48f: 89 45 e4 mov %eax,-0x1c(%ebp) if(state == 0){ 492: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 496: 75 2c jne 4c4 <printf+0x6a> if(c == '%'){ 498: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 49c: 75 0c jne 4aa <printf+0x50> state = '%'; 49e: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp) 4a5: e9 27 01 00 00 jmp 5d1 <printf+0x177> } else { putc(fd, c); 4aa: 8b 45 e4 mov -0x1c(%ebp),%eax 4ad: 0f be c0 movsbl %al,%eax 4b0: 83 ec 08 sub $0x8,%esp 4b3: 50 push %eax 4b4: ff 75 08 pushl 0x8(%ebp) 4b7: e8 c7 fe ff ff call 383 <putc> 4bc: 83 c4 10 add $0x10,%esp 4bf: e9 0d 01 00 00 jmp 5d1 <printf+0x177> } } else if(state == '%'){ 4c4: 83 7d ec 25 cmpl $0x25,-0x14(%ebp) 4c8: 0f 85 03 01 00 00 jne 5d1 <printf+0x177> if(c == 'd'){ 4ce: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp) 4d2: 75 1e jne 4f2 <printf+0x98> printint(fd, *ap, 10, 1); 4d4: 8b 45 e8 mov -0x18(%ebp),%eax 4d7: 8b 00 mov (%eax),%eax 4d9: 6a 01 push $0x1 4db: 6a 0a push $0xa 4dd: 50 push %eax 4de: ff 75 08 pushl 0x8(%ebp) 4e1: e8 c0 fe ff ff call 3a6 <printint> 4e6: 83 c4 10 add $0x10,%esp ap++; 4e9: 83 45 e8 04 addl $0x4,-0x18(%ebp) 4ed: e9 d8 00 00 00 jmp 5ca <printf+0x170> } else if(c == 'x' || c == 'p'){ 4f2: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp) 4f6: 74 06 je 4fe <printf+0xa4> 4f8: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp) 4fc: 75 1e jne 51c <printf+0xc2> printint(fd, *ap, 16, 0); 4fe: 8b 45 e8 mov -0x18(%ebp),%eax 501: 8b 00 mov (%eax),%eax 503: 6a 00 push $0x0 505: 6a 10 push $0x10 507: 50 push %eax 508: ff 75 08 pushl 0x8(%ebp) 50b: e8 96 fe ff ff call 3a6 <printint> 510: 83 c4 10 add $0x10,%esp ap++; 513: 83 45 e8 04 addl $0x4,-0x18(%ebp) 517: e9 ae 00 00 00 jmp 5ca <printf+0x170> } else if(c == 's'){ 51c: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp) 520: 75 43 jne 565 <printf+0x10b> s = (char*)*ap; 522: 8b 45 e8 mov -0x18(%ebp),%eax 525: 8b 00 mov (%eax),%eax 527: 89 45 f4 mov %eax,-0xc(%ebp) ap++; 52a: 83 45 e8 04 addl $0x4,-0x18(%ebp) if(s == 0) 52e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 532: 75 25 jne 559 <printf+0xff> s = "(null)"; 534: c7 45 f4 37 08 00 00 movl $0x837,-0xc(%ebp) while(*s != 0){ 53b: eb 1c jmp 559 <printf+0xff> putc(fd, *s); 53d: 8b 45 f4 mov -0xc(%ebp),%eax 540: 0f b6 00 movzbl (%eax),%eax 543: 0f be c0 movsbl %al,%eax 546: 83 ec 08 sub $0x8,%esp 549: 50 push %eax 54a: ff 75 08 pushl 0x8(%ebp) 54d: e8 31 fe ff ff call 383 <putc> 552: 83 c4 10 add $0x10,%esp s++; 555: 83 45 f4 01 addl $0x1,-0xc(%ebp) } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 559: 8b 45 f4 mov -0xc(%ebp),%eax 55c: 0f b6 00 movzbl (%eax),%eax 55f: 84 c0 test %al,%al 561: 75 da jne 53d <printf+0xe3> 563: eb 65 jmp 5ca <printf+0x170> putc(fd, *s); s++; } } else if(c == 'c'){ 565: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp) 569: 75 1d jne 588 <printf+0x12e> putc(fd, *ap); 56b: 8b 45 e8 mov -0x18(%ebp),%eax 56e: 8b 00 mov (%eax),%eax 570: 0f be c0 movsbl %al,%eax 573: 83 ec 08 sub $0x8,%esp 576: 50 push %eax 577: ff 75 08 pushl 0x8(%ebp) 57a: e8 04 fe ff ff call 383 <putc> 57f: 83 c4 10 add $0x10,%esp ap++; 582: 83 45 e8 04 addl $0x4,-0x18(%ebp) 586: eb 42 jmp 5ca <printf+0x170> } else if(c == '%'){ 588: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 58c: 75 17 jne 5a5 <printf+0x14b> putc(fd, c); 58e: 8b 45 e4 mov -0x1c(%ebp),%eax 591: 0f be c0 movsbl %al,%eax 594: 83 ec 08 sub $0x8,%esp 597: 50 push %eax 598: ff 75 08 pushl 0x8(%ebp) 59b: e8 e3 fd ff ff call 383 <putc> 5a0: 83 c4 10 add $0x10,%esp 5a3: eb 25 jmp 5ca <printf+0x170> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 5a5: 83 ec 08 sub $0x8,%esp 5a8: 6a 25 push $0x25 5aa: ff 75 08 pushl 0x8(%ebp) 5ad: e8 d1 fd ff ff call 383 <putc> 5b2: 83 c4 10 add $0x10,%esp putc(fd, c); 5b5: 8b 45 e4 mov -0x1c(%ebp),%eax 5b8: 0f be c0 movsbl %al,%eax 5bb: 83 ec 08 sub $0x8,%esp 5be: 50 push %eax 5bf: ff 75 08 pushl 0x8(%ebp) 5c2: e8 bc fd ff ff call 383 <putc> 5c7: 83 c4 10 add $0x10,%esp } state = 0; 5ca: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 5d1: 83 45 f0 01 addl $0x1,-0x10(%ebp) 5d5: 8b 55 0c mov 0xc(%ebp),%edx 5d8: 8b 45 f0 mov -0x10(%ebp),%eax 5db: 01 d0 add %edx,%eax 5dd: 0f b6 00 movzbl (%eax),%eax 5e0: 84 c0 test %al,%al 5e2: 0f 85 94 fe ff ff jne 47c <printf+0x22> putc(fd, c); } state = 0; } } } 5e8: 90 nop 5e9: c9 leave 5ea: c3 ret 000005eb <free>: static Header base; static Header *freep; void free(void *ap) { 5eb: 55 push %ebp 5ec: 89 e5 mov %esp,%ebp 5ee: 83 ec 10 sub $0x10,%esp Header *bp, *p; bp = (Header*)ap - 1; 5f1: 8b 45 08 mov 0x8(%ebp),%eax 5f4: 83 e8 08 sub $0x8,%eax 5f7: 89 45 f8 mov %eax,-0x8(%ebp) for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 5fa: a1 a8 0a 00 00 mov 0xaa8,%eax 5ff: 89 45 fc mov %eax,-0x4(%ebp) 602: eb 24 jmp 628 <free+0x3d> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 604: 8b 45 fc mov -0x4(%ebp),%eax 607: 8b 00 mov (%eax),%eax 609: 3b 45 fc cmp -0x4(%ebp),%eax 60c: 77 12 ja 620 <free+0x35> 60e: 8b 45 f8 mov -0x8(%ebp),%eax 611: 3b 45 fc cmp -0x4(%ebp),%eax 614: 77 24 ja 63a <free+0x4f> 616: 8b 45 fc mov -0x4(%ebp),%eax 619: 8b 00 mov (%eax),%eax 61b: 3b 45 f8 cmp -0x8(%ebp),%eax 61e: 77 1a ja 63a <free+0x4f> free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 620: 8b 45 fc mov -0x4(%ebp),%eax 623: 8b 00 mov (%eax),%eax 625: 89 45 fc mov %eax,-0x4(%ebp) 628: 8b 45 f8 mov -0x8(%ebp),%eax 62b: 3b 45 fc cmp -0x4(%ebp),%eax 62e: 76 d4 jbe 604 <free+0x19> 630: 8b 45 fc mov -0x4(%ebp),%eax 633: 8b 00 mov (%eax),%eax 635: 3b 45 f8 cmp -0x8(%ebp),%eax 638: 76 ca jbe 604 <free+0x19> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ 63a: 8b 45 f8 mov -0x8(%ebp),%eax 63d: 8b 40 04 mov 0x4(%eax),%eax 640: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 647: 8b 45 f8 mov -0x8(%ebp),%eax 64a: 01 c2 add %eax,%edx 64c: 8b 45 fc mov -0x4(%ebp),%eax 64f: 8b 00 mov (%eax),%eax 651: 39 c2 cmp %eax,%edx 653: 75 24 jne 679 <free+0x8e> bp->s.size += p->s.ptr->s.size; 655: 8b 45 f8 mov -0x8(%ebp),%eax 658: 8b 50 04 mov 0x4(%eax),%edx 65b: 8b 45 fc mov -0x4(%ebp),%eax 65e: 8b 00 mov (%eax),%eax 660: 8b 40 04 mov 0x4(%eax),%eax 663: 01 c2 add %eax,%edx 665: 8b 45 f8 mov -0x8(%ebp),%eax 668: 89 50 04 mov %edx,0x4(%eax) bp->s.ptr = p->s.ptr->s.ptr; 66b: 8b 45 fc mov -0x4(%ebp),%eax 66e: 8b 00 mov (%eax),%eax 670: 8b 10 mov (%eax),%edx 672: 8b 45 f8 mov -0x8(%ebp),%eax 675: 89 10 mov %edx,(%eax) 677: eb 0a jmp 683 <free+0x98> } else bp->s.ptr = p->s.ptr; 679: 8b 45 fc mov -0x4(%ebp),%eax 67c: 8b 10 mov (%eax),%edx 67e: 8b 45 f8 mov -0x8(%ebp),%eax 681: 89 10 mov %edx,(%eax) if(p + p->s.size == bp){ 683: 8b 45 fc mov -0x4(%ebp),%eax 686: 8b 40 04 mov 0x4(%eax),%eax 689: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 690: 8b 45 fc mov -0x4(%ebp),%eax 693: 01 d0 add %edx,%eax 695: 3b 45 f8 cmp -0x8(%ebp),%eax 698: 75 20 jne 6ba <free+0xcf> p->s.size += bp->s.size; 69a: 8b 45 fc mov -0x4(%ebp),%eax 69d: 8b 50 04 mov 0x4(%eax),%edx 6a0: 8b 45 f8 mov -0x8(%ebp),%eax 6a3: 8b 40 04 mov 0x4(%eax),%eax 6a6: 01 c2 add %eax,%edx 6a8: 8b 45 fc mov -0x4(%ebp),%eax 6ab: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 6ae: 8b 45 f8 mov -0x8(%ebp),%eax 6b1: 8b 10 mov (%eax),%edx 6b3: 8b 45 fc mov -0x4(%ebp),%eax 6b6: 89 10 mov %edx,(%eax) 6b8: eb 08 jmp 6c2 <free+0xd7> } else p->s.ptr = bp; 6ba: 8b 45 fc mov -0x4(%ebp),%eax 6bd: 8b 55 f8 mov -0x8(%ebp),%edx 6c0: 89 10 mov %edx,(%eax) freep = p; 6c2: 8b 45 fc mov -0x4(%ebp),%eax 6c5: a3 a8 0a 00 00 mov %eax,0xaa8 } 6ca: 90 nop 6cb: c9 leave 6cc: c3 ret 000006cd <morecore>: static Header* morecore(uint nu) { 6cd: 55 push %ebp 6ce: 89 e5 mov %esp,%ebp 6d0: 83 ec 18 sub $0x18,%esp char *p; Header *hp; if(nu < 4096) 6d3: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp) 6da: 77 07 ja 6e3 <morecore+0x16> nu = 4096; 6dc: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp) p = sbrk(nu * sizeof(Header)); 6e3: 8b 45 08 mov 0x8(%ebp),%eax 6e6: c1 e0 03 shl $0x3,%eax 6e9: 83 ec 0c sub $0xc,%esp 6ec: 50 push %eax 6ed: e8 61 fc ff ff call 353 <sbrk> 6f2: 83 c4 10 add $0x10,%esp 6f5: 89 45 f4 mov %eax,-0xc(%ebp) if(p == (char*)-1) 6f8: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp) 6fc: 75 07 jne 705 <morecore+0x38> return 0; 6fe: b8 00 00 00 00 mov $0x0,%eax 703: eb 26 jmp 72b <morecore+0x5e> hp = (Header*)p; 705: 8b 45 f4 mov -0xc(%ebp),%eax 708: 89 45 f0 mov %eax,-0x10(%ebp) hp->s.size = nu; 70b: 8b 45 f0 mov -0x10(%ebp),%eax 70e: 8b 55 08 mov 0x8(%ebp),%edx 711: 89 50 04 mov %edx,0x4(%eax) free((void*)(hp + 1)); 714: 8b 45 f0 mov -0x10(%ebp),%eax 717: 83 c0 08 add $0x8,%eax 71a: 83 ec 0c sub $0xc,%esp 71d: 50 push %eax 71e: e8 c8 fe ff ff call 5eb <free> 723: 83 c4 10 add $0x10,%esp return freep; 726: a1 a8 0a 00 00 mov 0xaa8,%eax } 72b: c9 leave 72c: c3 ret 0000072d <malloc>: void* malloc(uint nbytes) { 72d: 55 push %ebp 72e: 89 e5 mov %esp,%ebp 730: 83 ec 18 sub $0x18,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 733: 8b 45 08 mov 0x8(%ebp),%eax 736: 83 c0 07 add $0x7,%eax 739: c1 e8 03 shr $0x3,%eax 73c: 83 c0 01 add $0x1,%eax 73f: 89 45 ec mov %eax,-0x14(%ebp) if((prevp = freep) == 0){ 742: a1 a8 0a 00 00 mov 0xaa8,%eax 747: 89 45 f0 mov %eax,-0x10(%ebp) 74a: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 74e: 75 23 jne 773 <malloc+0x46> base.s.ptr = freep = prevp = &base; 750: c7 45 f0 a0 0a 00 00 movl $0xaa0,-0x10(%ebp) 757: 8b 45 f0 mov -0x10(%ebp),%eax 75a: a3 a8 0a 00 00 mov %eax,0xaa8 75f: a1 a8 0a 00 00 mov 0xaa8,%eax 764: a3 a0 0a 00 00 mov %eax,0xaa0 base.s.size = 0; 769: c7 05 a4 0a 00 00 00 movl $0x0,0xaa4 770: 00 00 00 } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 773: 8b 45 f0 mov -0x10(%ebp),%eax 776: 8b 00 mov (%eax),%eax 778: 89 45 f4 mov %eax,-0xc(%ebp) if(p->s.size >= nunits){ 77b: 8b 45 f4 mov -0xc(%ebp),%eax 77e: 8b 40 04 mov 0x4(%eax),%eax 781: 3b 45 ec cmp -0x14(%ebp),%eax 784: 72 4d jb 7d3 <malloc+0xa6> if(p->s.size == nunits) 786: 8b 45 f4 mov -0xc(%ebp),%eax 789: 8b 40 04 mov 0x4(%eax),%eax 78c: 3b 45 ec cmp -0x14(%ebp),%eax 78f: 75 0c jne 79d <malloc+0x70> prevp->s.ptr = p->s.ptr; 791: 8b 45 f4 mov -0xc(%ebp),%eax 794: 8b 10 mov (%eax),%edx 796: 8b 45 f0 mov -0x10(%ebp),%eax 799: 89 10 mov %edx,(%eax) 79b: eb 26 jmp 7c3 <malloc+0x96> else { p->s.size -= nunits; 79d: 8b 45 f4 mov -0xc(%ebp),%eax 7a0: 8b 40 04 mov 0x4(%eax),%eax 7a3: 2b 45 ec sub -0x14(%ebp),%eax 7a6: 89 c2 mov %eax,%edx 7a8: 8b 45 f4 mov -0xc(%ebp),%eax 7ab: 89 50 04 mov %edx,0x4(%eax) p += p->s.size; 7ae: 8b 45 f4 mov -0xc(%ebp),%eax 7b1: 8b 40 04 mov 0x4(%eax),%eax 7b4: c1 e0 03 shl $0x3,%eax 7b7: 01 45 f4 add %eax,-0xc(%ebp) p->s.size = nunits; 7ba: 8b 45 f4 mov -0xc(%ebp),%eax 7bd: 8b 55 ec mov -0x14(%ebp),%edx 7c0: 89 50 04 mov %edx,0x4(%eax) } freep = prevp; 7c3: 8b 45 f0 mov -0x10(%ebp),%eax 7c6: a3 a8 0a 00 00 mov %eax,0xaa8 return (void*)(p + 1); 7cb: 8b 45 f4 mov -0xc(%ebp),%eax 7ce: 83 c0 08 add $0x8,%eax 7d1: eb 3b jmp 80e <malloc+0xe1> } if(p == freep) 7d3: a1 a8 0a 00 00 mov 0xaa8,%eax 7d8: 39 45 f4 cmp %eax,-0xc(%ebp) 7db: 75 1e jne 7fb <malloc+0xce> if((p = morecore(nunits)) == 0) 7dd: 83 ec 0c sub $0xc,%esp 7e0: ff 75 ec pushl -0x14(%ebp) 7e3: e8 e5 fe ff ff call 6cd <morecore> 7e8: 83 c4 10 add $0x10,%esp 7eb: 89 45 f4 mov %eax,-0xc(%ebp) 7ee: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 7f2: 75 07 jne 7fb <malloc+0xce> return 0; 7f4: b8 00 00 00 00 mov $0x0,%eax 7f9: eb 13 jmp 80e <malloc+0xe1> nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 7fb: 8b 45 f4 mov -0xc(%ebp),%eax 7fe: 89 45 f0 mov %eax,-0x10(%ebp) 801: 8b 45 f4 mov -0xc(%ebp),%eax 804: 8b 00 mov (%eax),%eax 806: 89 45 f4 mov %eax,-0xc(%ebp) return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } 809: e9 6d ff ff ff jmp 77b <malloc+0x4e> } 80e: c9 leave 80f: c3 ret
Source/Levels/L1300.asm
AbePralle/FGB
0
166956
; L1300.asm appomattox interior ; Generated 02.16.2001 by mlevel ; Modified 02.16.2001 by <NAME> INCLUDE "Source/Defs.inc" INCLUDE "Source/Levels.inc" INCLUDE "Source/Start.inc" DICEINDEX EQU 6 GRENADE_INDEX EQU 170 BAINDEX EQU 173 BSINDEX EQU 174 HAIKUINDEX EQU 175 VAR_DICELIGHT EQU 0 VAR_HEROESUSED EQU 1 VAR_BA EQU 2 VAR_BS EQU 3 VAR_HAIKU EQU 4 ;--------------------------------------------------------------------- SECTION "Level1300Section",ROMX ;--------------------------------------------------------------------- L1300_Contents:: DW L1300_Load DW L1300_Init DW L1300_Check DW L1300_Map ;--------------------------------------------------------------------- ; Load ;--------------------------------------------------------------------- L1300_Load: DW ((L1300_LoadFinished - L1300_Load2)) ;size L1300_Load2: call ParseMap ;reset heroes to full health xor a ld [hero0_health],a ld [hero1_health],a ret L1300_LoadFinished: ;--------------------------------------------------------------------- ; Map ;--------------------------------------------------------------------- L1300_Map: INCBIN "Data/Levels/L1300_appomattox.lvl" ;--------------------------------------------------------------------- ; Init ;--------------------------------------------------------------------- L1300_Init: DW ((L1300_InitFinished - L1300_Init2)) ;size L1300_Init2: ld a,BANK(main_in_game_gbm) ld hl,main_in_game_gbm call InitMusic ld hl,$1100 call SetJoinMap call SetRespawnMap ld a,[bgTileMap+DICEINDEX] ;tile index of first light ld [levelVars+VAR_DICELIGHT],a ld a,0 ld [levelVars+VAR_HEROESUSED],a ld a,TILEINDEXBANK ldio [$ff70],a ld a,[fgTileMap+BAINDEX] ld [levelVars+VAR_BA],a ld a,[fgTileMap+BSINDEX] ld [levelVars+VAR_BS],a ld a,[fgTileMap+HAIKUINDEX] ld [levelVars+VAR_HAIKU],a ;get rid of king grenade if he's not available ld a,[heroesAvailable] and HERO_GRENADE_FLAG jr nz,.afterRemoveKingGrenade ld bc,classGeneric call DeleteObjectsOfClass .afterRemoveKingGrenade ;link down exit to appomattox map ld a,[appomattoxMapIndex] or a jr z,.afterLinkDownExit ;convert map index to 16-bit BCD index ld b,a and %1111 call NumberToBCD ld d,a ld a,b swap a and %1111 call NumberToBCD ld e,a IF FORCE_EXIT ld de,FORCE_EXIT_MAP ENDC ;store in exit list ld hl,mapExitLinks+EXIT_D*2 ld [hl],e inc hl ld [hl],d .afterLinkDownExit ;if player is king grenade and appx is not at base camp, ;set exit to "back inside" level LDHL_CURHERODATA HERODATA_TYPE ld a,[hl] cp HERO_GRENADE_FLAG jr nz,.afterLinkGrenade ld a,[appomattoxMapIndex] cp $000a jr z,.afterLinkGrenade ld de,$1304 ld hl,mapExitLinks+EXIT_D*2 ld [hl],e inc hl ld [hl],d .afterLinkGrenade ;kill north exit (flight) if at space station ld a,[appomattoxMapIndex] cp $b7 jr nz,.afterApocalypse ld de,$4040 ;null exit ld hl,mapExitLinks+EXIT_N*2 ld [hl],e inc hl ld [hl],d .afterApocalypse ret L1300_InitFinished: ;--------------------------------------------------------------------- ; Check ;--------------------------------------------------------------------- L1300_Check: DW ((L1300_CheckFinished - L1300_Check2)) ;size L1300_Check2: call ((.animateDiceLights-L1300_Check2)+levelCheckRAM) ld a,[levelVars+VAR_HEROESUSED] ld hl,heroesUsed xor [hl] jr z,.afterChangeLounge ld a,[hl] ld [levelVars+VAR_HEROESUSED],a ld b,a bit HERO_BA_BIT,b jr z,.BAinLounge call ((.removeBA-L1300_Check2)+levelCheckRAM) jr .afterCheckBA .BAinLounge call ((.addBA-L1300_Check2)+levelCheckRAM) .afterCheckBA bit HERO_BS_BIT,b jr z,.BSinLounge call ((.removeBS-L1300_Check2)+levelCheckRAM) jr .afterCheckBS .BSinLounge call ((.addBS-L1300_Check2)+levelCheckRAM) .afterCheckBS bit HERO_HAIKU_BIT,b jr z,.HaikuInLounge call ((.removeHaiku-L1300_Check2)+levelCheckRAM) jr .afterCheckHaiku .HaikuInLounge call ((.addHaiku-L1300_Check2)+levelCheckRAM) .afterCheckHaiku bit HERO_GRENADE_BIT,b jr z,.GrenadeInLounge call ((.removeGrenade-L1300_Check2)+levelCheckRAM) jr .afterCheckGrenade .GrenadeInLounge call ((.addGrenade-L1300_Check2)+levelCheckRAM) .afterCheckGrenade .afterChangeLounge ret .removeHaiku ld c,HAIKUINDEX jr .removeIndex .removeBS ld c,BSINDEX jr .removeIndex .removeBA ld c,BAINDEX .removeIndex push bc ld a,TILEINDEXBANK ldio [$ff70],a ld l,c ld h,((fgTileMap>>8)&$ff) ld [hl],$ff call GetFirst ld b,METHOD_DRAW call CallMethod pop bc ret .removeGrenade ld bc,classGeneric call DeleteObjectsOfClass ret .addHaiku ld l,HAIKUINDEX ld a,[levelVars+VAR_HAIKU] jr .addIndex .addBS ld l,BSINDEX ld a,[levelVars+VAR_BS] jr .addIndex .addBA ld l,BAINDEX ld a,[levelVars+VAR_BA] .addIndex push bc ld c,a ld a,TILEINDEXBANK ldio [$ff70],a ld a,c ld h,((fgTileMap>>8)&$ff) ld [hl],a ld c,l call GetFirst ld b,METHOD_DRAW call CallMethod pop bc ret .addGrenade ld a,[heroesAvailable] and HERO_GRENADE_FLAG ret z ld c,GRENADE_INDEX call GetFirst or a ret nz ;already exists ld hl,$d253 call CreateInitAndDrawObject ret .animateDiceLights ;animate dice lights ld a,[levelVars+VAR_DICELIGHT] ld b,a ;slow lights ldio a,[updateTimer] swap a and %00000011 add b ld hl,bgTileMap+DICEINDEX call ((.updateTwoLights - L1300_Check2) + levelCheckRAM) ;fast lights ldio a,[updateTimer] swap a rlca and %00000011 add b call ((.updateTwoLights - L1300_Check2) + levelCheckRAM) ret .updateTwoLights ld [hl+],a call ((.incCount4 - L1300_Check2) + levelCheckRAM) ld [hl+],a ret .incCount4 sub b inc a and %00000011 add b ret L1300_CheckFinished: PRINT "1300 Script Sizes (Load/Init/Check) (of $500): " PRINT (L1300_LoadFinished - L1300_Load2) PRINT " / " PRINT (L1300_InitFinished - L1300_Init2) PRINT " / " PRINT (L1300_CheckFinished - L1300_Check2) PRINT "\n"
src/options_dialog_console.adb
kraileth/ravenadm
18
21569
<gh_stars>10-100 -- This file is covered by the Internet Software Consortium (ISC) License -- Reference: ../License.txt with Ada.Text_IO; package body Options_Dialog_Console is package TIO renames Ada.Text_IO; -------------------------------------------------------------------------------------------- -- check_ravenports_version -------------------------------------------------------------------------------------------- function launch_dialog (specification : in out PSP.Portspecs) return Boolean is pragma Unreferenced (specification); begin TIO.Put_Line ("ravenadm has been built without curses support."); TIO.Put_Line ("The ability to change standard options is therefore disabled."); return False; end launch_dialog; end Options_Dialog_Console;
test/interaction/DoNotEtaContractFunIntoRecord.agda
cruhland/agda
1,989
5666
-- Andreas, 2013-09-17 module DoNotEtaContractFunIntoRecord where record _×_ (A B : Set) : Set where constructor _,_ field fst : A snd : B postulate A : Set B : Set P : (B → A × B) → Set goal : (x : A) → P (λ y → x , y) goal x = {!!} -- Goal should be displayed as -- P (λ y → x , y) -- rather than as -- P (_,_ x)
source/web/wsse/web_services-soap-security-headers-encoders.adb
svn2github/matreshka
24
22241
<filename>source/web/wsse/web_services-soap-security-headers-encoders.adb ------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012-2015, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with League.Base_Codecs; with XML.SAX.Attributes; with Web_Services.SOAP.Constants; with Web_Services.SOAP.Security.Constants; package body Web_Services.SOAP.Security.Headers.Encoders is ------------ -- Create -- ------------ overriding function Create (Dummy : not null access Boolean) return Security_Header_Encoder is pragma Unreferenced (Dummy); begin return Self : Security_Header_Encoder; end Create; ------------ -- Encode -- ------------ overriding procedure Encode (Self : Security_Header_Encoder; Header : Web_Services.SOAP.Headers.Abstract_SOAP_Header'Class; Writer : in out XML.SAX.Writers.SAX_Writer'Class) is pragma Unreferenced (Self); use Web_Services.SOAP.Constants; use Web_Services.SOAP.Security.Constants; Attributes : XML.SAX.Attributes.SAX_Attributes; Token : Username_Token_Header renames Username_Token_Header (Header); begin Writer.Start_Prefix_Mapping (WSSE_Namespace_Prefix, WSSE_Namespace_URI); Writer.Start_Prefix_Mapping (WSU_Namespace_Prefix, WSU_Namespace_URI); Attributes.Set_Value (SOAP_Envelope_URI, SOAP_Must_Understand_Name, SOAP_True_Literal); Writer.Start_Element (WSSE_Namespace_URI, Security_Element, Attributes); -- Username token. Attributes.Clear; Attributes.Set_Value (WSU_Namespace_URI, Id_Attribute, Id_Attribute_Value); Writer.Start_Element (WSSE_Namespace_URI, Username_Token_Element, Attributes); Writer.Start_Element (WSSE_Namespace_URI, Username_Element); Writer.Characters (Token.Username); Writer.End_Element (WSSE_Namespace_URI, Username_Element); case Token.Mode is when Text => -- Serialize wsse:Password only. Attributes.Clear; Attributes.Set_Value (Type_Attribute, Password_Text_URI); Writer.Start_Element (WSSE_Namespace_URI, Password_Element, Attributes); Writer.Characters (Token.Password); Writer.End_Element (WSSE_Namespace_URI, Password_Element); when Digest => -- Serialize wsse:Password, wsse:Nonce and wsu:Created. Attributes.Clear; Attributes.Set_Value (Type_Attribute, Password_Digest_URI); Writer.Start_Element (WSSE_Namespace_URI, Password_Element, Attributes); Writer.Characters (League.Base_Codecs.To_Base_64 (Token.Digest)); Writer.End_Element (WSSE_Namespace_URI, Password_Element); Writer.Start_Element (WSSE_Namespace_URI, Nonce_Element); Writer.Characters (League.Base_Codecs.To_Base_64 (Token.Nonce)); Writer.End_Element (WSSE_Namespace_URI, Nonce_Element); Writer.Start_Element (WSU_Namespace_URI, Created_Element); Writer.Characters (Token.Created); Writer.End_Element (WSU_Namespace_URI, Created_Element); end case; Writer.End_Element (WSSE_Namespace_URI, Username_Token_Element); Writer.End_Element (WSSE_Namespace_URI, Security_Element); end Encode; end Web_Services.SOAP.Security.Headers.Encoders;
src/Shaders/Sdk/Direct3D11/FluidCS11/FluidCS11_DensityCS_Shared.asm
tgjones/slimshader-cpp
20
24186
// // Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384 // // /// // Buffer Definitions: // // cbuffer cbSimulationConstants // { // // uint g_iNumParticles; // Offset: 0 Size: 4 // float g_fTimeStep; // Offset: 4 Size: 4 [unused] // float g_fSmoothlen; // Offset: 8 Size: 4 // float g_fPressureStiffness; // Offset: 12 Size: 4 [unused] // float g_fRestDensity; // Offset: 16 Size: 4 [unused] // float g_fDensityCoef; // Offset: 20 Size: 4 // float g_fGradPressureCoef; // Offset: 24 Size: 4 [unused] // float g_fLapViscosityCoef; // Offset: 28 Size: 4 [unused] // float g_fWallStiffness; // Offset: 32 Size: 4 [unused] // float4 g_vGravity; // Offset: 48 Size: 16 [unused] // float4 g_vGridDim; // Offset: 64 Size: 16 [unused] // float3 g_vPlanes[4]; // Offset: 80 Size: 60 [unused] // // } // // Resource bind info for ParticlesRO // { // // struct Particle // { // // float2 position; // Offset: 0 // float2 velocity; // Offset: 8 // // } $Element; // Offset: 0 Size: 16 // // } // // Resource bind info for ParticlesDensityRW // { // // struct ParticleDensity // { // // float density; // Offset: 0 // // } $Element; // Offset: 0 Size: 4 // // } // // // Resource Bindings: // // Name Type Format Dim Slot Elements // ------------------------------ ---------- ------- ----------- ---- -------- // ParticlesRO texture struct r/o 0 1 // ParticlesDensityRW UAV struct r/w 0 1 // cbSimulationConstants cbuffer NA NA 0 1 // // // // Input signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // no Input // // Output signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // no Output cs_5_0 dcl_globalFlags refactoringAllowed dcl_constantbuffer cb0[2], immediateIndexed dcl_resource_structured t0, 16 dcl_uav_structured u0, 4 dcl_input vThreadIDInGroupFlattened dcl_input vThreadID.x dcl_temps 3 dcl_tgsm_structured g0, 8, 256 dcl_thread_group 256, 1, 1 mul r0.x, cb0[0].z, cb0[0].z ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r0.yz, vThreadID.x, l(0), t0.xxyx mov r0.w, l(0) mov r1.x, l(0) loop uge r1.y, r1.x, cb0[0].x breakc_nz r1.y iadd r1.y, r1.x, vThreadIDInGroupFlattened.x ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r1.yz, r1.y, l(0), t0.xxyx store_structured g0.xy, vThreadIDInGroupFlattened.x, l(0), r1.yzyy sync_g_t mov r1.y, r0.w mov r1.z, l(0) loop uge r1.w, r1.z, l(256) breakc_nz r1.w ld_structured r2.xy, r1.z, l(0), g0.xyxx add r2.xy, -r0.yzyy, r2.xyxx dp2 r1.w, r2.xyxx, r2.xyxx lt r2.x, r1.w, r0.x mad r1.w, cb0[0].z, cb0[0].z, -r1.w mul r2.y, r1.w, r1.w mul r2.y, r2.y, cb0[1].y mad r1.w, r2.y, r1.w, r1.y movc r1.y, r2.x, r1.w, r1.y iadd r1.z, r1.z, l(1) endloop mov r0.w, r1.y sync_g_t iadd r1.x, r1.x, l(256) endloop store_structured u0.x, vThreadID.x, l(0), r0.w ret // Approximately 33 instruction slots used
libc/string/memcpy.asm
BernieGurs/MonkOS
132
170276
;============================================================================= ; @file memcpy.asm ; @brief Copy bytes from one memory region to another. ; ; Copyright 2016 <NAME>. ; Use of this source code is governed by a BSD-style license that can ; be found in the MonkOS LICENSE file. ;============================================================================= bits 64 section .text global memcpy ;----------------------------------------------------------------------------- ; @function memcpy ; @brief Copy bytes from one memory region to another. ; @details If the memory regions overlap, this function's behavior ; is undefined, and you should use memmove instead. ; @reg[in] rdi Address of the destination memory area. ; @reg[in] rsi Address of the source memory area. ; @reg[in] rdx Number of bytes to copy. ; @reg[out] rax Destination address. ; @killedregs rcx ;----------------------------------------------------------------------------- memcpy: ; Preserve destination address because we have to return it. mov rax, rdi ; Do a byte-by-byte move. On modern x86 chips, there is not a significant ; performance difference between byte-wise and word-wise moves. In fact, ; sometimes movsb is faster. See instlatx64.atw.hu for benchmarks. mov rcx, rdx rep movsb ret
models/tests/test74.als
transclosure/Amalgam
4
1079
module tests/test open util/integer sig LongString, Email, Date, DateTime { } enum Stringz { StringAlex, StringBrian, StringEmina, StringDaniel, StringFelix, StringIan, StringJukka, StringMIT, StringNokia, StringWindowsDiscussion, StringLinuxDiscussion, StringMachineLearning, StringNumericOptimization, StringTrueMultithreading, StringEfficientCompilerConstruction, StringHowToOptimize, StringHelpNeeded } enum Boolean { True, False } abstract sig Entity { owners: set Entity, created: DateTime, lastModified: DateTime } one sig me in Entity { } abstract sig LoginUser extends Entity { suspended: Boolean, email: disjoint Email, password: <PASSWORD> } // magic GUI support one sig ADD1, ADD2, DELETE1, DELETE2 { } enum Action { R, A, D, AS, DS } fun W: set Action { A+D } fun RW: set Action { R+W } let ADD = ADD1->ADD2 let DELETE = DELETE1->DELETE2 fun own: set Entity { Entity } fun policy : univ -> univ -> univ { R -> me -> (LoginUser$email + User$getMail) + (A+D) -> (me.super=True => Entity else none) -> field$ + (R+A+D) -> own -> (field$ - Entity$owners - Entity$created - Entity$lastModified - User$super - LoginUser$suspended - Topic$replies - Topic$pinned - Topic$readOnly) + DS -> Group -> Group$members + ADD -> (me.super=True => (User$ + Group$ + Talk$ + Forum$ + Topic$ + Msg$) else (Group$ + Talk$ + Topic$ + Msg$)) + DELETE -> own } sig User extends LoginUser { name : disjoint Stringz, bio : lone LongString, super : Boolean, getMail : Boolean } fun User.groups : set Group { members.(user.this) } fun User.points : Int { 25.mul[#(Talk<:owners . this)] + 20.mul[#(Msg<:owners . this)] } --------------------------------------------------------------------------------------------------------------------------------------------------------- sig Group extends Entity { name : disjoint Stringz, descr : lone LongString, homeMsg : lone LongString, restricted : Boolean, members : set Member } fun Group.admins : set User { (type.GroupAdmin & this.members).user } sig Member { user: disjoint User, type: Type } enum Type { GroupAdmin, Regular, Tentative } pred members.onAdd { let g=this.univ, u=univ.this.user, t=univ.this.type { me !in g.admins => (u=me && (g.restricted=False => t=Regular else t=Tentative)) } } sig Talk extends Entity { title : Stringz, datetime : DateTime, location : lone LongString, descr : lone LongString, speakers : some Stringz, tags : set Group } { tags in owners.groups } sig Forum extends Entity { name : disjoint Stringz, descr : lone LongString, weight : Int, readOnly : Boolean, topics : set Topic } fun Forum.numTopics : Int { #(this.topics) } fun Forum.numText : Int { #(this.topics) + #(this.topics.replies) } sig Topic extends Entity { title : Stringz, text : LongString, pinned : Boolean, readOnly : Boolean, replies : set Msg } fun Topic.parent : Forum { topics.this } fun Topic.numReplies : Int { #(this.replies) } fun Topic.firstAuthor : User { this.owners } fun Topic.firstDate : DateTime { this.created } pred Topic.onAdd { me.super = True || this.pinned + this.readOnly + this.parent.readOnly = False } sig Msg extends Entity { text : LongString } fun Msg.parent : Topic { replies.this } pred Msg.onAdd { me.super = True || this.parent.readOnly = False } run { let namez = StringAlex + StringBrian + StringEmina + StringDaniel + StringFelix + StringIan + StringJukka | let groupz = StringMIT + StringNokia | let forumz = StringWindowsDiscussion + StringLinuxDiscussion | let talkz = StringMachineLearning + StringNumericOptimization + StringTrueMultithreading + StringEfficientCompilerConstruction | let topicz = StringHowToOptimize + StringHelpNeeded | { (!lone User) (all x:Entity | some x.owners) (all x:Entity | x.owners in User) (all x:User | some x.bio && x.name in namez && some x.groups) (all x:Group | some x.descr && some x.homeMsg && some {g:x.members | g.type=GroupAdmin} && some {g:x.members | g.type=Regular} && some {g:x.members | g.type=Tentative} && x.name in groupz) (all x:Talk | some x.location) (all x:Talk | some x.descr) (all x:Talk | some x.tags) (all x:Talk | x.title in talkz) (all x:Forum | some x.descr && x.name in forumz) (all x:Topic | x.title in topicz) (all disj x, y: Topic | x.title != y.title) (all disj x, y: Talk | x.title != y.title) (all disj x, y: Msg | x.text != y.text) } } for 7 but 1 DateTime, exactly 7 User, exactly 2 Group, exactly 4 Talk, exactly 2 Forum, exactly 2 Topic, exactly 4 Msg expect 1
ray_tracer-integrators.ads
FROL256/ada-ray-tracer
3
23861
with Interfaces; with Ada.Numerics.Float_Random; with Ada.Assertions; with Vector_Math; with Materials; with Ada.Unchecked_Deallocation; with Ray_Tracer; use Interfaces; use Vector_Math; use Materials; use Ada.Assertions; use Ray_Tracer; private package Ray_Tracer.Integrators is --------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------- -- integrators -- type Integrator is abstract tagged record gen : RandRef := null; end record; type IntegratorRef is access Integrator'Class; function PathTrace(self : Integrator; r : Ray; prevSample : MatSample; recursion_level : Integer) return float3 is abstract; procedure Init(self : in out Integrator) is abstract; procedure DoPass(self : in out Integrator; colBuff : AccumBuffRef); -- stupid path tracer -- type SimplePathTracer is new Integrator with null record; procedure Init(self : in out SimplePathTracer); function PathTrace(self : SimplePathTracer; r : Ray; prevSample : MatSample; recursion_level : Integer) return float3; -- path tracer with shadow rays -- type PathTracerWithShadowRays is new Integrator with null record; procedure Init(self : in out PathTracerWithShadowRays); function PathTrace(self : PathTracerWithShadowRays; r : Ray; prevSample : MatSample; recursion_level : Integer) return float3; -- path tracer with MIS -- type PathTracerMIS is new Integrator with null record; procedure Init(self : in out PathTracerMIS); function PathTrace(self : PathTracerMIS; r : Ray; prevSample : MatSample; recursion_level : Integer) return float3; end Ray_Tracer.Integrators;
Transynther/x86/_processed/AVXALIGN/_st_sm_/i9-9900K_12_0xca_notsx.log_18535_1502.asm
ljhsiun2/medusa
9
172430
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r12 push %r9 push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_WT_ht+0x1ad13, %r9 nop nop nop add %r11, %r11 mov $0x6162636465666768, %r10 movq %r10, (%r9) nop nop nop nop cmp %rcx, %rcx lea addresses_WC_ht+0x77, %rdx nop nop inc %r12 movl $0x61626364, (%rdx) nop add %r12, %r12 lea addresses_D_ht+0x168f7, %rcx nop inc %r12 movb $0x61, (%rcx) nop nop nop nop sub %rdx, %rdx lea addresses_normal_ht+0xb977, %rbp clflush (%rbp) sub %r9, %r9 movups (%rbp), %xmm3 vpextrq $1, %xmm3, %rdx nop nop and %r11, %r11 lea addresses_D_ht+0x8877, %rbp nop nop nop add $40863, %r12 mov $0x6162636465666768, %rcx movq %rcx, %xmm6 vmovups %ymm6, (%rbp) nop nop add $56166, %r9 lea addresses_D_ht+0x16077, %rsi lea addresses_UC_ht+0x12477, %rdi sub %rdx, %rdx mov $90, %rcx rep movsl nop nop cmp $65083, %r10 lea addresses_WC_ht+0x157f7, %rbp nop nop xor %r9, %r9 movb (%rbp), %dl nop nop nop sub $62134, %rcx lea addresses_normal_ht+0xaff7, %rbp nop nop nop nop sub $35475, %r11 movb (%rbp), %r9b nop nop dec %rbp lea addresses_D_ht+0x130ff, %rcx cmp %r9, %r9 movb (%rcx), %r10b sub %rdi, %rdi lea addresses_normal_ht+0xa577, %rdx nop add $60430, %rsi movw $0x6162, (%rdx) add %rcx, %rcx lea addresses_WC_ht+0x1777, %rdi xor $19288, %rdx mov (%rdi), %r12w nop nop nop dec %r12 lea addresses_D_ht+0x1d1fd, %r12 and %r11, %r11 movl $0x61626364, (%r12) nop nop nop cmp %rsi, %rsi lea addresses_UC_ht+0xb350, %rsi lea addresses_D_ht+0x1cc77, %rdi nop nop nop nop nop sub $14531, %r10 mov $30, %rcx rep movsw nop nop nop add $9793, %r12 lea addresses_normal_ht+0x16877, %r12 nop nop nop xor %rcx, %rcx movb (%r12), %r10b and $52157, %rdi lea addresses_WC_ht+0x16e97, %rcx nop nop nop nop xor %rdi, %rdi movb (%rcx), %r11b nop nop nop dec %rdi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r9 pop %r12 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r15 push %r8 push %r9 push %rbp push %rcx push %rdi push %rdx push %rsi // Store lea addresses_D+0x1c969, %r8 nop nop nop nop nop xor %r9, %r9 movl $0x51525354, (%r8) nop sub $59360, %rdx // Store lea addresses_WT+0xd877, %r8 nop nop xor %rsi, %rsi movb $0x51, (%r8) nop sub %rsi, %rsi // Store lea addresses_WC+0x72b7, %r15 nop sub $6563, %rdx mov $0x5152535455565758, %rbp movq %rbp, %xmm1 movups %xmm1, (%r15) and $56899, %r12 // Store lea addresses_PSE+0x1e077, %r12 nop inc %rdx movl $0x51525354, (%r12) nop nop and $44840, %r12 // REPMOV lea addresses_PSE+0x1e077, %rsi lea addresses_WC+0x921f, %rdi nop nop nop nop mfence mov $88, %rcx rep movsq nop nop nop nop nop xor $6745, %rdi // Store lea addresses_A+0x1fff3, %rdx nop nop nop nop nop and %rbp, %rbp movb $0x51, (%rdx) nop nop nop nop xor $41775, %rdx // Store lea addresses_A+0x19e37, %rbp nop cmp $46849, %r15 mov $0x5152535455565758, %rdx movq %rdx, %xmm3 vmovntdq %ymm3, (%rbp) nop nop add $52948, %rdi // Store lea addresses_PSE+0x1e077, %rdx nop nop add $48428, %r8 movl $0x51525354, (%rdx) nop nop nop nop nop xor %r12, %r12 // Faulty Load lea addresses_PSE+0x1e077, %r15 nop nop nop and %r9, %r9 mov (%r15), %di lea oracles, %rsi and $0xff, %rdi shlq $12, %rdi mov (%rsi,%rdi,1), %rdi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r9 pop %r8 pop %r15 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 1}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 10}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 4}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}} {'OP': 'REPM', 'src': {'same': True, 'congruent': 0, 'type': 'addresses_PSE'}, 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_WC'}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A', 'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 6}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': True, 'size': 2, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 1}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 10}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 7}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 6}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 10}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_D_ht'}, 'dst': {'same': True, 'congruent': 10, 'type': 'addresses_UC_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 6}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 5}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 3}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 8}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 7}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 1}} {'OP': 'REPM', 'src': {'same': True, 'congruent': 0, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_D_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 8}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 2}} {'54': 18535} 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 */
programs/oeis/186/A186707.asm
neoneye/loda
22
6295
<reponame>neoneye/loda<gh_stars>10-100 ; A186707: Partial sums of A007202 (crystal ball sequence for hexagonal close-packing). ; 1,14,71,224,547,1134,2101,3584,5741,8750,12811,18144,24991,33614,44297,57344,73081,91854,114031,140000,170171,204974,244861,290304,341797,399854,465011,537824,618871,708750,808081,917504,1037681,1169294,1313047,1469664,1639891,1824494,2024261,2240000,2472541,2722734,2991451,3279584,3588047,3917774,4269721,4644864,5044201,5468750,5919551,6397664,6904171,7440174,8006797,8605184,9236501,9901934,10602691,11340000,12115111,12929294,13783841,14680064,15619297,16602894,17632231,18708704,19833731,21008750,22235221,23514624,24848461,26238254,27685547,29191904,30758911,32388174,34081321,35840000,37665881,39560654,41526031,43563744,45675547,47863214,50128541,52473344,54899461,57408750,60003091,62684384,65454551,68315534,71269297,74317824,77463121,80707214,84052151,87500000 mov $1,2 mov $2,$0 add $2,1 pow $2,4 mul $1,$2 div $2,4 sub $1,$2 sub $1,2 div $1,2 add $1,1 mov $0,$1
src/asf-components-ajax-includes.ads
jquorning/ada-asf
12
21216
----------------------------------------------------------------------- -- components-ajax-includes -- AJAX Include component -- Copyright (C) 2011 <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 ASF.Components.Html; with ASF.Contexts.Faces; package ASF.Components.Ajax.Includes is -- @attribute -- Defines whether the inclusion is asynchronous or not. -- When true, an AJAX call will be made by the client browser to fetch the content. -- When false, the view is included in the current component tree. ASYNC_ATTR_NAME : constant String := "async"; -- @attribute -- Defines the HTML container element that will contain the included view. LAYOUT_ATTR_NAME : constant String := "layout"; -- @attribute -- Defines the view name to include. SRC_ATTR_NAME : constant String := "src"; -- @tag include -- The <b>ajax:include</b> component allows to include type UIInclude is new ASF.Components.Html.UIHtmlComponent with private; -- Get the HTML layout that must be used for the include container. -- The default layout is a "div". -- Returns "div", "span", "pre", "b". function Get_Layout (UI : in UIInclude; Context : in ASF.Contexts.Faces.Faces_Context'Class) return String; -- The included XHTML file is rendered according to the <b>async</b> attribute: -- -- When <b>async</b> is false, render the specified XHTML file in such a way that inner -- forms will be posted on the included view. -- -- When <b>async</b> is true, trigger an AJAX call to include the specified -- XHTML view when the page is loaded. -- -- overriding procedure Encode_Children (UI : in UIInclude; Context : in out ASF.Contexts.Faces.Faces_Context'Class); private type UIInclude is new ASF.Components.Html.UIHtmlComponent with null record; end ASF.Components.Ajax.Includes;
Library/SpecUI/CommonUI/CWin/cwinBase.asm
steakknife/pcgeos
504
87237
<reponame>steakknife/pcgeos<gh_stars>100-1000 COMMENT @---------------------------------------------------------------------- Copyright (c) GeoWorks 1988-1994 -- All Rights Reserved GEOWORKS CONFIDENTIAL PROJECT: GEOS MODULE: CommonUI/CWin (common code for several specific ui's) FILE: cwinBase.asm ROUTINES: Name Description ---- ----------- MTD MSG_META_INITIALIZE Initialize an open look base window INT BaseWinAttrGenDisplayNotMinimizable Initialize an open look base window INT BaseWinAttrGenDisplayNotMaximizable Initialize an open look base window INT BaseWinAttrGenDisplayNotRestorable Initialize an open look base window INT BaseWinHintDisplayNotResizable Initialize an open look base window INT BaseWinHintNoExpressMenu Initialize an open look base window INT MakeNotResizableIfKeyboardOnly Clear the OWA_RESIZABLE bit if user is working with a keyboard only, i.e. no mouse MTD MSG_SPEC_SCAN_GEOMETRY_HINTS Scans geometry hints. INT AA_DerefVisSpec_DI Scans geometry hints. MTD MSG_SPEC_BUILD_BRANCH INT AddPrimaryHelp Add a help trigger to the primary if requested INT AddPrimaryKeyboard Add a floating keyboard trigger to the right side of titlebar MTD MSG_SPEC_BUILD Make sure this window is added to the window list INT EnsureItemAddedToWindowList Make sure this window is added to the window list. MTD MSG_SPEC_UPDATE_VIS_MONIKER If a new moniker is set, then we need to update the entry in the Window List MTD MSG_OL_BASE_WIN_UPDATE_WINDOW_ENTRY Update window list selection MTD MSG_META_NOTIFY_TASK_SELECTED Bring window to front. MTD MSG_META_NOTIFY_TASK_SELECTED Notify window that it has been selected. MTD MSG_OL_WINDOW_LIST_ITEM_SET_OPERATING_PARAMS Save data. MTD MSG_OL_WINDOW_LIST_ITEM_CLOSE_WINDOW Close window MTD MSG_META_KBD_CHAR Handle keyboard events for WindowListItem. INT EnsureFileMenu Make sure we have a File menu. INT EnsureAppMenu Make sure we have an app menu trigger. INT EnsureMoreTrigger Add a "More" Button to the menu bar. INT EnsureJotterControl Add a Jotter Control. INT CheckForJotterControl see if this child is a JotterControl MTD MSG_OL_BASE_WIN_REBUILD_APP_MENU_BUTTON rebuild App menu button MTD MSG_OL_BASE_WIN_NOTIFY_OF_FILE_MENU notification that "File" menu exists INT OLBaseWinDetermineInitialMinimizedStatus See if this app should come up minimized MTD MSG_META_UPDATE_WINDOW *ds:si - instance data (for object in OLBaseWin class) es - segment of OLBaseWinClass ax - MSG_META_UPDATE_WINDOW cx - UpdateWindowFlags dl - VisUpdateMode INT RemoveTitleBarIfPossible RemoveTitleBarIfPossible INT OLBaseWinDetermineInitialMaximizedStatus Determine intitial MAXIMIZED status for this primary window. At this time, always preserve state if restoring from state. If coming up fresh, we generally rely on application hints, though override forcing maximization in certain situations NOTE: UIWO_MAXIMIZE_ON_STARTUP is set in SpecInit, called when this library is first loaded. MTD MSG_SPEC_UNBUILD Remove this window from the window list before doing normal unbuild. INT OLBaseWinRemoveSpecBuildCreatedObjects remove ui objects added to this OLBaseWin during spec build INT OLBWRSBO_destroyIfFound remove ui objects added to this OLBaseWin during spec build INT OLBWRSBO_genDestroy remove ui objects added to this OLBaseWin during spec build INT RemoveAppMenuButton remove creatd App menu button INT EnsureItemRemovedFromWindowList Ensures that this window is removed from the window list MTD MSG_VIS_COMP_GET_MINIMUM_SIZE Returns the minimum size for a window. MTD MSG_GEN_DISPLAY_SET_MINIMIZED Moves base window off-screen, then performs superclass action MTD MSG_GEN_DISPLAY_SET_NOT_MINIMIZED Call superclass and update express menu INT OLWinMoveOffScreen Move window off-screen, so it will not be visible MTD MSG_META_GAINED_SYS_TARGET_EXCL We intercept this method here so that we can update the TaskEntry in the express menu. INT UpdateAppMenuItemCommon We intercept this method here so that we can update the TaskEntry in the express menu. INT OLRedoMenuBarGeometryIfMenusInHeader We intercept this method here so that we can update the TaskEntry in the express menu. INT OLBaseWinHideExpressToolArea Hide the express tool area by moving it off screen INT OLBaseWinAdjustTitleBoundsForExpressToolArea Adjusts bounds of title area to be smaller if this app currently has the express tool area associated with it. MTD MSG_META_LOST_SYS_TARGET_EXCL We intercept this method here so that we can release our hold on the express menu MTD MSG_META_GET_TARGET_AT_TARGET_LEVEL Returns current target object within this branch of the hierarchical target exclusive, at level requested MTD MSG_GEN_DISPLAY_CLOSE We intercept this method here because it has a distinct meaning to applications: QUIT! MTD MSG_VIS_OPEN Intercept MSG_VIS_OPEN so we can draw "zoom-lines" before the window comes up. MTD MSG_VIS_CLOSE Intercept this method here as the window is closing To see if we cna't find another suitable object to take the focus/target exclusives. INT DrawZoomLines Draw zoom lines before a window opens to indicate where the window was opened from. INT ZoomLinesStuffPositionHint If we are zooming all primarys (as opposed to just those with the HINT_PRIMARY_OPEN_ICON_BOUNDS hint) then when we don't encounter this hint we stuff it with the mouse position MTD MSG_GET_MENU_BAR_WIN Return the handle of the associated MenuBarWin if one exists MTD MSG_SPEC_GUP_QUERY Respond to a query traveling up the generic composite tree MTD MSG_GEN_PRIMARY_USE_LONG_TERM_MONIKER Switch to specific long term moniker. INT WinUncommon_DerefVisSpec_DI Switch to specific long term moniker. INT WinUncommon_ObjMessageCallFixupDS Switch to specific long term moniker. INT OLBaseWinDrawGCMIcon Draw the Exit or Help buttons in the header of this window. MTD MSG_OL_BASE_WIN_UPDATE_EXPRESS_TOOL_AREA This procedure positions the "express tool area", if this app current "has it" floating above it. Does NOT mess with the title bar bounds, just references them to figure out where the area should be moved. INT OLBaseWinEnableAndPositionHeaderIcon This procedure is used to position and enable the icons which appear in the header area of a window: - GCM "Exit" and "Help" icons - Workspace and Application menu buttons INT OLBaseWinPositionGCMHeaderIcons This procedure positions and enables the "Exit" and "Help" icons in the header when running in GC mode. MTD MSG_OL_WIN_UPDATE_FOR_TITLE_GROUP update express menu button, if any MTD MSG_OL_WIN_GET_HEADER_TITLE_BOUNDS Returns widths of icons left and right of title bar. INT OLBaseWinGetExpressMenuButtonWidth Returns width of window's system menu button. MTD MSG_META_FUP_KBD_CHAR This method is sent by child which 1) is the focused object and 2) has received a MSG_META_KBD_CHAR or MSG_META_FUP_KBD_CHAR which is does not care about. Since we also don't care about the character, we forward this method up to the parent in the focus hierarchy. At this class level, the parent in the focus hierarchy is is the generic parent. MTD MSG_SPEC_SET_USABLE Handle set-usable by maximizing OLBaseWin if HINT_DISPLAY_MAXIMIZED_ON_STARTUP is set. MTD MSG_SPEC_SET_USABLE Handle set-usable by maximizing OLBaseWin if HINT_DISPLAY_MAXIMIZED_ON_STARTUP is set. MTD MSG_OL_BASE_WIN_TOGGLE_MENU_BAR toggle menu bar, if togglable REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 2/89 Initial version Doug 6/89 Moved to winBase.asm from openBaseWin.asm Eric 7/89 Motif extensions Joon 7/92 PM extensions DESCRIPTION: $Id: cwinBase.asm,v 1.5 98/07/10 11:00:05 joon Exp $ ------------------------------------------------------------------------------@ CommonUIClassStructures segment resource OLBaseWinClass mask CLASSF_DISCARD_ON_SAVE or \ mask CLASSF_NEVER_SAVED if _ISUI OLWindowListItemClass mask CLASSF_DISCARD_ON_SAVE or \ mask CLASSF_NEVER_SAVED endif if RADIO_STATUS_ICON_ON_PRIMARY RadioStatusIconClass mask CLASSF_DISCARD_ON_SAVE or \ mask CLASSF_NEVER_SAVED endif CommonUIClassStructures ends ;--------------------------------------------------- WinCommon segment resource COMMENT @---------------------------------------------------------------------- METHOD: OLBaseWinInitialize -- MSG_META_INITIALIZE for OLBaseWinClass DESCRIPTION: Initialize an open look base window PASS: *ds:si - instance data es - segment of OLBaseWinClass ax - MSG_META_INITIALIZE cx, dx, bp - ? RETURN: carry - ? ax, cx, dx, bp - ? DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 2/89 Initial version Eric 7/89 Motif extensions, more documentation ------------------------------------------------------------------------------@ OLBaseWinInitialize method dynamic OLBaseWinClass, MSG_META_INITIALIZE ;set these for FindMonikers in OLMenuedWinInitalize, they may be ;reset by superclass, so we set them again later OLS < mov ds:[di].OLWI_type, OLWT_BASE_WINDOW > CUAS < mov ds:[di].OLWI_type, MOWT_PRIMARY_WINDOW > ;call superclass (do not call OpenWinInitialize directly!) mov di, offset OLBaseWinClass CallSuper MSG_META_INITIALIZE ; Initialize Visible characteristics that we'd like to have unless ; overridden by hints handling call WinCommon_DerefVisSpec_DI ; ; clear build target (effectively ignores SEEK_TITLE_BAR) ; .assert (OLBT_NO_TARGET eq 0) andnf ds:[di].OLCI_buildFlags, not mask OLBF_TARGET ; & give basic base window attributes OLS < ORNF ds:[di].OLWI_attrs, OL_ATTRS_BASE_WIN > OLS < mov ds:[di].OLWI_type, OLWT_BASE_WINDOW > CUAS < ORNF ds:[di].OLWI_attrs, MO_ATTRS_PRIMARY_WINDOW > CUAS < mov ds:[di].OLWI_type, MOWT_PRIMARY_WINDOW > ; Store is base window ; Remove resize borders if keyboard only-operation, since user can't ; use mouse on it. Clearing the single flag here works OK at this ; time, where we've not yet implemented the "Size" option in the ; window menu. When this is done, however, we'll have to be careful ; to distinguish between "Resizable" & just not showing the resize ; border. - Doug 2/11/92 ; call MakeNotResizableIfKeyboardOnly ;If GenDisplay attribute = GDA_USER_DISMISSABLE, then set CLOSABLE flag ;This will not affect functionality; just which gadgets are provided ;by the specific UI to close this window. push di call WinCommon_DerefGen_DI test ds:[di].GDI_attributes, mask GDA_USER_DISMISSABLE pop di jz 30$ ; skip if not. ; If dismissable: ; Mark as closable ORNF ds:[di].OLWI_attrs, mask OWA_CLOSABLE 30$: ;Allow windows to come up when usable ORNF ds:[di].VI_specAttrs, mask SA_REALIZABLE ;process positioning and sizing hints call OLBaseWinScanGeometryHints ; ; Handle the following hints: ; ATTR_GEN_DISPLAY_NOT_MINIMIZABLE, ; ATTR_GEN_DISPLAY_NOT_MAXIMIZABLE, ; ATTR_GEN_DISPLAY_NOT_RESTORABLE, ; HINT_DISPLAY_NOT_RESIZABLE ; push es mov di, cs mov es, di mov di, offset cs:OLBaseWinHintHandlers mov ax, length (cs:OLBaseWinHintHandlers) call ObjVarScanData pop es if _ISUI mov ax, HINT_PRIMARY_MINIMIZE_REPLACES_CLOSE_FUNCTION call ObjVarFindData jnc noMinClose mov ax, TEMP_OL_WIN_MINIMIZE_IS_CLOSE clr cx call ObjVarAddData noMinClose: mov ax, HINT_PRIMARY_HIDE_MINIMIZE_UI call ObjVarFindData jnc noHideMin mov ax, TEMP_OL_WIN_HIDE_MINIMIZE clr cx call ObjVarAddData noHideMin: endif if _ALLOW_MINIMIZED_TITLE_BARS ; If we are supposed to minimize the title bar, then set the window ; to be not closable (no close button). Also, go ahead and set the ; window to be not minimizable nor restorable - there won't be any ; gadgetry for it anyway. call WinCommon_DerefVisSpec_DI test ds:[di].OLWI_moreFixedAttr, mask OMWFA_MINIMIZE_TITLE_BAR jz checkMinMaxRestoreControls andnf ds:[di].OLWI_attrs, not mask OWA_CLOSABLE jmp SHORT dontAllowMinRestore checkMinMaxRestoreControls: endif ;_ALLOW_MINIMIZED_TITLE_BARS ; ; If UIWindowOptions (.ini) prevents minimizing, maximizing, and ; restoring, make not-minimizable and not-restorable. ; ; We leave maximizing capability because we could be run on a ; maximize-on-startup field, which checks this flag. The ; OpenWinCheckIfMinMaxRestoreControls works elsewhere to actually ; remove the maxmize gadgetry, so we are okay there. ; call OpenWinCheckIfMinMaxRestoreControls jc allowMinMaxRestore if _ALLOW_MINIMIZED_TITLE_BARS dontAllowMinRestore: endif ;_ALLOW_MINIMIZED_TITLE_BARS if _ISUI ; ; We also leave minimizing capability if the hints ; HINT_PRIMARY_MINIMIZE_REPLACES_CLOSE_FUNCTION or ; HINT_PRIMARY_HIDE_MINIMIZE_UI are present. The presense of the ; latter will actually remove the minimize gadgetry. ; push ax, bx mov ax, HINT_PRIMARY_MINIMIZE_REPLACES_CLOSE_FUNCTION call ObjVarFindData jc minReplacesClose mov ax, HINT_PRIMARY_HIDE_MINIMIZE_UI call ObjVarFindData minReplacesClose: pop ax, bx jc allowMinMaxRestore endif call BaseWinAttrGenDisplayNotMinimizable call BaseWinAttrGenDisplayNotRestorable allowMinMaxRestore: ; ; If being run in "desk accessory" mode, make not-maximizable ; ; This means that a desk accessory will not be maximized, even when ; started in a maximized-on-startup field (see ; OLBaseWinDetermineInitialMaximizedStatus), this is desired. ; mov ax, MSG_GEN_APPLICATION_GET_LAUNCH_FLAGS call GenCallApplication ; al = AppLaunchFlags test al, mask ALF_DESK_ACCESSORY jz notDeskAccessory call BaseWinAttrGenDisplayNotMaximizable jmp short afterDeskAccessory notDeskAccessory: ;not a desk accessory, if running in UILM_TRANSPARENT mode, cannot ;close (as close means exit app and you can't exit app in ;UILM_TRANSPARENT mode) call UserGetLaunchModel ; ax = UILaunchModel cmp ax, UILM_TRANSPARENT jne closable call UserGetLaunchOptions test ax, mask UILO_CLOSABLE_APPS jnz closable call WinCommon_DerefVisSpec_DI ANDNF ds:[di].OLWI_attrs, not mask OWA_CLOSABLE closable: afterDeskAccessory: if _GCM ; ; If marked as GCM, maximize & prevent min/restore behavior. ; call WinCommon_DerefVisSpec_DI test ds:[di].OLWI_fixedAttr, mask OWFA_GCM_TITLED jz notGCM call BaseWinAttrGenDisplayNotMinimizable call BaseWinAttrGenDisplayNotRestorable ; ; UIWO_MAXIMIZE_ON_STARTUP is dealt with in ; OLBaseWinDetermineInitialMaximizedStatus, called from META_UPDATE_WINDOW ; handler, so should not need to be handled here. Doing this here also ; screws up restoring an unmaxmized window from state on a ; UIWO_MAXIMIZE_ON_STARTUP system. - brianc 9/17/92 ; if 0 jmp short maximize notGCM: ; ; If marked as UIWO_MAXIMIZE_ON_STARTUP, maximize the window. ; push es, ax segmov es, dgroup, ax test es:[olWindowOptions], mask UIWO_MAXIMIZE_ON_STARTUP pop es, ax jz afterMaximized maximize: else ; ; Post-mortem comment: ; I guess if it is a GCM window, we want to force maximized state regardless ; of state info - brianc 12/8/92 ; ; don't save to state as this will be checked ; again on next startup (and we don't want to ; falsely report maximized when we really just ; meant to set it for this session) mov ax, ATTR_GEN_DISPLAY_MAXIMIZED_STATE clr cx call ObjVarAddData ;afterMaximized: notGCM: endif endif ; ;if this window is marked as minimized and the specific UI ; ;allows this, set as not SA_REALIZABLE and SA_BRANCH_MINIMIZED ; ;so visible build will not occur. (This could be handled ; ;in OLMenuedWinClass, but there is no INITIALIZE handler there.) ; ;this is handled in MSG_META_UPDATE_WINDOW (of OLMenuedWinClass) and ;MSG_SPEC_SET_USABLE handlers - brianc 3/12/92 ret OLBaseWinInitialize endp OLBaseWinHintHandlers VarDataHandler \ < ATTR_GEN_DISPLAY_NOT_MINIMIZABLE, offset BaseWinAttrGenDisplayNotMinimizable >, < ATTR_GEN_DISPLAY_NOT_MAXIMIZABLE, offset BaseWinAttrGenDisplayNotMaximizable >, < ATTR_GEN_DISPLAY_NOT_RESTORABLE, offset BaseWinAttrGenDisplayNotRestorable >, < HINT_DISPLAY_NOT_RESIZABLE, offset BaseWinHintDisplayNotResizable >, < HINT_PRIMARY_NO_EXPRESS_MENU, offset BaseWinHintNoExpressMenu > BaseWinAttrGenDisplayNotMinimizable proc far class OLWinClass call WinCommon_DerefVisSpec_DI ANDNF ds:[di].OLWI_attrs, not mask OWA_MINIMIZABLE ret BaseWinAttrGenDisplayNotMinimizable endp BaseWinAttrGenDisplayNotMaximizable proc far class OLWinClass call WinCommon_DerefVisSpec_DI ANDNF ds:[di].OLWI_attrs, not mask OWA_MAXIMIZABLE ret BaseWinAttrGenDisplayNotMaximizable endp BaseWinAttrGenDisplayNotRestorable proc far class OLWinClass call WinCommon_DerefVisSpec_DI ANDNF ds:[di].OLWI_fixedAttr, not (mask OWFA_RESTORABLE) ret BaseWinAttrGenDisplayNotRestorable endp BaseWinHintDisplayNotResizable proc far class OLWinClass call WinCommon_DerefVisSpec_DI ANDNF ds:[di].OLWI_attrs, not (mask OWA_RESIZABLE) ret BaseWinHintDisplayNotResizable endp BaseWinHintNoExpressMenu proc far class OLWinClass call WinCommon_DerefVisSpec_DI ORNF ds:[di].OLBWI_flags, mask OLBWF_REJECT_EXPRESS_TOOL_AREA ret BaseWinHintNoExpressMenu endp COMMENT @---------------------------------------------------------------------- FUNCTION: MakeNotResizableIfKeyboardOnly DESCRIPTION: Clear the OWA_RESIZABLE bit if user is working with a keyboard only, i.e. no mouse CALLED BY: INTERNAL OLBaseWinInitialize PASS: *ds:si - base window RETURN: nothing DESTROYED: ax ------------------------------------------------------------------------------@ MakeNotResizableIfKeyboardOnly proc near call FlowGetUIButtonFlags test al, mask UIBF_KEYBOARD_ONLY jz 10$ call WinCommon_DerefVisSpec_DI ANDNF ds:[di].OLWI_attrs, not mask OWA_RESIZABLE 10$: ret MakeNotResizableIfKeyboardOnly endp COMMENT @---------------------------------------------------------------------- METHOD: OLBaseWinScanGeometryHints -- MSG_SPEC_SCAN_GEOMETRY_HINTS for OLBaseWinClass DESCRIPTION: Scans geometry hints. PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_SPEC_SCAN_GEOMETRY_HINTS RETURN: nothing ax, cx, dx, bp - destroyed ALLOWED TO DESTROY: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chris 2/ 5/92 Initial Version ------------------------------------------------------------------------------@ OLBaseWinScanGeometryHints method static OLBaseWinClass, \ MSG_SPEC_SCAN_GEOMETRY_HINTS uses bx, di, es ; To comply w/static call requirements .enter ; that bx, si, di, & es are preserved. ; NOTE that es is NOT segment of class mov di, segment OLBaseWinClass mov es, di mov di, offset OLBaseWinClass CallSuper MSG_SPEC_SCAN_GEOMETRY_HINTS ;override OLWinClass positioning/sizing behavior: call WinCommon_DerefVisSpec_DI if _OL_STYLE ;START of OPEN LOOK specific code ----------------------------- mov ds:[di].OLWI_winPosSizeFlags, \ mask WPSF_SHRINK_DESIRED_SIZE_TO_FIT_IN_PARENT \ or mask WPSF_PERSIST \ or (WCT_KEEP_PARTIALLY_VISIBLE shl offset WPSF_CONSTRAIN_TYPE) \ or (WPT_STAGGER shl offset WPSF_POSITION_TYPE) \ or (WST_AS_DESIRED shl offset WPSF_SIZE_TYPE) endif ;END of OPEN LOOK specific code ------------------------------- if _CUA_STYLE ;START of MOTIF specific code --------------------------------- mov ds:[di].OLWI_winPosSizeFlags, \ mask WPSF_PERSIST \ or (WCT_KEEP_PARTIALLY_VISIBLE shl offset WPSF_CONSTRAIN_TYPE) \ or (WPT_STAGGER shl offset WPSF_POSITION_TYPE) \ or (WST_EXTEND_NEAR_BOTTOM_RIGHT shl offset WPSF_SIZE_TYPE) endif ;END of MOTIF specific code ----------------------------------- ;now set positioning behavior for icon: if _NO_WIN_ICONS ;------------------------------------------------------ mov cx, FALSE else ;---------------------------------------------------------------------- mov ds:[di].OLMDWI_iconWinPosSizeFlags, \ mask WPSF_PERSIST \ or (WCT_NONE shl offset WPSF_CONSTRAIN_TYPE) \ or (WPT_STAGGER shl offset WPSF_POSITION_TYPE) \ or (WST_AS_DESIRED shl offset WPSF_SIZE_TYPE) mov ds:[di].OLMDWI_iconWinPosSizeState, \ (mask SSPR_ICON shl offset WPSS_STAGGERED_SLOT) \ or mask WPSS_POSITION_INVALID or mask WPSS_SIZE_INVALID ;set flag: is icon, so stagger as one. mov cx, TRUE ;pass flag: window can have an icon endif ; if _NO_WIN_ICONS ---------------------------------------------------- call OpenWinProcessHints ; handle the special "I'm a major app" hint -- the interpretation of ; this is specific UI determined mov ax, HINT_PRIMARY_FULL_SCREEN call ObjVarFindData jnc done call WinCommon_DerefVisSpec_DI ; set geometry flags (after clearing fields) ; (must clear fields seperately!) andnf ds:[di].OLWI_winPosSizeFlags, \ (not mask WPSF_POSITION_TYPE) andnf ds:[di].OLWI_winPosSizeFlags, \ (not mask WPSF_SIZE_TYPE) ornf ds:[di].OLWI_winPosSizeFlags, \ WPT_AT_RATIO shl offset WPSF_POSITION_TYPE or \ WST_EXTEND_NEAR_BOTTOM_RIGHT shl offset WPSF_SIZE_TYPE add di, offset VI_bounds ; ds:di = VI_bounds mov bp, di ; ds:bp+2 = OLWI_winPosSizeState add bp, offset OLWI_winPosSizeFlags call EnsureRightBottomBoundsAreIndependent mov ds:[di].R_left, mask SWSS_RATIO or PCT_0 mov ds:[di].R_top, mask SWSS_RATIO or PCT_0 ; indicate that VI_bounds.R_left and R_top ; contain a SpecWinSizePair ornf {word} ds:[bp]+2, mask WPSS_VIS_POS_IS_SPEC_PAIR done: .leave ret OLBaseWinScanGeometryHints endm if GRAFFITI_ANYWHERE COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLBaseWinQueryIfPressIsInk %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Pass to focused child. Implements "Graffiti-anywhere." CALLED BY: MSG_META_QUERY_IF_PRESS_IS_INK PASS: *ds:si = OLBaseWinClass object ds:di = OLBaseWinClass instance data RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: BUGS/SIDE EFFECTS/IDEAS: Any bugs fixed in this routine should probably also be fixed in OLCtrlQueryIfPressIsInk. REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 1/ 1/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ OLBaseWinQueryIfPressIsInk method dynamic OLBaseWinClass, MSG_META_QUERY_IF_PRESS_IS_INK .enter ; ; Pass the query onto the first focused child. ; push ax, cx, dx mov ax, MSG_VIS_FUP_QUERY_FOCUS_EXCL call ObjCallInstanceNoLock ; ^lcx:dx = obj movdw bxbp, cxdx ; save object pop ax, cx, dx ; passed args ; ; Don't call self in infinite loop, or try to call an object ; that isn't there. ; tst bx jz callSuper ; no object! cmp bx, ds:[LMBH_handle] ; same obj block? jne doCall cmp bp, si ; same obj? je callSuper doCall: ; ; Send to focused object. ; mov si, bp ; ^lbx:si = obj mov di, mask MF_CALL call ObjMessage ; ax, bp = returned done: .leave ret callSuper: mov di, offset OLBaseWinClass call ObjCallSuperNoLock jmp done OLBaseWinQueryIfPressIsInk endm endif ; GRAFFITI_ANYWHERE WinCommon ends AppAttach segment resource AA_DerefVisSpec_DI proc near class VisClass mov di, ds:[si] add di, ds:[di].Vis_offset ret AA_DerefVisSpec_DI endp COMMENT @---------------------------------------------------------------------- METHOD: OLBaseWinUpdateSpecBuild DESCRIPTION: PASS: *ds:si - instance data es - segment of OpenWinClass ax - MSG_SPEC_BUILD_BRANCH cx - ? dx - ? bp - SpecBuildFlags RETURN: carry - ? ax, cx, dx, bp - ? DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 10/90 Initial version ------------------------------------------------------------------------------@ OLBaseWinUpdateSpecBuild method dynamic OLBaseWinClass, \ MSG_SPEC_BUILD_BRANCH ; ; Set optimization flag indicating that no object ; at this point or below in the tree, when being ; TREE_BUILD'd, will be adding itself visually ; outside the visual realm of this Base window. (Allows ; VisAddChildRelativeToGen to work much quicker) or bp, mask SBF_VIS_PARENT_WITHIN_SCOPE_OF_TREE_BUILD mov di, offset OLBaseWinClass call ObjCallSuperNoLock if RADIO_STATUS_ICON_ON_PRIMARY call AddPrimaryRadioStatusIcon endif if _FLOATING_KEYBOARD_TRIGGER_ON_PRIMARY call AddPrimaryKeyboard endif if (not _NO_PRIMARY_HELP_TRIGGER) call AddPrimaryHelp endif call EnsureFileMenu ret OLBaseWinUpdateSpecBuild endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% AddPrimaryHelp %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Add a help trigger to the primary if requested CALLED BY: OLBaseWinUpdateSpecBuild() PASS: *ds:si - OLBaseWin object RETURN: ds - fixed up DESTROYED: bx, di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- gene 12/ 7/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if (not _NO_PRIMARY_HELP_TRIGGER) ;-------------------------------------------- AddPrimaryHelp proc near uses ax, cx, dx, bp, si, es .enter ; ; See if we are hiding help buttons (eg. for a system ; with a dedicated help button or icon) ; call OpenGetHelpOptions test ax, mask UIHO_HIDE_HELP_BUTTONS LONG jnz noHelp ;branch if help hidden ; ; See if there is a hint specifying we shouldn't add the trigger ; mov ax, ATTR_GEN_WINDOW_CUSTOM_WINDOW call ObjVarFindData LONG jc noHelp ;branch if no primary help ; ; See if there is a hint specifying we shouldn't add the trigger ; mov ax, HINT_PRIMARY_NO_HELP_BUTTON call ObjVarFindData LONG jc noHelp ;branch if no primary help ; ; Finally, see if there is even help specified ; mov ax, ATTR_GEN_HELP_CONTEXT call ObjVarFindData LONG jnc noHelp ;branch if no help context push si if _GCM ; ; Check to see if this should be a GCM icon ; mov di, ds:[si] add di, ds:[di].Vis_offset test ds:[di].OLWI_fixedAttr, mask OWFA_GCM_TITLED ; ; We've survived the gauntlet of vardata...create a trigger ; pushf ;flag indicates GCM_TITLED endif mov ax, segment GenTriggerClass mov es, ax mov di, offset GenTriggerClass ;es:di <- ptr to class mov bx, ds:LMBH_handle ;bx <- block to create in call GenInstantiateIgnoreDirty if _GCM popf jz afterGCM ; ; Indicate that this trigger is a GCM_SYS_ICON ; mov ax, HINT_GCM_SYS_ICON clr cx ;cx <- no extra data call ObjVarAddData ISU < mov ax, HINT_ENSURE_TEMPORARY_DEFAULT > ISU < clr cx ; hack to make trigger > ISU < call ObjVarAddData ; larger than moniker > afterGCM: endif ; ; Set the moniker of the trigger to our special default ; mov ax, ATTR_GEN_DEFAULT_MONIKER mov cx, (size GenDefaultMonikerType) call ObjVarAddData mov {word}ds:[bx], GDMT_HELP_PRIMARY ; ; Add a hint to put the trigger in the title bar ; mov ax, HINT_SEEK_TITLE_BAR_RIGHT clr cx ;cx <- no extra data call ObjVarAddData if BUBBLE_HELP ; ; Add focus help hint ; mov ax, ATTR_GEN_FOCUS_HELP mov cx, size optr call ObjVarAddData mov ds:[bx].handle, handle HelpHelpString mov ds:[bx].offset, offset HelpHelpString endif ; ; Set the message & output of the trigger ; mov ax, MSG_GEN_TRIGGER_SET_ACTION_MSG mov cx, MSG_META_BRING_UP_HELP call ObjCallInstanceNoLock mov ax, MSG_GEN_TRIGGER_SET_DESTINATION mov cx, ds:LMBH_handle mov dx, si ;^lcx:dx <- dest OD (self) call ObjCallInstanceNoLock ; ; Add the new trigger ; mov cx, ds:LMBH_handle mov dx, si ;^lcx:dx <- OD of trigger mov ax, MSG_GEN_ADD_CHILD_UPWARD_LINK_ONLY pop si ;*ds:si <- OLBaseWin object call ObjCallInstanceNoLock ; ; Save the lptr of the help trigger we added ; mov ax, TEMP_OL_BASE_WIN_HELP_TRIGGER mov cx, (size lptr) ;cx <- size of extra data call ObjVarAddData mov ds:[bx], dx ;save lptr ; ; Finally, set the trigger usable ; mov si, dx ;*ds:si <- trigger mov ax, MSG_GEN_SET_USABLE mov dl, VUM_DELAYED_VIA_APP_QUEUE ;dl <- VisUpdateMode call ObjCallInstanceNoLock noHelp: .leave ret AddPrimaryHelp endp endif ; (not _NO_PRIMARY_HELP_TRIGGER) -------------------------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% AddPrimaryKeyboard %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Add a floating keyboard trigger to the right side of titlebar CALLED BY: OLBaseWinUpdateSpecBuild PASS: *ds:si - OLBaseWin object RETURN: ds - fixed up DESTROYED: bx,cx,dx,di SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Joon 10/13/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if _FLOATING_KEYBOARD_TRIGGER_ON_PRIMARY ;------------------------------------- AddPrimaryKeyboard proc near uses ax,si,bp,es .enter mov di, ds:[si] add di, ds:[di].Vis_offset test ds:[di].OLWI_attrs, mask OWA_HEADER LONG jz done mov ax, ATTR_GEN_WINDOW_KBD_OVERRIDE call ObjVarFindData jnc addButton ;add button if no vardata cmp {KeyboardOverride} ds:[bx], KO_NO_KEYBOARD LONG je done ;don't add keyboard button cmp {KeyboardOverride} ds:[bx], KO_KEYBOARD_EMBEDDED LONG je done ;don't add keyboard button addButton: push si mov ax, segment GenTriggerClass mov es, ax mov di, offset GenTriggerClass ;es:di <- ptr to class mov bx, ds:[LMBH_handle] ;bx <- block to create in call GenInstantiateIgnoreDirty ; ; Set the moniker of the trigger - ' KBD ' ; mov ax, ' ' push ax mov ax, 'BD' push ax mov ax, ' K' push ax movdw cxdx, sssp mov ax, MSG_GEN_REPLACE_VIS_MONIKER_TEXT mov bp, VUM_MANUAL call ObjCallInstanceNoLock add sp, 6 ; ; Add a hint to put the trigger in the title bar ; mov ax, HINT_SEEK_TITLE_BAR_RIGHT clr cx ;cx <- no extra data call ObjVarAddData ; ; Set action data so keyboard will come up/down when trigger is clicked ; mov ax, ATTR_GEN_TRIGGER_ACTION_DATA mov cx, 3 * (size word) call ObjVarAddData mov {word} ds:[bx], MANUFACTURER_ID_GEOWORKS ; cx mov {word} ds:[bx+2], GWNT_HARD_ICON_BAR_FUNCTION ; dx mov {word} ds:[bx+4], HIBF_DISPLAY_FLOATING_KEYBOARD ; bp ; ; Set the message & output of the trigger ; mov ax, MSG_GEN_TRIGGER_SET_ACTION_MSG mov cx, MSG_META_NOTIFY call ObjCallInstanceNoLock push si clr bx call GeodeGetAppObject movdw cxdx, bxsi ;^lcx:dx <- appObj pop si mov ax, MSG_GEN_TRIGGER_SET_DESTINATION call ObjCallInstanceNoLock ; ; Add the new trigger ; mov cx, ds:[LMBH_handle] mov dx, si ;^lcx:dx <- OD of trigger pop si ;*ds:si <- OLBaseWin object call GenAddChildUpwardLinkOnly mov ax, TEMP_OL_BASE_WIN_KBD_TRIGGER mov cx, (size lptr) ;cx <- size of extra data call ObjVarAddData mov ds:[bx], dx ;save lptr ; ; Finally, set the trigger usable ; mov si, dx ;*ds:si <- trigger mov ax, MSG_GEN_SET_USABLE mov dl, VUM_DELAYED_VIA_APP_QUEUE ;dl <- VisUpdateMode call ObjCallInstanceNoLock done: .leave ret AddPrimaryKeyboard endp endif ; if _FLOATING_KEYBOARD_TRIGGER_ON_PRIMARY ---------------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% AddPrimaryRadioStatusIcon %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Add a status icon to the left side of titlebar CALLED BY: OLBaseWinUpdateSpecBuild PASS: *ds:si - OLBaseWin object RETURN: ds - fixed up DESTROYED: ax,bx,cx,dx,di,bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Joon 3/25/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if RADIO_STATUS_ICON_ON_PRIMARY ;------------------------------------- AddPrimaryRadioStatusIcon proc near uses si .enter mov di, ds:[si] add di, ds:[di].Vis_offset test ds:[di].OLWI_attrs, mask OWA_HEADER LONG jz done push si mov ax, segment RadioStatusIconClass mov es, ax mov di, offset RadioStatusIconClass ;es:di <- ptr to class mov bx, ds:[LMBH_handle] ;bx <- block to create in call GenInstantiateIgnoreDirty mov bx, offset Gen_offset call ObjInitializePart mov di, ds:[si] add di, ds:[di].Gen_offset ornf ds:[di].GI_attrs, mask GA_INITIATES_INPUT_IGNORE ; ; Add a hint to put the trigger in the title bar ; mov ax, HINT_SEEK_TITLE_BAR_LEFT clr cx ;cx <- no extra data call ObjVarAddData mov ax, HINT_FIXED_SIZE mov cx, size GadgetSizeHintArgs call ObjVarAddData mov ds:[bx].GSHA_width, SpecWidth <SST_PIXELS, 30> mov ds:[bx].GSHA_height, 0 mov ax, HINT_SHORT_LONG_TOUCH mov cx, size ShortLongTouchParams call ObjVarAddData mov cx, ds:[LMBH_handle] mov ds:[bx].SLTP_shortMessage, MSG_RADIO_STATUS_ICON_SHORT_TOUCH movdw ds:[bx].SLTP_shortDestination, cxsi mov ds:[bx].SLTP_longMessage, MSG_RADIO_STATUS_ICON_LONG_TOUCH movdw ds:[bx].SLTP_longDestination, cxsi ; ; Add the new trigger ; mov cx, ds:[LMBH_handle] ;*ds:si <- OD of trigger pop dx ;^lcx:dx <- OLBaseWin object call GenSetUpwardLink ; ; Save radio status icon chunk handle in OLBaseWin instance data ; mov bx, dx ;*ds:bx = OLBaseWin object mov bx, ds:[bx] add bx, ds:[bx].Vis_offset mov ds:[bx].OLBWI_radioStatusIcon, si ; ; Add to GCNList ; mov cx, ds:[LMBH_handle] mov dx, si mov bx, MANUFACTURER_ID_GEOWORKS mov ax, GCNSLT_PENELOPE_RADIO_STATUS_NOTIFICATIONS call GCNListAdd ; ; Finally, set the trigger usable ; mov ax, MSG_GEN_SET_USABLE mov dl, VUM_DELAYED_VIA_APP_QUEUE ;dl <- VisUpdateMode call ObjCallInstanceNoLock done: .leave ret AddPrimaryRadioStatusIcon endp endif ; if RADIO_STATUS_ICON_ON_PRIMARY ---------------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLBaseWinSpecBuild %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Make sure this window is added to the window list CALLED BY: MSG_SPEC_BUILD PASS: *ds:si = OLBaseWinClass object ds:di = OLBaseWinClass instance data ds:bx = OLBaseWinClass object (same as *ds:si) es = segment of OLBaseWinClass ax = message # RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- JS 9/17/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if _ISUI ; We will be adding this window to the window list ------------------ OLBaseWinSpecBuild method dynamic OLBaseWinClass, MSG_SPEC_BUILD mov di, offset OLBaseWinClass call ObjCallSuperNoLock ; Create a GenItem to represent this primary in the GenField's ; WindowList. call EnsureItemAddedToWindowList ret OLBaseWinSpecBuild endm endif ; if _ISUI ----------------------------------------------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% EnsureItemAddedToWindowList %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Make sure this window is added to the window list. CALLED BY: OLBaseWinSpecBuild OLBaseWinUpdateWindow PASS: *ds:si - OLBaseWin object RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- JS 9/19/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if _ISUI ;-------------------------------------------------------------------- EnsureItemAddedToWindowList proc near mov di, ds:[si] add di, ds:[di].Gen_offset test ds:[di].GI_states, mask GS_USABLE jz done ; skip if so... call AA_DerefVisSpec_DI tst ds:[di].OLBWI_windowListEntry.handle jnz done ; skip if so... ; Let's not put an item in the windowlist/taskbar if custom window and ; ATTR_GEN_WINDOW_CUSTOM_LAYER_PRIORITY = LAYER_PRIO_ON_BOTTOM. ; test ds:[di].OLWI_moreFixedAttr, mask OWMFA_CUSTOM_WINDOW jz continue mov ax, ATTR_GEN_WINDOW_CUSTOM_LAYER_PRIORITY call ObjVarFindData jnc continue cmp {LayerPriority}ds:[bx], LAYER_PRIO_ON_BOTTOM je done continue: mov ax, HINT_AVOID_MENU_BAR call ObjVarFindData jc done if EXTENDIBLE_SYSTEM_TRAY mov ax, HINT_PRIMARY_AVOID_MENU_BAR_IF_EXTENDIBLE_SYSTRAY call ObjVarFindData jc done endif ; Get default field window (presume only one), where most all windows ; of the app will be placed. ; mov cx, GUQT_FIELD mov ax, MSG_SPEC_GUP_QUERY call ObjCallInstanceNoLock ;^lcx:dx = Field, bp = fieldWin push bp ;save fieldWin ; Specify an "OLWindowListItemClass" object to be created ; push si mov bx, cx ; ^lbx:si = field mov si, dx mov ax, MSG_OL_FIELD_CREATE_WINDOW_LIST_ENTRY mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage ; returns ^lcx:dx = window list entry mov ax, si ; ^lbx:ax = field pop si ; Save away optr of object just created ; call AA_DerefVisSpec_DI mov ds:[di].OLBWI_windowListEntry.handle, cx mov ds:[di].OLBWI_windowListEntry.chunk, dx pop bp ; restore fieldWin jcxz done ; exit if no window list entry ; Setup our OLWindowListItem object to have the info it will need to ; function correctly. ; push si mov bx, cx xchg si, dx ; item obj in ^lbx:si mov cx, ds:[LMBH_handle] ; window obj in ^lcx:dx mov ax, MSG_OL_WINDOW_LIST_ITEM_SET_OPERATING_PARAMS mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage pop si ; Set moniker of Window List Entry to be a copy of the window moniker. ; mov ax, MSG_OL_BASE_WIN_SET_WINDOW_ENTRY_MONIKER call ObjCallInstanceNoLock done: ret EnsureItemAddedToWindowList endp endif ;---------------------------------------------------------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% UpdateTaskBarList %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Update taskbar list to match window list CALLED BY: EnsureItemAddedToWindowList, EnsureItemRemovedFromWindowList PASS: cx = TRUE - reinitialize list and update current selection FALSE - just update current selection RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- JS 9/19/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if _ISUI UpdateTaskBarList proc far uses ax,bx,cx,dx,si,di,bp .enter mov bx, segment OLFieldClass mov si, offset OLFieldClass mov ax, MSG_OL_FIELD_UPDATE_TASK_BAR_LIST mov di, mask MF_RECORD call ObjMessage mov ax, MSG_GEN_GUP_CALL_OBJECT_OF_CLASS mov cx, di call UserCallApplication .leave ret UpdateTaskBarList endp endif ; _ISUI COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLBaseWinUpdateVisMoniker %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: If a new moniker is set, then we need to update the entry in the Window List CALLED BY: MSG_SPEC_UPDATE_VIS_MONIKER PASS: *ds:si = OLBaseWinClass object ds:di = OLBaseWinClass instance data ds:bx = OLBaseWinClass object (same as *ds:si) es = segment of OLBaseWinClass ax = message # dl - VisUpdateMode cx - width of old moniker bp - height of old moniker RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- JS 1/ 7/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if _ISUI ;-------------------------------------------------------------------- OLBaseWinUpdateVisMoniker method dynamic OLBaseWinClass, MSG_SPEC_UPDATE_VIS_MONIKER mov di, offset OLBaseWinClass call ObjCallSuperNoLock FALL_THRU OLBaseWinSetWindowEntryMoniker OLBaseWinUpdateVisMoniker endm endif ;---------------------------------------------------------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLBaseWinSetWindowEntryMoniker %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set the moniker for this window in the window list CALLED BY: MSG_OL_BASE_WIN_SET_WINDOW_ENTRY_MONIKER PASS: *ds:si = OLBaseWinClass object es = segment of OLBaseWinClass RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- JS 9/17/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if _ISUI ; We will be adding this window to the window list ------------------ OLBaseWinSetWindowEntryMoniker method OLBaseWinClass, MSG_OL_BASE_WIN_SET_WINDOW_ENTRY_MONIKER mov di, ds:[si] add di, ds:[di].Vis_offset tst ds:[di].OLBWI_windowListEntry.handle LONG jz done getTextMoniker: mov bp, (VMS_TEXT shl offset VMSF_STYLE) clc ;check window's moniker list call GenFindMoniker tst cx jnz getIconMoniker stc ;check app's moniker list call GenFindMoniker tst cx jz done getIconMoniker: ; get system menu button icon moniker mov di, ds:[si] add di, ds:[di].Vis_offset mov bx, ds:[di].OLWI_sysMenu mov di, ds:[di].OLWI_sysMenuButton tst bx jz haveMonikers call ObjSwapLock mov di, ds:[di] add di, ds:[di].Vis_offset mov di, ds:[di].OLBI_genChunk mov di, ds:[di] add di, ds:[di].Gen_offset mov di, ds:[di].GI_visMoniker call ObjSwapUnlock haveMonikers: push bx, cx mov ax, LMEM_TYPE_GENERAL clr cx call MemAllocLMem ; Make it sharable so UI process can legally lock it. -dhunter 3/3/2000 mov ax, (0 shl 8) or (mask HF_SHARABLE) call MemModifyFlags mov bp, bx ;^hbp = new block pop bx, cx call OLBaseWinCreateCombinationMoniker push bp tst dx jz free call AA_DerefVisSpec_DI movdw bxsi, ds:[di].OLBWI_windowListEntry mov ax, MSG_GEN_REPLACE_VIS_MONIKER_OPTR mov bp, VUM_DELAYED_VIA_UI_QUEUE mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage free: pop bx call MemFree ; Update task bar list ; mov cx, TRUE ; re-initialize list call UpdateTaskBarList done: ret OLBaseWinSetWindowEntryMoniker endm endif ; if _ISUI ----------------------------------------------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLBaseWinCreateCombinationMoniker %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Create a icon+text moniker CALLED BY: OLBaseWinSetWindowEntryMoniker PASS: *ds:si = OLBaseWinClass object ^lbx:di = icon moniker ^lcx:dx = text moniker RETURN: ^lcx:dx = combination moniker in a new sharable memory block DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- joon 3/31/97 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if _ISUI ;-------------------- OLBaseWinCreateCombinationMoniker proc far combMkr local optr push bp, 0 iconMkr local optr push bx, di textMkr local optr push cx, dx iconWidth local word iconHeight local word uses ax, bx, si, di, es .enter movdw bxdi, ss:[iconMkr] ;^lbx:di = moniker tst bx jnz copyMoniker movdw bxdi, ss:[textMkr] ;^lbx:di = moniker tst bx LONG jz done clr ax ;set the zero flag = no icon moniker copyMoniker: pushf call ObjSwapLock ;*ds:di = moniker push bx mov cx, ss:[combMkr].handle push bp mov bp, di clr ax, bx, dx, di call UserCopyChunkOut ;ax = chunk handle of copy pop bp mov ss:[combMkr].offset, ax pop bx call ObjSwapUnlock popf LONG jz done ;exit if no icon moniker push ds:[LMBH_handle] movdw bxsi, ss:[combMkr] call MemLock mov ds, ax mov si, ds:[si] ;ds:si = icon VisMoniker test ds:[si].VM_type, mask VMT_GSTRING LONG jz unlockCombMkr movdw bxdi, ss:[textMkr] call ObjLockObjBlock mov es, ax mov di, es:[di] ;es:di = text VisMoniker test es:[di].VM_type, mask VMT_GSTRING jnz unlockTextMkr add di, VM_data+VMT_text LocalStrLength push cx DBCS < shl cx, 1 > add cx, (size OpDrawText) + (size OpMoveTo) mov bx, VM_data+VMGS_gstring mov ax, ss:[combMkr].offset call LMemInsertAt pop cx mov si, ax mov si, ds:[si] ;ds:si = icon VisMoniker ; get cached size and reset it and calculate moniker positions clr ax xchg ax, ds:[si].VM_width add ax, 2 ;ax = text moniker x position clr bx xchg bx, ds:[si].VM_data+VMGS_height push ds segmov ds, <segment systemFontHeight>, dx mov dx, ds:[systemFontHeight] pop ds sub bx, dx ;bx = difference in height mov dx, 0 ;dx = icon moniker y position jns iconBigger sar bx, 1 neg bx xchg bx, dx jmp drawText iconBigger: sar bx, 1 ;bx = text moniker y position adc bx, 0 drawText: add si, VM_data+VMGS_gstring mov ds:[si].ODT_opcode, GR_DRAW_TEXT mov ds:[si].ODT_x1, ax mov ds:[si].ODT_y1, bx mov ds:[si].ODT_len, cx add si, size OpDrawText mov di, ss:[textMkr].offset mov di, es:[di] add di, VM_data+VMT_text segxchg ds, es xchg si, di LocalCopyNString mov es:[di].OMT_opcode, GR_MOVE_TO mov es:[di].OMT_x1, 0 mov es:[di].OMT_y1, dx unlockTextMkr: mov bx, ss:[textMkr].handle call MemUnlock unlockCombMkr: mov bx, ss:[combMkr].handle call MemUnlock pop bx call MemDerefDS done: movdw cxdx, ss:[combMkr] .leave ret OLBaseWinCreateCombinationMoniker endp endif ; _ISUI ----------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLBaseWinUpdateWindowEntry %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Update window list selection CALLED BY: MSG_OL_BASE_WIN_UPDATE_WINDOW_ENTRY PASS: *ds:si = OLBaseWinClass object ds:di = OLBaseWinClass instance data ds:bx = OLBaseWinClass object (same as *ds:si) es = segment of OLBaseWinClass ax = message # cx = TRUE/FALSE - gained/lost target RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- JS 9/17/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if _ISUI ;-------------------------------------------------------------------- OLBaseWinUpdateWindowEntry method dynamic OLBaseWinClass, MSG_OL_BASE_WIN_UPDATE_WINDOW_ENTRY EC < cmp cx, TRUE > EC < je 10$ > EC < cmp cx, FALSE > EC < ERROR_NE OL_ERROR > EC <10$: > ; ; Find the WindowItem we created earlier, that's in the Window List ; movdw bxsi, ds:[di].OLBWI_windowListEntry tst bx jz done ;skip if none... push cx mov ax, MSG_GEN_ITEM_GET_IDENTIFIER mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage ;ax = identifier pop cx jcxz setNoneIfSet mov cx, ax mov ax, MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION call callWindowList jmp updateTaskBar setNoneIfSet: push ax mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION call callWindowList pop cx cmp ax, cx jne done mov ax, MSG_GEN_ITEM_GROUP_SET_NONE_SELECTED call callWindowList updateTaskBar: ; ; Update task bar list ; mov cx, FALSE ; just update selection call UpdateTaskBarList done: ret callWindowList: push bx, si mov bx, segment GenItemGroupClass mov si, offset GenItemGroupClass clr dx mov di, mask MF_RECORD call ObjMessage mov cx, di ;ClassedEvent to cx pop bx, si ;bx:si is ListEntry ; ; Send message to GenItemGroup ; mov ax, MSG_GEN_GUP_CALL_OBJECT_OF_CLASS mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage retn OLBaseWinUpdateWindowEntry endm endif ;---------------------------------------------------------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLBaseWinNotifyWindowSelected %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Bring window to front. CALLED BY: MSG_META_NOTIFY_TASK_SELECTED PASS: *ds:si = OLBaseWinClass object ds:di = OLBaseWinClass instance data ds:bx = OLBaseWinClass object (same as *ds:si) es = segment of OLBaseWinClass ax = message # RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- JS 9/17/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if _ISUI ;-------------------------------------------------------------------- OLBaseWinNotifyWindowSelected method dynamic OLBaseWinClass, MSG_META_NOTIFY_TASK_SELECTED add bx, ds:[bx].Gen_offset test ds:[bx].GI_states, mask GS_USABLE jz done ; abort is window is not usable mov ax, MSG_GEN_DISPLAY_SET_NOT_MINIMIZED call ObjCallInstanceNoLock mov ax, MSG_GEN_BRING_TO_TOP GOTO ObjCallInstanceNoLock done: ret OLBaseWinNotifyWindowSelected endm endif ;---------------------------------------------------------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLWindowListItemNotifyWindowSelected %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Notify window that it has been selected. CALLED BY: MSG_META_NOTIFY_TASK_SELECTED PASS: *ds:si = OLWindowListItemClass object ds:di = OLWindowListItemClass instance data ds:bx = OLWindowListItemClass object (same as *ds:si) es = segment of OLWindowListItemClass ax = message # RETURN: carry set DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- JS 9/17/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if _ISUI ; NOTE: this is not OLBaseWin, It is OLWindowListItem --------------- OLWindowListItemNotifyWindowSelected method dynamic OLWindowListItemClass, MSG_META_NOTIFY_TASK_SELECTED mov bx, ds:[di].OLWLI_windowObj.handle push bx push ds:[di].OLWLI_windowObj.chunk ; Raise app to top within field ; call MemOwner ;Get owning geode mov cx, bx mov dx, bx ;which is also LayerID to raise mov bp, ds:[di].OLWLI_parentWin mov ax, MSG_GEN_SYSTEM_BRING_GEODE_TO_TOP call UserCallSystem ; Then pass on notification to the app object ; pop si pop bx mov ax, MSG_META_NOTIFY_TASK_SELECTED mov di, mask MF_FORCE_QUEUE call ObjMessage stc ret OLWindowListItemNotifyWindowSelected endm endif ;---------------------------------------------------------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLWindowListItemSetOperatingParams %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Save data. CALLED BY: MSG_OL_WINDOW_LIST_ITEM_SET_OPERATING_PARAMS PASS: *ds:si = OLWindowListItemClass object ds:di = OLWindowListItemClass instance data ds:bx = OLWindowListItemClass object (same as *ds:si) es = segment of OLWindowListItemClass ax = message # cx:dx = window object bp = field window RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- JS 9/17/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if _ISUI ; NOTE: this is not OLBaseWin, It is OLWindowListItem --------------- OLWindowListItemSetOperatingParams method dynamic OLWindowListItemClass, MSG_OL_WINDOW_LIST_ITEM_SET_OPERATING_PARAMS mov ds:[di].OLWLI_windowObj.handle, cx mov ds:[di].OLWLI_windowObj.chunk, dx mov ds:[di].OLWLI_parentWin, bp ret OLWindowListItemSetOperatingParams endm endif ;---------------------------------------------------------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLWindowListItemCloseWindow %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Close window CALLED BY: MSG_OL_WINDOW_LIST_ITEM_CLOSE_WINDOW PASS: *ds:si = OLWindowListItemClass object ds:di = OLWindowListItemClass instance data ds:bx = OLWindowListItemClass object (same as *ds:si) es = segment of OLWindowListItem ax = message # RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- JS 9/18/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if _ISUI ; NOTE: this is not OLBaseWin, It is OLWindowListItem --------------- OLWindowListItemCloseWindow method dynamic OLWindowListItemClass, MSG_OL_WINDOW_LIST_ITEM_CLOSE_WINDOW mov bx, ds:[di].OLWLI_windowObj.handle mov si, ds:[di].OLWLI_windowObj.chunk mov ax, MSG_GEN_DISPLAY_CLOSE mov di, mask MF_FORCE_QUEUE GOTO ObjMessage OLWindowListItemCloseWindow endm endif ; if _ISUI ----------------------------------------------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLWindowListItemKeyboardChar %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle keyboard events for WindowListItem. CALLED BY: MSG_META_KBD_CHAR PASS: *ds:si = OLWindowListItemClass object ds:di = OLWindowListItemClass instance data ds:bx = OLWindowListItemClass object (same as *ds:si) es = segment of OLWindowListItemClass ax = message # cx = character value dl = CharFlags dh = ShiftState bp low = ToggleState bp high = scan code RETURN: nothing DESTROYED: ax,cx,dx,bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- JS 3/21/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if _ISUI ; NOTE: this is not OLBaseWin, It is OLWindowListItem --------------- OLWindowListItemKeyboardChar method dynamic OLWindowListItemClass, MSG_META_KBD_CHAR test dl, mask CF_FIRST_PRESS jz callSuper ; callsuper if not first press tst dh jnz callSuper ; callsuper if any ShiftState SBCS < cmp cx, (VC_ISCTRL shl 8) or VC_ENTER > DBCS < cmp cx, C_SYS_ENTER > jne callSuper mov ax, MSG_META_NOTIFY_TASK_SELECTED GOTO ObjCallInstanceNoLock callSuper: mov di, offset OLWindowListItemClass GOTO ObjCallSuperNoLock OLWindowListItemKeyboardChar endm endif ; if _ISUI ----------------------------------------------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RadioStatusIconNotify %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle status icon notification CALLED BY: MSG_META_NOTIFY PASS: *ds:si = RadioStatusIconClass object ds:di = RadioStatusIconClass instance data ds:bx = RadioStatusIconClass object (same as *ds:si) es = segment of RadioStatusIconClass ax = message # cx:dx = NotificationType cx - NT_manuf dx - NT_type bp = change specific data RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- joon 3/26/97 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if RADIO_STATUS_ICON_ON_PRIMARY ;------------------------ RadioStatusIconNotify method dynamic RadioStatusIconClass, MSG_META_NOTIFY cmp dx, GWNT_PENELOPE_RADIO_STATUS_NOTIFICATION jne callSuper mov cx, MANUFACTURER_ID_GEOWORKS jne callSuper clr ds:[di].RSII_iconCycleCount mov ds:[di].RSII_radioStatus, bp call OpenDrawObject mov di, ds:[si] add di, ds:[di].RadioStatusIcon_offset cmp ds:[di].RSII_radioStatus, PRS_CALL_IN_PROGRESS jne done tst ds:[di].RSII_sysTarget jz done GOTO RadioStatusIconStartTimer callSuper: mov di, offset RadioStatusIconClass GOTO ObjCallSuperNoLock done: ret RadioStatusIconNotify endm endif ; RADIO_STATUS_ICON_ON_PRIMARY ;----------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RadioStatusIconDraw %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Draw radio status icon CALLED BY: MSG_VIS_DRAW PASS: *ds:si = RadioStatusIconClass object ds:di = RadioStatusIconClass instance data ds:bx = RadioStatusIconClass object (same as *ds:si) es = segment of RadioStatusIconClass ax = message # cl = DrawFlags ^hbp = GState to draw through RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- joon 3/27/97 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if RADIO_STATUS_ICON_ON_PRIMARY ;----------------------- RadioStatusIconDraw method RadioStatusIconClass, MSG_VIS_DRAW push bp mov di, offset RadioStatusIconClass call ObjCallSuperNoLock pop di ; di = gstate call VisGetBounds ; (ax,bx) = draw position mov cx, ax mov dx, bx ; (cx,dx) = draw position mov bp, ds:[si] add bp, ds:[bp].RadioStatusIcon_offset mov ax, ds:[bp].RSII_radioStatus mov si, offset RadioStatusOffMoniker cmp ax, PRS_TRANSMITTER_OFF je draw mov si, offset RadioStatusOn2Moniker cmp ax, PRS_TRANSMITTER_ON je draw EC < cmp ax, PRS_CALL_IN_PROGRESS > EC < ERROR_NE -1 ; invalid radio status > mov al, ds:[bp].RSII_iconCycleCount mov si, offset RadioStatusOn1Moniker tst al jz draw mov si, offset RadioStatusOn2Moniker dec al jz draw mov si, offset RadioStatusOn3Moniker draw: mov bx, handle RadioStatusOffMoniker call MemLock mov ds, ax mov si, ds:[si] ; ds:si = bitmap to draw mov ax, cx mov bx, dx ; (ax,bx) = draw position clr dx ; no callback call GrDrawBitmap mov bx, handle RadioStatusOffMoniker GOTO MemUnlock RadioStatusIconDraw endm endif ; RADIO_STATUS_ICON_ON_PRIMARY ;----------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RadioStatusIconCallInProgressTimerMsg %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle "call in progress" timer message CALLED BY: MSG_RADIO_STATUS_ICON_CALL_IN_PROGRESS_TIMER_MSG PASS: *ds:si = RadioStatusIconClass object ds:di = RadioStatusIconClass instance data ds:bx = RadioStatusIconClass object (same as *ds:si) es = segment of RadioStatusIconClass ax = message # RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- joon 3/26/97 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if RADIO_STATUS_ICON_ON_PRIMARY ;----------------------- RadioStatusIconCallInProgressTimerMsg method dynamic RadioStatusIconClass, MSG_RADIO_STATUS_ICON_CALL_IN_PROGRESS_TIMER_MSG clr ds:[di].RSII_cycleTimer cmp ds:[di].RSII_radioStatus, PRS_CALL_IN_PROGRESS jne done inc ds:[di].RSII_iconCycleCount cmp ds:[di].RSII_iconCycleCount, PenelopeRadioStatus jb 10$ clr ds:[di].RSII_iconCycleCount 10$: call OpenDrawObject GOTO RadioStatusIconStartTimer done: ret RadioStatusIconCallInProgressTimerMsg endm endif ; RADIO_STATUS_ICON_ON_PRIMARY ;------------------------ COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RadioStatusIconShortTouch %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle short touch on radio status icon CALLED BY: MSG_RADIO_STATUS_ICON_SHORT_TOUCH PASS: *ds:si = RadioStatusIconClass object ds:di = RadioStatusIconClass instance data ds:bx = RadioStatusIconClass object (same as *ds:si) es = segment of RadioStatusIconClass ax = message # RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- joon 3/27/97 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if RADIO_STATUS_ICON_ON_PRIMARY ;---------------------------- RadioStatusIconShortTouch method dynamic RadioStatusIconClass, MSG_RADIO_STATUS_ICON_SHORT_TOUCH token local GeodeToken msg local word .enter push ss lea ax, ss:[token] push ax push ss lea ax, ss:[msg] push ax call PUGETRADIOSTATUSICONSHORTTOUCH call RadioStatusIconSendIACPMessage .leave ret RadioStatusIconShortTouch endm endif ; RADIO_STATUS_ICON_ON_PRIMARY ;-------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RadioStatusIconLongTouch %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle long touch on radio status icon CALLED BY: MSG_RADIO_STATUS_ICON_LONG_TOUCH PASS: *ds:si = RadioStatusIconClass object ds:di = RadioStatusIconClass instance data ds:bx = RadioStatusIconClass object (same as *ds:si) es = segment of RadioStatusIconClass ax = message # RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- joon 3/27/97 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if RADIO_STATUS_ICON_ON_PRIMARY ;---------------------------- RadioStatusIconLongTouch method dynamic RadioStatusIconClass, MSG_RADIO_STATUS_ICON_LONG_TOUCH token local GeodeToken msg local word .enter push ss lea ax, ss:[token] push ax push ss lea ax, ss:[msg] push ax call PUGETRADIOSTATUSICONLONGTOUCH call RadioStatusIconSendIACPMessage .leave ret RadioStatusIconLongTouch endm endif ; RADIO_STATUS_ICON_ON_PRIMARY ;-------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RadioStatusIconSendIACPMessage %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Send IACP message CALLED BY: RadioStatusIconShortTouch, RadioStatusIconLongTouch PASS: inherit stack RETURN: nothing DESTROYED: ax,bx,cx,dx,si,di,ds,es SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- joon 3/27/97 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if RADIO_STATUS_ICON_ON_PRIMARY ;-------------------------- RadioStatusIconSendIACPMessage proc near .enter inherit RadioStatusIconShortTouch tstdw ss:[token].GT_chars jz done mov dx, MSG_GEN_PROCESS_OPEN_APPLICATION call IACPCreateDefaultLaunchBlock jc done push bp segmov es, ss lea di, ss:[token] mov bx, dx clr ax call IACPConnect mov di, bp ; di = IACPConnection pop bp jc done push di mov bx, segment GenApplicationClass mov si, offset GenApplicationClass mov ax, ss:[msg] mov di, mask MF_RECORD call ObjMessage mov bx, di pop di push bp mov ax, IACPS_CLIENT clr cx ; no completion message mov dx, TO_PROCESS mov bp, di call IACPSendMessage clr cx call IACPShutdown pop bp done: .leave ret RadioStatusIconSendIACPMessage endp endif ; RADIO_STATUS_ICON_ON_PRIMARY ;---------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RadioStatusIconGainedSysTargetExcl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Primary gained sys target excl CALLED BY: MSG_META_GAINED_SYS_TARGET_EXCL PASS: *ds:si = RadioStatusIconClass object ds:di = RadioStatusIconClass instance data ds:bx = RadioStatusIconClass object (same as *ds:si) es = segment of RadioStatusIconClass ax = message # RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- joon 3/26/97 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if RADIO_STATUS_ICON_ON_PRIMARY ;----------------------------- RadioStatusIconGainedSysTargetExcl method dynamic RadioStatusIconClass, MSG_META_GAINED_SYS_TARGET_EXCL mov ds:[di].RSII_sysTarget, TRUE cmp ds:[di].RSII_radioStatus, PRS_CALL_IN_PROGRESS jne done clr ds:[di].RSII_iconCycleCount GOTO RadioStatusIconStartTimer done: ret RadioStatusIconGainedSysTargetExcl endm endif ; RADIO_STATUS_ICON_ON_PRIMARY ;----------------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RadioStatusIconLostSysTargetExcl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Primary lost sys focus excl CALLED BY: MSG_META_LOST_SYS_TARGET_EXCL PASS: *ds:si = RadioStatusIconClass object ds:di = RadioStatusIconClass instance data ds:bx = RadioStatusIconClass object (same as *ds:si) es = segment of RadioStatusIconClass ax = message # RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- joon 3/26/97 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if RADIO_STATUS_ICON_ON_PRIMARY ;--------------------------- RadioStatusIconLostSysTargetExcl method dynamic RadioStatusIconClass, MSG_META_LOST_SYS_TARGET_EXCL mov ds:[di].RSII_sysTarget, FALSE clr bx xchg bx, ds:[di].RSII_cycleTimer tst bx jz done mov ax, ds:[di].RSII_cycleTimerID GOTO TimerStop done: ret RadioStatusIconLostSysTargetExcl endm endif ; RADIO_STATUS_ICON_ON_PRIMARY ;--------------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RadioStatusIconStartTimer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Start "call in progress" cycle timer CALLED BY: RadioStatusIconNotify, RadioStatusIconCallInProgressTimerMsg, RadioStatusIconGainedSysTargetExcl, PASS: *ds:si = RadioStatusIconClass object RETURN: nothing DESTROYED: ax, bx, cx, dx, di SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- joon 3/26/97 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if RADIO_STATUS_ICON_ON_PRIMARY ;--------------------- RadioStatusIconStartTimer proc far mov di, ds:[si] add di, ds:[di].RadioStatusIcon_offset tst ds:[di].RSII_cycleTimer jnz done tst ds:[di].RSII_sysTarget jz done mov al, TIMER_EVENT_ONE_SHOT mov bx, ds:[LMBH_handle] mov cx, RADIO_STATUS_ICON_CYCLE_INTERVAL mov dx, MSG_RADIO_STATUS_ICON_CALL_IN_PROGRESS_TIMER_MSG call TimerStart mov di, ds:[si] add di, ds:[di].RadioStatusIcon_offset mov ds:[di].RSII_cycleTimer, bx mov ds:[di].RSII_cycleTimerID, ax done: ret RadioStatusIconStartTimer endp endif ; RADIO_STATUS_ICON_ON_PRIMARY ;--------------------- COMMENT @---------------------------------------------------------------------- FUNCTION: EnsureFileMenu DESCRIPTION: Make sure we have a File menu. CALLED BY: INTERNAL OLBaseWinUpdateSpecBuild PASS: *ds:si - OLBaseWin object RETURN: nothing DESTROYED: ax, bx, cx, dx, di, bp REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 5/18/92 Initial version VL 7/10/95 Comment this procedure out if _DISABLE_APP_EXIT_UI is true. ------------------------------------------------------------------------------@ EnsureFileMenu proc near if not _DISABLE_APP_EXIT_UI call AA_DerefVisSpec_DI test ds:[di].OLWI_moreFixedAttr, mask OWMFA_CUSTOM_WINDOW LONG jnz done ; not for custom windows if _GCM test ds:[di].OLWI_fixedAttr, mask OWFA_GCM_TITLED LONG jnz done ; not for GCM endif mov ax, HINT_PRIMARY_NO_FILE_MENU call ObjVarFindData ; carry set if found jc done ; don't want "File" menu mov ax, ATTR_OL_BASE_WIN_HAVE_FILE_MENU call ObjVarFindData ; carry set if found jc done ; have "File" menu ; ; don't add "File" menu if in UILM_TRANSPARENT mode and not a ; Desk Accessory, cause all we're gonna do with it is add an "Exit" ; trigger, which we don't want for UILM_TRANSPARENT ; call UserGetLaunchModel ; ax = UILaunchModel cmp ax, UILM_TRANSPARENT jne addFileMenu ; not UILM_TRANSPARENT, add call UserGetLaunchOptions test ax, mask UILO_CLOSABLE_APPS jne addFileMenu mov ax, MSG_GEN_APPLICATION_GET_LAUNCH_FLAGS call GenCallApplication ; al = AppLaunchFlags test al, mask ALF_DESK_ACCESSORY jz done ; not DA, no File menu addFileMenu: ; ; need to add "File" menu ; push es mov cx, ds:[LMBH_handle] ; add to OLBaseWin mov dx, si mov di, segment GenInteractionClass mov es, di mov di, offset GenInteractionClass mov al, -1 ; init USABLE mov ah, -1 ; one-way upward generic link clr bx mov bp, CCO_FIRST ; (not dirty) call OpenCreateChildObject ; ^lcx:dx = "File" menu pop es ; ; Save lptr of created "File" menu in OLBaseWin. ; mov ax, TEMP_OL_BASE_WIN_FILE_MENU mov cx, size lptr call ObjVarAddData mov ds:[bx], dx ; save lptr of "File" menu mov si, dx ; *ds:si = "File" menu .warn -private mov di, ds:[si] add di, ds:[di].Gen_offset mov ds:[di].GII_visibility, GIV_POPUP .warn @private mov ax, ATTR_GEN_INTERACTION_GROUP_TYPE or \ mask VDF_SAVE_TO_STATE mov cx, size GenInteractionGroupType call ObjVarAddData ; ds:dx = pointer to extra data mov {GenInteractionGroupType} ds:[bx], GIGT_FILE_MENU mov ax, si ; *ds:ax = "File" menu mov bx, mask OCF_DIRTY shl 8 call ObjSetFlags ; undo dirtying by ObjVarAddData clr bp ; basic build call VisSendSpecBuildBranch ; build it done: endif ret EnsureFileMenu endp AppAttach ends ;------------------ WinClasses segment resource COMMENT @---------------------------------------------------------------------- METHOD: OLBaseWinNotifyOfFileMenu DESCRIPTION: notification that "File" menu exists PASS: *ds:si - instance data es - segment of OpenWinClass ax - MSG_OL_BASE_WIN_NOTIFY_OF_FILE_MENU ^lcx:dx - OD of "File" menu RETURN: carry - ? ax, cx, dx, bp - ? DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 5/1892 Initial version ------------------------------------------------------------------------------@ OLBaseWinNotifyOfFileMenu method dynamic OLBaseWinClass, \ MSG_OL_BASE_WIN_NOTIFY_OF_FILE_MENU mov ax, ATTR_OL_BASE_WIN_HAVE_FILE_MENU ; don't save to state clr cx ; no extra data call ObjVarAddData ret OLBaseWinNotifyOfFileMenu endm WinClasses ends ;-------------------- AppAttach segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLBaseWinDetermineInitialMinimizedStatus %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: See if this app should come up minimized CALLED BY: OLBaseWinUpdateWindow PASS: *ds:si - OLBaseWinClass object cx - UpdateWindowFlags RETURN: nothing DESTROYED: ax, dx, bp PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 11/ 3/93 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ OLBaseWinDetermineInitialMinimizedStatus proc near test cx, mask UWF_RESTORING_FROM_STATE jz done ; ; If we're not in transparent mode, then leave it the way it is. ; call UserGetLaunchModel cmp al, UILM_TRANSPARENT jne done ; ; see if we were restored from state by the GenField, as ; opposed to being clicked-on by the user. ; This is a hack, since we know the GenField sets the ; ALF_OPEN_IN_BACK flag, and this isn't set when the ; user clicks on an app. ; push cx mov ax, MSG_GEN_APPLICATION_GET_LAUNCH_FLAGS call UserCallApplication pop cx test al, mask ALF_OPEN_IN_BACK jnz done ; ; Launched by the user -- get rid of the MINIMIZED hint, if ; it's there ; mov ax, ATTR_GEN_DISPLAY_MINIMIZED_STATE call ObjVarDeleteData done: ret OLBaseWinDetermineInitialMinimizedStatus endp COMMENT @---------------------------------------------------------------------- METHOD: OLBaseWinUpdateWindow -- MSG_META_UPDATE_WINDOW for OLBaseWinClass DESCRIPTION: PASS: *ds:si - instance data (for object in OLBaseWin class) es - segment of OLBaseWinClass ax - MSG_META_UPDATE_WINDOW cx - UpdateWindowFlags dl - VisUpdateMode RETURN: carry - ? ax - ? cx - ? dx - ? bp - ? DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 6/9/92 Initial version ------------------------------------------------------------------------------@ OLBaseWinUpdateWindow method dynamic OLBaseWinClass, MSG_META_UPDATE_WINDOW test cx, mask UWF_ATTACHING jz callSuper ; Attaching: ; push ax, cx, dx ; ; If restoring from state, decide whether the app should be ; minimized or not (if it was minimized before). This is kind ; of a hack, but the idea is this: if the GenField is ; restoring us from state, then we want the minimized status ; to be the same as it was when we exited. If we're in ; transparent mode, however, and we were previously minimized ; and then detached, then we want to come back full-sized. call OLBaseWinDetermineInitialMinimizedStatus ; Decided here whether applications coming up for the first time ; should be maximized or not. If restarting, leave in whatever state ; they were in. ; call OLBaseWinDetermineInitialMaximizedStatus call RemoveTitleBarIfPossible pop ax, cx, dx callSuper: push cx mov di, offset OLBaseWinClass call ObjCallSuperNoLock pop cx test cx, mask UWF_DETACHING jz notDetaching ; detaching: ; Don't need to do this -- trigger is IGNORE_DIRTY & set up with one way generic ; linkage so that it will just disappear on detach. -- Doug 1/29/93 ; ; ; ; If we added a help trigger before, remove it now during detach ; ; ; call OLBaseWinRemoveHelpTrigger if RADIO_STATUS_ICON_ON_PRIMARY call OLBaseWinRemoveRadioStatusIcon endif ISU < call EnsureItemRemovedFromWindowList > jmp short done notDetaching: ISU < test cx, mask UWF_ATTACHING > ISU < jz done > ISU < call EnsureItemAddedToWindowList > done: ret OLBaseWinUpdateWindow endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RemoveTitleBarIfPossible %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: RemoveTitleBarIfPossible CALLED BY: INTERNAL OLBaseWinUpdateWindow OLBaseWinSpecSetUsable PASS: *ds:si = OLBaseWin RETURN: nothing DESTROYED: ax, bx, di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 5/27/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RemoveTitleBarIfPossible proc far ; ; If the window is maxmized and we are running UILM_TRANSPARENT mode ; and we have no window header gadgetry, then remove the title bar ; completely. ; call UserGetLaunchModel ;ax = UILaunchModel cmp ax, UILM_TRANSPARENT jne leaveTitleBar ;not UILM_TRANSPARENT, leave title bar call UserGetLaunchOptions test ax, mask UILO_CLOSABLE_APPS jne leaveTitleBar mov ax, ATTR_GEN_DISPLAY_MAXIMIZED_STATE call ObjVarFindData jnc leaveTitleBar ;not maximized, leave title bar call AA_DerefVisSpec_DI ; ; unfortunately, it is not as simple as check OWA_HAS_SYS_MENU, etc. ; ; XXX: what about HINT_SEEK_TITLE_BAR_{RIGHT,LEFT} ; ; if express menu appears in top primary, leave title bar call SpecGetExpressOptions ;ax = UIExpressOptions andnf ax, mask UIEO_POSITION cmp ax, UIEP_TOP_PRIMARY shl offset UIEO_POSITION je leaveTitleBar ; if hiding help buttons, continue checks push es, ax segmov es, dgroup, ax ;es = dgroup test es:[olHelpOptions], mask UIHO_HIDE_HELP_BUTTONS pop es, ax jnz 10$ ; if not hiding help buttons, and no no-help-button hint, leave title ; bar mov ax, HINT_PRIMARY_NO_HELP_BUTTON call ObjVarFindData jnc leaveTitleBar 10$: ; if OWA_HAS_SYS_MENU is clear, then we definitely don't have header ; gadgets, and can nuke title bar test ds:[di].OLWI_attrs, mask OWA_HAS_SYS_MENU jz nukeTitleBar ; if a window menu is allowed, we have title bar call SpecGetWindowOptions ;al = UIWindowOptions test al, mask UIWO_WINDOW_MENU jnz leaveTitleBar ; we have no window menu (it is just a close button), if we are ; closable, we have title bar test ds:[di].OLWI_attrs, mask OWA_CLOSABLE jnz leaveTitleBar ; if we don't allow min/max/restore controls, we can nuke title bar test al, mask UIWO_PRIMARY_MIN_MAX_RESTORE_CONTROLS jz nukeTitleBar ; if we do allow min/max/restore controls, and we are minimizable, ; maximizable, or restorable, we have title bar test ds:[di].OLWI_attrs, mask OWA_MAXIMIZABLE or \ mask OWA_MINIMIZABLE jnz leaveTitleBar test ds:[di].OLWI_fixedAttr, mask OWFA_RESTORABLE jnz leaveTitleBar nukeTitleBar: andnf ds:[di].OLWI_attrs, not (mask OWA_HEADER or mask OWA_TITLED) leaveTitleBar: ret RemoveTitleBarIfPossible endp COMMENT @---------------------------------------------------------------------- FUNCTION: OLBaseWinDetermineInitialMaximizedStatus DESCRIPTION: Determine intitial MAXIMIZED status for this primary window. At this time, always preserve state if restoring from state. If coming up fresh, we generally rely on application hints, though override forcing maximization in certain situations NOTE: UIWO_MAXIMIZE_ON_STARTUP is set in SpecInit, called when this library is first loaded. CALLED BY: INTERNAL OLBaseWinUpdateWindow PASS: *ds:si - base win cx - UpdateWindowFlags UWF_RESTORING_FROM_STATE RETURN: nothing ALLOWED TO DESTROY: ax, bx, cx, dx, bp REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: set ATTR_GEN_DISPLAY_MAXIMIZED_STATE if necessary, actual maximization is handled in MSG_SPEC_BUILD (in OLMenuedWin). KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 2/11/92 Initial version brianc 3/12/92 Add HINT_DISPLAY_MAXIMIZED_ON_STARTUP ------------------------------------------------------------------------------@ OLBaseWinDetermineInitialMaximizedStatus proc near ; ; If restoring from state, leave ATTR_GEN_DISPLAY_MAXIMIZED_STATE ; (if any) alone. ; test cx, mask UWF_RESTORING_FROM_STATE if (not _IGNORE_STATES_MAXIMIZING) jnz done else ; else of if (not _IGNORE_STATES_MAXIMIZING) jz notRestoringFromState ; ; Check .ini file to see if we need to blindly follow the state ; files (default) or check the system configuration. ; push ds, si, cx, dx mov cx, cs mov dx, offset ignoreStateKey mov ds, cx mov si, offset ignoreStateCategory call InitFileReadBoolean pop ds, si, cx, dx jc done ; if not found, default is believe state tst ax jz done ; if not set, believe state. ; ; nuke this hint if it was there when we shut down, and ; just believe the sytem's defaults for bringing up the Primary ; mov ax, ATTR_GEN_DISPLAY_MAXIMIZED_STATE call ObjVarDeleteData notRestoringFromState: endif ; endif of else of if (not _IGNORE_STATES_MAXIMIZING) ; ; If HINT_DISPLAY_MAXIMIZED_ON_STARTUP, maximize. This is ; spui dependent. This code implements default-to-non-maximized. ; Check HINT_DISPLAY_NOT_MAXIMIZED_ON_STARTUP instead, if we ; change to default-to-maximized. ; mov ax, HINT_DISPLAY_MAXIMIZED_ON_STARTUP call ObjVarFindData ; carry set if found jc setMax ; found, set max ; ; Test global Motif flag, initialized in library init code based on ; system conditions (See SpecInitDefaultDisplayScheme). ; push es segmov es, dgroup, ax test es:[olWindowOptions], mask UIWO_MAXIMIZE_ON_STARTUP pop es jz done setMax: ; ; set maximized if spui lets us -- hints could clear this ; test ds:[di].OLWI_attrs, mask OWA_MAXIMIZABLE jz done ; ; set maximized, will be evaluated in MSG_SPEC_BUILD. ; mov ax, ATTR_GEN_DISPLAY_MAXIMIZED_STATE or mask VDF_SAVE_TO_STATE clr cx call ObjVarAddData done: ret OLBaseWinDetermineInitialMaximizedStatus endp if _IGNORE_STATES_MAXIMIZING LocalDefNLString ignoreStateCategory, <'ui features',0> LocalDefNLString ignoreStateKey, <'ignoreStatesMaximizing',0> endif ; if _IGNORE_STATES_MAXIMIZING AppAttach ends ;------------------------------- Unbuild segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLBaseWinSpecUnbuild %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Remove this window from the window list before doing normal unbuild. CALLED BY: MSG_SPEC_UNBUILD PASS: *ds:si = OLBaseWinClass object ds:di = OLBaseWinClass instance data ds:bx = OLBaseWinClass object (same as *ds:si) es = segment of OLBaseWinClass ax = message # RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- JS 9/18/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ OLBaseWinSpecUnbuild method dynamic OLBaseWinClass, MSG_SPEC_UNBUILD mov di, offset OLBaseWinClass call ObjCallSuperNoLock ; ; If we added objects to the primary during spec build, ; remove them now during unbuild ; call OLBaseWinRemoveSpecBuildCreatedObjects if RADIO_STATUS_ICON_ON_PRIMARY call OLBaseWinRemoveRadioStatusIcon endif ISU < call EnsureItemRemovedFromWindowList > ret OLBaseWinSpecUnbuild endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLBaseWinRemoveSpecBuildCreatedObjects %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: remove ui objects added to this OLBaseWin during spec build CALLED BY: INTERNAL OLBaseWinSpecUnbuild PASS: *ds:si = OLBaseWin RETURN: nothing DESTROYED: ax, bx, cx, dx, bp, di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 1/25/93 Broke out of OLBaseWinUpdateWindow %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ OLBaseWinRemoveSpecBuildCreatedObjects proc near mov di, ds:[si] add di, ds:[di].Vis_offset if _GCM mov ax, ds:[di].OLBWI_gcmLeftIcon tst ax jz afterLeftGCM call OLBWRSBO_genDestroy ;destroy GCM left moniker afterLeftGCM: endif mov ax, TEMP_OL_BASE_WIN_HELP_TRIGGER call OLBWRSBO_destroyIfFound if _FLOATING_KEYBOARD_TRIGGER_ON_PRIMARY mov ax, TEMP_OL_BASE_WIN_KBD_TRIGGER call OLBWRSBO_destroyIfFound endif mov ax, TEMP_OL_BASE_WIN_FILE_MENU FALL_THRU OLBWRSBO_destroyIfFound OLBaseWinRemoveSpecBuildCreatedObjects endp ; Pass: ax = vardata ; OLBWRSBO_destroyIfFound proc near call ObjVarFindData jc destroy ;destroy if found ret destroy: mov ax, ds:[bx] ;ax <- lptr of object call ObjVarDeleteDataAt FALL_THRU OLBWRSBO_genDestroy OLBWRSBO_destroyIfFound endp ; Pass: ax = lptr of object to destroy ; OLBWRSBO_genDestroy proc near push si mov_tr si, ax mov ax, MSG_GEN_DESTROY mov dl, VUM_NOW clr bp ;bp <- don't dirty call ObjCallInstanceNoLock pop si ret OLBWRSBO_genDestroy endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% EnsureItemRemovedFromWindowList %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Ensures that this window is removed from the window list CALLED BY: OLBaseWinSpecUnbuild OLBaseWinUpdateWindow PASS: *ds:si - OLBaseWin object RETURN: nothing DESTROYED: ax, cx, dx, bp, ds SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- JS 9/18/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if _ISUI ;-------------------------------------------------------------------- EnsureItemRemovedFromWindowList proc far clr bx mov di, ds:[si] add di, ds:[di].Vis_offset xchg bx, ds:[di].OLBWI_windowListEntry.handle tst bx jz done push si mov si, ds:[di].OLBWI_windowListEntry.chunk mov ax, MSG_GEN_DESTROY mov dl, VUM_NOW clr bp mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage pop si mov cx, TRUE ; re-initialize list call UpdateTaskBarList done: ret EnsureItemRemovedFromWindowList endp endif ;---------------------------------------------------------------------- Unbuild ends ;------------------------------- Geometry segment resource COMMENT @---------------------------------------------------------------------- ROUTINE: OLBaseWinGetMinSize SYNOPSIS: Returns the minimum size for a window. CALLED BY: INTERNAL PASS: *ds:si -- object RETURN: cx -- minimum width dx -- minimum height DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 11/ 1/89 Initial version ------------------------------------------------------------------------------@ OLBaseWinGetMinSize method dynamic OLBaseWinClass, \ MSG_VIS_COMP_GET_MINIMUM_SIZE ;call superclass to get minimum size info mov di, offset OLBaseWinClass call ObjCallSuperNoLock ;now, since this is a GenPrimary, it may have to display the ;Workspace and Application icons in the future - let's set aside ;the room for them now. OLS < add cx, OLS_WIN_ICON_WIDTH*5 ;was *2 > CUAS < add cx, CUAS_WIN_ICON_WIDTH*2 > ret OLBaseWinGetMinSize endm Geometry ends ;------------------------------- WinIconCode segment resource COMMENT @---------------------------------------------------------------------- METHOD: OLBaseWinMoveOffScreen DESCRIPTION: Moves base window off-screen, then performs superclass action PASS: *ds:si - instance data (for object in OLBaseWin class) es - segment of OLBaseWinClass ax - MSG_GEN_DISPLAY_SET_MINIMIZED cx, dx, bp - data to pass on to superclass handler RETURN: carry - ? ax - ? cx - ? dx - ? bp - ? DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 10/90 Initial version Joon 11/92 PM additions ------------------------------------------------------------------------------@ OLBaseWinMoveOffScreen method dynamic OLBaseWinClass, \ MSG_GEN_DISPLAY_SET_MINIMIZED test ds:[di].OLWI_attrs, mask OWA_MINIMIZABLE jz done ; not minimizable, do nothing test ds:[di].OLWI_specState, mask OLWSS_MINIMIZED jnz done ; already minimized, do nothing ;let superclass set OLWSS_MINIMIZED call OLWinMoveOffScreen ; Move window off-screen first, ; to minimize calculations, ; drawing, for both speed & ; visual effect mov ax, MSG_GEN_DISPLAY_SET_MINIMIZED mov di, offset OLBaseWinClass call ObjCallSuperNoLock if _NO_WIN_ICONS ; Since we do not create an icon when we minimize, we need to make ; sure that some other object has the active focus/target. clr bx call GeodeGetAppObject mov ax, MSG_GEN_LOWER_TO_BOTTOM mov di, mask MF_FORCE_QUEUE ; (but do this after the window call ObjMessage ; is actually up on screen) endif done: ret OLBaseWinMoveOffScreen endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLBaseWinSetNotMinimized %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Call superclass and update express menu CALLED BY: MSG_GEN_DISPLAY_SET_NOT_MINIMIZED PASS: *ds:si = OLBaseWinClass object ds:di = OLBaseWinClass instance data ds:bx = OLBaseWinClass object (same as *ds:si) es = segment of OLBaseWinClass ax = message # RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Joon 5/31/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if PLACE_EXPRESS_MENU_ON_PRIMARY and (not TOOL_AREA_IS_TASK_BAR) OLBaseWinDisplaySetNotMinimized method dynamic OLBaseWinClass, MSG_GEN_DISPLAY_SET_NOT_MINIMIZED mov di, offset OLBaseWinClass call ObjCallSuperNoLock call OLBaseWinUpdateExpressToolArea ret OLBaseWinDisplaySetNotMinimized endm endif ; PLACE_EXPRESS_MENU_ON_PRIMARY and (not TOOL_AREA_IS_TASK_BAR) COMMENT @---------------------------------------------------------------------- FUNCTION: OLWinMoveOffScreen DESCRIPTION: Move window off-screen, so it will not be visible CALLED BY: INTERNAL PASS: *ds:si - VisComp object RETURN: Nothing DESTROYED: Nothing REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 10/90 Initial version ------------------------------------------------------------------------------@ OLWinMoveOffScreen proc near uses ax, bx, cx, dx, si, di, bp .enter mov di, ds:[si] add di, ds:[di].Vis_offset ;ds:di = VisInstance EC < test ds:[di].VI_typeFlags, mask VTF_IS_WINDOW > EC < ERROR_Z OL_ERROR > mov di, ds:[di].VCI_window ; get window handle or di, di jz done ; if no window, done call WinGetWinScreenBounds ; Get current bounds of window tst cx ; If right edge is negative, done. js done mov ax, cx ; Otherwise, move right edge to left neg ax ; edge of screen, dec ax ; & one more to be completely off. clr bx ; leave as is vertically clr si ; move relative call WinMove done: .leave ret OLWinMoveOffScreen endp WinIconCode ends WinClasses segment resource COMMENT @---------------------------------------------------------------------- METHOD: OLBaseWinGainedSystemTargetExcl DESCRIPTION: We intercept this method here so that we can update the TaskEntry in the express menu. PASS: *ds:si - instance data ax - MSG_META_GAINED_SYS_TARGET_EXCL RETURN: nothing DESTROYED: ? PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 1/90 initial version Doug 6/91 Switched from focus to target interception ------------------------------------------------------------------------------@ OLBaseWinGainedSystemTargetExcl method dynamic OLBaseWinClass, MSG_META_GAINED_SYS_TARGET_EXCL call WinClasses_ObjCallSuperNoLock_OLBaseWinClass if PLACE_EXPRESS_MENU_ON_PRIMARY push es segmov es, dgroup, ax mov ax, es:[olExpressOptions] pop es andnf ax, mask UIEO_POSITION cmp ax, UIEP_NONE shl offset UIEO_POSITION je afterExpressMenu ; if turned off, size = 0 cmp ax, UIEP_LOWER_LEFT shl offset UIEO_POSITION je afterExpressMenu ; if lower left, don't place ; in primary call WinClasses_DerefVisSpec_DI test ds:[di].OLBWI_flags, mask OLBWF_REJECT_EXPRESS_TOOL_AREA jz haveExpress call OLBaseWinHideExpressToolArea jmp short afterExpressMenu haveExpress: endif ; PLACE_EXPRESS_MENU_ON_PRIMARY if PLACE_EXPRESS_MENU_ON_PRIMARY or TOOL_AREA_IS_TASK_BAR ; Set flag indicating we have the express tool area now, & ; move it to the correct place. ; call WinClasses_DerefVisSpec_DI EC < test ds:[di].OLBWI_flags, mask OLBWF_HAS_EXPRESS_TOOL_AREA > EC < ERROR_NZ OL_ERROR > ornf ds:[di].OLBWI_flags, mask OLBWF_HAS_EXPRESS_TOOL_AREA endif ; PLACE_EXPRESS_MENU_ON_PRIMARY or TOOL_AREA_IS_TASK_BAR if PLACE_EXPRESS_MENU_ON_PRIMARY ; Cheat -- instead of doing full geometry, just update ; OLWI_titleBarBounds to reflect the addition of the express tool area. ; call OLBaseWinAdjustTitleBoundsForExpressToolArea if REDO_GEOMETRY_FOR_EXPRESS_MENU ; If we're putting the menu bar in the title area, we need to ; invalidate the geometry of the menu bar so it gets resized. ; call OLRedoMenuBarGeometryIfMenusInHeader endif endif ; PLACE_EXPRESS_MENU_ON_PRIMARY if PLACE_EXPRESS_MENU_ON_PRIMARY or TOOL_AREA_IS_TASK_BAR ; Now that the new title bounds have been determined, ask the field ; to position the little tool area over the edge of it. ; call OLBaseWinUpdateExpressToolArea afterExpressMenu: endif ; PLACE_EXPRESS_MENU_ON_PRIMARY or TOOL_AREA_IS_TASK_BAR if RADIO_STATUS_ICON_ON_PRIMARY mov ax, MSG_META_GAINED_SYS_TARGET_EXCL call OLBaseWinUpdateStatusIcon endif ; Now set some INVALID flags indicating how much of the header area ; should be redrawn. ; mov cl, mask OLWHS_TITLE_IMAGE_INVALID call OpenWinHeaderMarkInvalid ;Have our GenApplication update the GenItem which represents this ;GenPrimary in the ApplicationMenu mov cx, TRUE FALL_THRU UpdateAppMenuItemCommon OLBaseWinGainedSystemTargetExcl endp UpdateAppMenuItemCommon proc far if _ISUI push cx mov ax, MSG_OL_BASE_WIN_UPDATE_WINDOW_ENTRY call ObjCallInstanceNoLock pop cx endif mov ax, MSG_OL_APP_UPDATE_TASK_ENTRY call GenCallApplication ret UpdateAppMenuItemCommon endp if REDO_GEOMETRY_FOR_EXPRESS_MENU OLRedoMenuBarGeometryIfMenusInHeader proc near ; If we're putting the menu bar in the title area, we need to ; invalidate the geometry of the menu bar so it gets resized. ; call OpenWinCheckMenusInHeader jnc noInval call WinClasses_DerefVisSpec_DI push si mov bx, ds:[LMBH_handle] mov si, ds:[di].OLMDWI_menuBar mov cl, mask VOF_GEOMETRY_INVALID mov dl, VUM_NOW mov ax, MSG_VIS_MARK_INVALID mov di, mask MF_FORCE_QUEUE or mask MF_INSERT_AT_FRONT call ObjMessage pop si noInval: ret OLRedoMenuBarGeometryIfMenusInHeader endp endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLBaseWinHideExpressToolArea %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Hide the express tool area by moving it off screen CALLED BY: OLBaseWinGainedSystemTargetExcl PASS: *ds:si = instance data RETURN: nothing DESTROYED: ax, bx, cx, dx, di, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- JS 11/15/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if PLACE_EXPRESS_MENU_ON_PRIMARY and (not TOOL_AREA_IS_TASK_BAR) OLBaseWinHideExpressToolArea proc near push si mov bx, segment OLFieldClass mov si, offset OLFieldClass mov dx, size OLFieldMoveToolAreaParams sub sp, dx mov bp, sp mov ss:[bp].OLFMTAP_geode, 0 ; park the tool area off screen mov ss:[bp].OLFMTAP_xPos, 0 ; not needed for parking off-screen mov ss:[bp].OLFMTAP_yPos, 0 ; not needed for parking off-screen ; not needed for parking off-screen mov ss:[bp].OLFMTAP_layerPriority, 0 mov ax, MSG_OL_FIELD_MOVE_TOOL_AREA mov di, mask MF_RECORD or mask MF_STACK call ObjMessage add sp, size OLFieldMoveToolAreaParams pop si mov cx, di mov ax, MSG_GEN_GUP_CALL_OBJECT_OF_CLASS call GenCallParent ret OLBaseWinHideExpressToolArea endp endif ; PLACE_EXPRESS_MENU_ON_PRIMARY and (not TOOL_AREA_IS_TASK_BAR) COMMENT @---------------------------------------------------------------------- FUNCTION: OLBaseWinAdjustTitleBoundsForExpressToolArea DESCRIPTION: Adjusts bounds of title area to be smaller if this app currently has the express tool area associated with it. CALLED BY: INTERNAL OLBaseWinGainedTargetExcl (Calls here from above to avoid full geometry) OpenWinCalcWinHdrGeometry (cwinClassCommon.asm - WinCommon) PASS: *ds:si - OLWinClass RETURN: nothing DESTROYED: ax, bx, cx, dx, bp, di REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 6/92 Initial version ------------------------------------------------------------------------------@ if PLACE_EXPRESS_MENU_ON_PRIMARY and (not TOOL_AREA_IS_TASK_BAR) OLBaseWinAdjustTitleBoundsForExpressToolArea proc far ; If doesn't have Express tool area, then nothing to adjust. ; call WinClasses_DerefVisSpec_DI test ds:[di].OLBWI_flags, mask OLBWF_HAS_EXPRESS_TOOL_AREA jz done ; Adjust left edge of title area ; call OLBaseWinGetExpressMenuButtonWidth call WinClasses_DerefVisSpec_DI add ds:[di].OLWI_titleBarBounds.R_left, bp done: ret OLBaseWinAdjustTitleBoundsForExpressToolArea endp endif ; PLACE_EXPRESS_MENU_ON_PRIMARY and (not TOOL_AREA_IS_TASK_BAR) COMMENT @---------------------------------------------------------------------- METHOD: OLBaseWinLostSystemTargetExcl DESCRIPTION: We intercept this method here so that we can release our hold on the express menu PASS: *ds:si - instance data ax - MSG_META_LOST_SYS_TARGET_EXCL RETURN: nothing DESTROYED: ? PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 6/92 Initial version ------------------------------------------------------------------------------@ OLBaseWinLostSystemTargetExcl method dynamic OLBaseWinClass, MSG_META_LOST_SYS_TARGET_EXCL call WinClasses_ObjCallSuperNoLock_OLBaseWinClass if PLACE_EXPRESS_MENU_ON_PRIMARY or TOOL_AREA_IS_TASK_BAR ; ; we cannot use olExpressOptions as MSG_META_LOST_SYS_TARGET_EXCL could ; come in after we've switched to another field and updated olExpressOptions ; for that field. Instead, we'll just depend on OLBWF_HAS_EXPRESS_TOOL_AREA ; - brianc 11/30/92 if 0 push es segmov es, dgroup, ax mov ax, es:[olExpressOptions] pop es andnf ax, mask UIEO_POSITION cmp ax, UIEP_NONE shl offset UIEO_POSITION je afterExpressMenu ; if turned off, no geometry cmp ax, UIEP_LOWER_LEFT shl offset UIEO_POSITION je afterExpressMenu ; if lower left, no geometry call WinClasses_DerefVisSpec_DI EC < test ds:[di].OLBWI_flags, mask OLBWF_HAS_EXPRESS_TOOL_AREA or\ mask OLBWF_REJECT_EXPRESS_TOOL_AREA> EC < ERROR_Z OL_ERROR ;one of them should be set > test ds:[di].OLBWI_flags, mask OLBWF_REJECT_EXPRESS_TOOL_AREA jnz afterExpressMenu EC < test ds:[di].OLBWI_flags, mask OLBWF_HAS_EXPRESS_TOOL_AREA > EC < ERROR_Z OL_ERROR > andnf ds:[di].OLBWI_flags, not mask OLBWF_HAS_EXPRESS_TOOL_AREA else call WinClasses_DerefVisSpec_DI test ds:[di].OLBWI_flags, mask OLBWF_HAS_EXPRESS_TOOL_AREA jz afterExpressMenu andnf ds:[di].OLBWI_flags, not mask OLBWF_HAS_EXPRESS_TOOL_AREA endif endif ; PLACE_EXPRESS_MENU_ON_PRIMARY or TOOL_AREA_IS_TASK_BAR if PLACE_EXPRESS_MENU_ON_PRIMARY and (not TOOL_AREA_IS_TASK_BAR) ; Adjust left edge of title area ; call OLBaseWinGetExpressMenuButtonWidth call WinClasses_DerefVisSpec_DI sub ds:[di].OLWI_titleBarBounds.R_left, bp ; If we're putting the menu bar in the title area, we need to ; invalidate the geometry of the menu bar so it gets resized. ; if REDO_GEOMETRY_FOR_EXPRESS_MENU call OLRedoMenuBarGeometryIfMenusInHeader endif endif ; PLACE_EXPRESS_MENU_ON_PRIMARY and (not TOOL_AREA_IS_TASK_BAR) afterExpressMenu: if RADIO_STATUS_ICON_ON_PRIMARY mov ax, MSG_META_LOST_SYS_TARGET_EXCL call OLBaseWinUpdateStatusIcon endif ; Now set some INVALID flags indicating how much of the header area ; should be redrawn. ; mov cl, mask OLWHS_TITLE_IMAGE_INVALID call OpenWinHeaderMarkInvalid ISU < mov ax, MSG_OL_BASE_WIN_UPDATE_WINDOW_ENTRY > ISU < clr cx > ISU < call ObjCallInstanceNoLock > ret OLBaseWinLostSystemTargetExcl endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLBaseWinUpdateStatusIcon %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Update status icon if necessary CALLED BY: OLBaseWinGainedTargetExcl, OLBaseWinLostSystemTargetExcl PASS: *ds:si = instance data ax = MSG_META_{GAINED/LOST}_SYS_TARGET_EXCL RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- joon 3/26/97 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if RADIO_STATUS_ICON_ON_PRIMARY ;---------------------- OLBaseWinUpdateStatusIcon proc near uses ax,cx,dx,bp,si .enter mov si, ds:[si] add si, ds:[si].Vis_offset mov si, ds:[si].OLBWI_radioStatusIcon tst si jz done call ObjCallInstanceNoLock done: .leave ret OLBaseWinUpdateStatusIcon endp endif ; RADIO_STATUS_ICON_ON_PRIMARY ;----------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLBaseWinRemoveRadioStatusIcon %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Remove radio status icon CALLED BY: OLBaseWinSpecUnbuild, OLBaseWinUpdateWindow PASS: *ds:si = OLBaseWinClass instance data RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- joon 3/26/97 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if RADIO_STATUS_ICON_ON_PRIMARY ;----------------------- OLBaseWinRemoveRadioStatusIcon proc far uses ax,bx,cx,dx,si,di,bp .enter mov di, ds:[si] add di, ds:[di].Vis_offset clr dx xchg dx, ds:[di].OLBWI_radioStatusIcon tst dx jz done mov cx, ds:[LMBH_handle] mov bx, MANUFACTURER_ID_GEOWORKS mov ax, GCNSLT_PENELOPE_RADIO_STATUS_NOTIFICATIONS call GCNListRemove EC < ERROR_NC -1 > done: .leave ret OLBaseWinRemoveRadioStatusIcon endp endif ; RADIO_STATUS_ICON_ON_PRIMARY ;--------------- WinClasses ends ActionObscure segment resource COMMENT @---------------------------------------------------------------------- METHOD: OLBaseWinGetTargetAtTargetLevel DESCRIPTION: Returns current target object within this branch of the hierarchical target exclusive, at level requested PASS: *ds:si - instance data es - segment of OLBaseClass ax - MSG_META_GET_TARGET_AT_TARGET_LEVEL cx - TargetLevel RETURN: cx:dx - OD of target at level requested (0 if none) ax:bp - Class of target object REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 1/90 Initial version ------------------------------------------------------------------------------@ OLBaseWinGetTargetAtTargetLevel method dynamic OLBaseWinClass, \ MSG_META_GET_TARGET_AT_TARGET_LEVEL mov ax, TL_GEN_PRIMARY mov bx, Vis_offset mov di, offset OLWI_targetExcl call FlowGetTargetAtTargetLevel ret OLBaseWinGetTargetAtTargetLevel endm ActionObscure ends WinMethods segment resource COMMENT @---------------------------------------------------------------------- FUNCTION: OLBaseWinGenCloseInteraction -- MSG_GEN_CLOSE_INTERACTION handler for OLBaseWinClass DESCRIPTION: We intercept this method here because it has a distinct meaning to applications: QUIT! PASS: *ds:si = instance data for object RETURN: nothing DESTROYED: ? PSEUDO CODE/STRATEGY: MSG_OL_WIN_CLOSE is handled by OLMenuedWinClass where it its transformed into MSG_GEN_DISPLAY_CLOSE. REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 3/90 initial version Doug 4/93 Special behavior for transparent detach DA's VL 7/11/95 Always moves things to back if _DISABLE_APP_EXIT_UI if true. ------------------------------------------------------------------------------@ OLBaseWinGenCloseInteraction method dynamic OLBaseWinClass, \ MSG_GEN_DISPLAY_CLOSE test ds:[di].OLWI_attrs, mask OWA_CLOSABLE jz done ;skip if not closable add bx, ds:[bx].Gen_offset ;set ds:bx = Gen instance data test ds:[bx].GDI_attributes, mask GDA_USER_DISMISSABLE jz done ;skip if not dismissable... ife (_DISABLE_APP_EXIT_UI) ; ; Just quit app if standard launch mode. ; call UserGetLaunchModel ;ax = UILaunchModel cmp ax, UILM_TRANSPARENT jne closeApp ; If in transparent mode, but closable apps are allowed, ; then close the app, otherwise, just move it to the back ; (hide it) call UserGetLaunchOptions test ax, mask UILO_CLOSABLE_APPS jz moveToBack closeApp: mov ax, MSG_META_QUIT GOTO GenCallApplication endif ; not (_DISABLE_APP_EXIT_UI) moveToBack: ; ; If this is a DA running ON_TOP, drop the priority to standard, ; so we can hide in back as with other apps in the app cache. ; clr bx call GeodeGetAppObject call ObjSwapLock call OLAppLowerLayerPrioIfDeskAccessory call ObjSwapUnlock ; ; Now lower to bottom to force focus/target change ; clr bx call GeodeGetAppObject mov ax, MSG_GEN_LOWER_TO_BOTTOM mov di, mask MF_FORCE_QUEUE GOTO ObjMessage done: ret OLBaseWinGenCloseInteraction endm WinMethods ends ;------------------------------- WinClasses segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLBaseWinVisOpen %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Intercept MSG_VIS_OPEN so we can draw "zoom-lines" before the window comes up. CALLED BY: MSG_VIS_OPEN PASS: *ds:si = OLBaseWinClass object ds:di = OLBaseWinClass instance data ds:bx = OLBaseWinClass object (same as *ds:si) es = segment of OLBaseWinClass ax = message # ^hbp = parent window RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- JS 11/12/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if _ZOOM_LINES OLBaseWinVisOpen method dynamic OLBaseWinClass, MSG_VIS_OPEN call DrawZoomLines call WinClasses_ObjCallSuperNoLock_OLBaseWinClass ret OLBaseWinVisOpen endm endif ; if _ZOOM_LINES COMMENT @---------------------------------------------------------------------- FUNCTION: OLBaseWinVisClose DESCRIPTION: Intercept this method here as the window is closing To see if we cna't find another suitable object to take the focus/target exclusives. PASS: *ds:si = instance data for object RETURN: nothing DESTROYED: ? PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 2/90 initial version Joon 11/92 PM zoom lines ------------------------------------------------------------------------------@ OLBaseVisClose method dynamic OLBaseWinClass, MSG_VIS_CLOSE if _ZOOM_LINES call DrawZoomLines endif ;call super class ; call WinClasses_ObjCallSuperNoLock_OLBaseWinClass ; Ensure Focus & Target exist within application (window on close ; will first release these exclusives if it has them) ; mov ax, MSG_META_ENSURE_ACTIVE_FT GOTO GenCallApplication OLBaseVisClose endp if _ZOOM_LINES COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DrawZoomLines %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Draw zoom lines before a window opens to indicate where the window was opened from. CALLED BY: PASS: *ds:si = instance data ax = MSG_VIS_OPEN if opening zoom lines MSG_VIS_CLOSE if closing zoom lines RETURN: nothing DESTROYED: bx, cx, dx, di SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- JS 11/10/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DrawZoomLines proc far openCloseMsg local word push ax zoomLine local Rectangle zoomIncrement local Rectangle lineCount local word if _ROUND_THICK_DIALOGS zoomRegionOffset local word endif ;_ROUND_THICK_DIALOGS uses ax, si .enter ; ; Get window handle of the field window. We use the field window ; to reference mouse position. ; mov ax, MSG_GEN_GUP_QUERY mov cx, GUQT_FIELD push bp call ObjCallInstanceNoLock mov di, bp pop bp tst di LONG jz done ; ; Check for hint which indicates whether we should draw zoom-lines. ; mov ax, HINT_PRIMARY_OPEN_ICON_BOUNDS call ObjVarFindData ; ; If we are Zooming all primarys: We want to stuff the hint with ; the mouses's position for opening. If we are closing and can't ; find the hint then it has been nuked by a transparent detatch, ; and so we want skip drawing the close lines. ; dlitwin 3/4/94 ; if _ZOOM_ALL_PRIMARYS jc gotVarData cmp ss:[openCloseMsg], MSG_VIS_CLOSE ; opening or closing LONG je done call ZoomLinesStuffPositionHint gotVarData: else ; else of if _ZOOM_ALL_PRIMARYS ; ; If not zooming all primarys then we exit if we don't find the ; hint. ; LONG jnc done endif ; end of else of if _ZOOM_ALL_PRIMARYS if _ROUND_THICK_DIALOGS ; ; Figure out which region to zoom with. NOTE: *ds:si must still be ; pointing to object. ; mov ss:[zoomRegionOffset], offset RoundedPrimaryResizeRegion call OpenWinShouldHaveRoundBorderFar jc useRoundBorder mov ss:[zoomRegionOffset], offset PrimaryResizeRegion useRoundBorder: endif ;_ROUND_THICK_DIALOGS mov ss:[lineCount], 15 ; 15 iterations of zoom-lines cmp ss:[openCloseMsg], MSG_VIS_CLOSE ; opening or closing je closing ; ; If left bound is PARAM_0, then we will be starting zoom-lines from ; the center of the window. ; mov ax, ds:[bx].R_left cmp ax, PARAM_0 jne getIconBounds ; ; Get window bounds and calculate the center of the window. ; call VisGetBounds mov si, ax add si, cx shr si, 1 mov ss:[zoomLine].R_left, si mov ss:[zoomLine].R_right, si mov si, bx add si, dx shr si, 1 mov ss:[zoomLine].R_top, si mov ss:[zoomLine].R_bottom, si mov si, cx jmp short calcIncrements getIconBounds: ; ; Get icon bounds from hint data. ; mov ss:[zoomLine].R_left, ax mov ax, ds:[bx].R_top mov ss:[zoomLine].R_top, ax mov ax, ds:[bx].R_right mov ss:[zoomLine].R_right, ax mov ax, ds:[bx].R_bottom mov ss:[zoomLine].R_bottom, ax ; ; Get final position of zoom lines. ; call VisGetBounds mov si, cx jmp short calcIncrements closing: ; ; For closing windows, we start zoom-lines from the window bounds ; and shrink down to the center of the window. ; call VisGetBounds mov ss:[zoomLine].R_left, ax mov ss:[zoomLine].R_top, bx mov ss:[zoomLine].R_right, cx mov ss:[zoomLine].R_bottom, dx add ax, cx shr ax, 1 mov si, ax add bx, dx shr bx, 1 mov dx, bx calcIncrements: ; ; Calculate the increments by which we will change the zoom-line bounds ; mov cl, 4 sub ax, ss:[zoomLine].R_left sar ax, cl mov ss:[zoomIncrement].R_left, ax sub bx, ss:[zoomLine].R_top sar bx, cl mov ss:[zoomIncrement].R_top, bx sub si, ss:[zoomLine].R_right sar si, cl mov ss:[zoomIncrement].R_right, si sub dx, ss:[zoomLine].R_bottom sar dx, cl mov ss:[zoomIncrement].R_bottom, dx lineLoop: call ImGetMousePos ; get mouse position push bp ; save stack frame pointer push cx ; pass mouse x-position push dx ; pass mouse y-position mov ax, ss:[zoomLine].R_left ; get bounds for zoom-lines mov bx, ss:[zoomLine].R_top ; mov cx, ss:[zoomLine].R_right ; mov dx, ss:[zoomLine].R_bottom ; mov si, cx ; draw zoom-lines only if sub si, ax ; it's wider than cmp si, 2 * (RESIZE_WIDTH+1) ; 2 * (RESIZE_WIDTH+1) jl pop4 ; otherwise, next zoom-line mov si, dx ; draw zoom-lines only if sub si, bx ; it's wider than cmp si, 2 * (RESIZE_WIDTH+1) ; 2 * (RESIZE_WIDTH+1) jl pop4 ; otherwise, next zoom-line mov si, handle PrimaryResizeRegion ; push location of region push si ; definition of zoom-lines if _ROUND_THICK_DIALOGS ; push ss:[zoomRegionOffset] ; bp should still be valid here. else ;_ROUND_THICK_DIALOGS is FALSE ; mov si, offset PrimaryResizeRegion ; push si ; endif ;_ROUND_THICK_DIALOGS ; mov si, mask XF_RESIZE_PENDING ; lines should not follow mouse mov bp, 0ffffh ; no end match action call ImStartMoveResize ; draw new zoom-lines nextLine: pop bp ; restore stack frame pointer add ax, ss:[zoomIncrement].R_left ; mov ss:[zoomLine].R_left, ax ; add bx, ss:[zoomIncrement].R_top ; mov ss:[zoomLine].R_top, bx ; calculate bounds for next add cx, ss:[zoomIncrement].R_right ; set of zoom-lines mov ss:[zoomLine].R_right, cx ; add dx, ss:[zoomIncrement].R_bottom ; mov ss:[zoomLine].R_bottom, dx ; call ImStopMoveResize ; erase previous zoom-lines dec ss:[lineCount] ; decrement line count jnz lineLoop done: .leave ret pop4: ; ; Since we skipped this iteration of ImStartMoveResize, we must make ; sure to pop the 2 words that we have already pushed onto the stack. ; add sp, 4 jmp short nextLine DrawZoomLines endp if _ZOOM_ALL_PRIMARYS COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ZoomLinesStuffPositionHint %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: If we are zooming all primarys (as opposed to just those with the HINT_PRIMARY_OPEN_ICON_BOUNDS hint) then when we don't encounter this hint we stuff it with the mouse position CALLED BY: DrawZoomLines PASS: *ds:si = GenPrimary ds:bx = HINT_PRIMARY_OPEN_ICON_BOUNDS data di = GState RETURN: ds:bx = set to mouse position DESTROYED: ax, cx, dx SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- dlitwin 3/ 4/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ZoomLinesStuffPositionHint proc near .enter mov ax, HINT_PRIMARY_OPEN_ICON_BOUNDS mov cx, size Rectangle call ObjVarAddData call ImGetMousePos mov ds:[bx].R_left, cx mov ds:[bx].R_right, cx mov ds:[bx].R_top, dx mov ds:[bx].R_bottom, dx .leave ret ZoomLinesStuffPositionHint endp endif ;_ZOOM_ALL_PRIMARYS endif ; if _ZOOM_LINES WinClasses ends ;------------------------------- WinMethods segment resource COMMENT @---------------------------------------------------------------------- METHOD: OLBaseWinGetMenuBarWin -- MSG_GET_MENU_BAR_WIN for OLBaseWinClass DESCRIPTION: Return the handle of the associated MenuBarWin if one exists PASS: *ds:si - instance data es - segment of OLBaseWinClass ax - MSG_GET_MENU_BAR_WIN cx:dx - 0 RETURN: cx:dx - optr of MenuBarWin DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 3/89 Initial version ------------------------------------------------------------------------------@ OLBaseWinGetMenuBarWin method dynamic OLBaseWinClass, MSG_GET_MENU_BAR_WIN mov dx, ds:[di].OLMDWI_menuBar clr cx ;assume no menu bar tst dx jz exit mov cx, ds:[LMBH_handle] exit: ret OLBaseWinGetMenuBarWin endp WinMethods ends ;------------------------------- WinClasses segment resource COMMENT @---------------------------------------------------------------------- METHOD: OLBaseWinGupQuery -- MSG_SPEC_GUP_QUERY for OLBaseWinClass DESCRIPTION: Respond to a query traveling up the generic composite tree PASS: *ds:si - instance data es - segment of OLDisplayWinClass ax - MSG_SPEC_GUP_QUERY cx - Query type (GenQueryType or SpecGenQueryType) dx - bp - RETURN: carry - set if query acknowledged, clear if not cx:dx - handle of GenPrimary DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: THIS IS OLD if (query = SGQT_FIND_PRIMARY) { ;look for GenPrimary - return our handle } else { send query to superclass (will send to generic parent) } KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 10/89 Initial version ------------------------------------------------------------------------------@ OLBaseWinGupQuery method dynamic OLBaseWinClass, MSG_SPEC_GUP_QUERY cmp cx, SGQT_IS_CHILD_OF_PRIMARY ;can we answer this query? je isChildOfPrimary ;skip if so... ;we can't answer this query: call super class to handle mov di, offset OLBaseWinClass GOTO ObjCallSuperNoLock isChildOfPrimary: mov cx, TRUE queryAnswered: stc ret OLBaseWinGupQuery endp COMMENT @---------------------------------------------------------------------- METHOD: OLBaseWinUseLongTermMoniker -- MSG_GEN_PRIMARY_USE_LONG_TERM_MONIKER for OLBaseWinClass DESCRIPTION: Switch to specific long term moniker. PASS: *ds:si - instance data es - segment of OLBaseWinClass ax - MSG_GEN_PRIMARY_USE_LONG_TERM_MONIKER cx - long term moniker chunk to use RETURN: nothing ax, cx, dx, bp - destroyed ALLOWED TO DESTROY: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 3/19/92 Initial version ------------------------------------------------------------------------------@ OLBaseWinUseLongTermMoniker method dynamic OLBaseWinClass, \ MSG_GEN_PRIMARY_USE_LONG_TERM_MONIKER call WinClasses_DerefGen_DI cmp cx, ds:[di].GPI_longTermMoniker ;same chunk? je done ;skip if so... mov ds:[di].GPI_longTermMoniker, cx ; ; resolve moniker list, if necessary ; cx = moniker chunk ; mov ax, MSG_SPEC_RESOLVE_MONIKER_LIST call ObjCallInstanceNoLock ; resolve in-place mov cl, mask OLWHS_TITLE_IMAGE_INVALID ;should we set title area also invalid ;in case moniker is getting smaller? call OpenWinHeaderMarkInvalid done: ret OLBaseWinUseLongTermMoniker endm WinClasses ends WinUncommon segment resource if _GCM ;---------------------------------------------------------------------- WinUncommon_DerefVisSpec_DI proc near class VisClass EC < call ECCheckLMemObject > mov di, ds:[si] add di, ds:[di].Vis_offset ret WinUncommon_DerefVisSpec_DI endp WinUncommon_ObjMessageCallFixupDS proc near mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage ret WinUncommon_ObjMessageCallFixupDS endp endif ; _GCM ---------------------------------------------------------------- COMMENT @---------------------------------------------------------------------- FUNCTION: OLBaseWinDrawGCMIcon DESCRIPTION: Draw the Exit or Help buttons in the header of this window. PASS: *ds:si = instance data for object di = GState to use RETURN: nothing DESTROYED: ? PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 3/90 initial version ------------------------------------------------------------------------------@ if _GCM OLBaseWinDrawGCMIcon proc far push si, di ;save GState mov bp, di ;bp = GState call WinUncommon_DerefVisSpec_DI add di, ax ;ds:[di] = OD of button tst ds:[di].handle jz DrawIconCommon_done mov bx, ds:[LMBH_handle] mov si, ds:[di].chunk ;pass bp = GState, cl = DrawFlags mov ax, MSG_OL_BUTTON_SET_DRAW_STATE_UNKNOWN ;force button to do a full redraw. call WinUncommon_ObjMessageCallFixupDS mov ax, MSG_VIS_DRAW call WinUncommon_ObjMessageCallFixupDS ;Since we are handling draw directly, reset the image invalid flags > mov cx, (mask VOF_IMAGE_INVALID or mask VOF_IMAGE_UPDATE_PATH) shl 8 stc ;^lbx:si is object call OpenWinSetObjVisOptFlags ;reset these flags DrawIconCommon_done label near pop si, di ret OLBaseWinDrawGCMIcon endp endif WinUncommon ends WinClasses segment resource COMMENT @---------------------------------------------------------------------- FUNCTION: OLBaseWinUpdateExpressToolArea DESCRIPTION: This procedure positions the "express tool area", if this app current "has it" floating above it. Does NOT mess with the title bar bounds, just references them to figure out where the area should be moved. CALLED BY: INTERNAL OpenWinMoveResizeWin PASS: ds:*si - instance data RETURN: nothing DESTROYED: ? PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 6/92 Inital Version ------------------------------------------------------------------------------@ if PLACE_EXPRESS_MENU_ON_PRIMARY or TOOL_AREA_IS_TASK_BAR OLBaseWinUpdateExpressToolArea method static OLBaseWinClass, MSG_OL_BASE_WIN_UPDATE_EXPRESS_TOOL_AREA uses bx, di, es ; To comply w/static call requirements .enter ; that bx, si, di, & es are preserved. call WinClasses_DerefVisSpec_DI test ds:[di].OLBWI_flags, mask OLBWF_HAS_EXPRESS_TOOL_AREA LONG jz done ; Move tool area w/Express menu to the corner of our title area ; mov ax, ds:[di].OLWI_titleBarBounds.R_left mov bx, ds:[di].OLWI_titleBarBounds.R_top call OLBaseWinGetExpressMenuButtonWidth ; bp = width of area sub ax, bp ; pass left edge for ; tool area inc bx ; One down from there, actually, seems to be ; where the title actually starts, for some ; reason... ; If -1 spacing is being used (best test I know of is for B&W display), ; then pull tool area up & to the left one pixel, to overlap with the ; one-pixel line at the edge of the title area ; call OpenCheckIfBW jnc gotIt dec ax dec bx if EVENT_MENU dec dx endif gotIt: call VisQueryWindow tst di LONG jz done if EVENT_MENU push ax, bx mov ax, dx call WinTransform ; transform event menu position mov dx, ax pop ax, bx push dx ; save event menu position endif call WinTransform mov cx, ax mov dx, bx mov bx, ds:[LMBH_handle] call MemOwner ; bx = geode push si sub sp, size OLFieldMoveToolAreaParams mov bp, sp mov ss:[bp].OLFMTAP_geode, bx mov ss:[bp].OLFMTAP_xPos, cx mov ss:[bp].OLFMTAP_yPos, dx mov si, WIT_PRIORITY call WinGetInfo ; al = WinPriorityData andnf al, mask WPD_LAYER ; al = layer priority mov cl, offset WPD_LAYER shr al, cl ; convert to absolute value mov ss:[bp].OLFMTAP_layerPriority, al mov si, WIT_LAYER_ID call WinGetInfo ; ax = layer ID mov ss:[bp].OLFMTAP_layerID, ax if EVENT_MENU ; get event menu pos from stack mov ax, ss:[bp][(size OLFieldMoveToolAreaParams)+2] mov ss:[bp].OLFMTAP_eventPos, ax endif mov bx, segment OLFieldClass mov si, offset OLFieldClass mov dx, size OLFieldMoveToolAreaParams mov ax, MSG_OL_FIELD_MOVE_TOOL_AREA mov di, mask MF_RECORD or mask MF_STACK call ObjMessage add sp, size OLFieldMoveToolAreaParams pop si if EVENT_MENU pop cx ; throw away event menu position endif mov cx, di mov ax, MSG_GEN_GUP_CALL_OBJECT_OF_CLASS call GenCallParent if (not TOOL_AREA_IS_TASK_BAR) call WinClasses_DerefVisSpec_DI mov cx, ds:[di].OLWI_titleBarBounds.R_bottom sub cx, ds:[di].OLWI_titleBarBounds.R_top ;Fairly bad hacks to match menu bar height. -cbh 6/29/92 ;Must match similar code in EnableDisableAndPosSysIcon. call OpenWinCheckIfSquished ; running CGA? jc 5$ ; yes, skip this call OpenWinCheckMenusInHeader ; are we in the header? jnc 5$ ; nope, done add cx, 3 ; else expand to match menu bar 5$: MO < push ds > MO < mov ax, segment dgroup > MO < mov ds, ax > MO < test ds:[moCS_flags], mask CSF_BW ; Is this a B&W display?> MO < pop ds > MO < jnz 20$ ; skip if so... > MO < sub cx, 2 ; Nest icon inside resize > MO <20$: ; display > ISU < push ds > ISU < mov ax, segment dgroup > ISU < mov ds, ax > ISU < test ds:[moCS_flags], mask CSF_BW ; Is this a B&W display?> ISU < pop ds > ISU < jnz 20$ ; skip if so... > ISU < dec cx ; Nest icon inside resize > ISU <20$: ; display > push si mov bx, segment OLFieldClass mov si, offset OLFieldClass mov ax, MSG_OL_FIELD_SIZE_TOOL_AREA mov di, mask MF_RECORD call ObjMessage pop si mov cx, di mov ax, MSG_GEN_GUP_CALL_OBJECT_OF_CLASS call GenCallParent endif ; (not TOOL_AREA_IS_TASK_BAR) done: .leave ret OLBaseWinUpdateExpressToolArea endm endif ; PLACE_EXPRESS_MENU_ON_PRIMARY or TOOL_AREA_IS_TASK_BAR COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLBaseWinUpdateToolAreas %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: update title bar and tool areas CALLED BY: MSG_OL_BASE_WIN_UPDATE_TOOL_AREAS PASS: *ds:si = OLBaseWinClass object ds:di = OLBaseWinClass instance data ds:bx = OLBaseWinClass object (same as *ds:si) es = segment of OLBaseWinClass ax = message # RETURN: nothing DESTROYED: SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 10/23/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if EVENT_MENU OLBaseWinUpdateToolAreas method dynamic OLBaseWinClass, MSG_OL_BASE_WIN_UPDATE_TOOL_AREAS mov cl, mask VOF_IMAGE_INVALID mov dl, VUM_DELAYED_VIA_UI_QUEUE call VisMarkInvalid call OpenWinCalcWinHdrGeometry call OLBaseWinUpdateExpressToolArea ret OLBaseWinUpdateToolAreas endm endif WinClasses ends ;--------------------------- WinUncommon segment resource if _GCM COMMENT @---------------------------------------------------------------------- FUNCTION: OLBaseWinEnableAndPositionHeaderIcon DESCRIPTION: This procedure is used to position and enable the icons which appear in the header area of a window: - GCM "Exit" and "Help" icons - Workspace and Application menu buttons CALLED BY: OLBaseWinPositionGCMHeaderIcons PASS: *ds:si = instance data for object ^lbx:si = OLMenuButton object (bx = 0 if none) cx, dx = position for icon ax = height of title bar bp = width of icon RETURN: nothing DESTROYED: ? PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 3/90 initial version ------------------------------------------------------------------------------@ OLBaseWinEnableAndPositionHeaderIcon proc near tst bx ;check handle jz done ;skip if no icon... ;set size of icon push cx, dx mov cx, bp ;(cx, dx) = size of icon mov dx, ax mov ax, MSG_VIS_SET_SIZE call WinUncommon_ObjMessageCallFixupDS pop cx, dx ;set position of icon mov ax, MSG_VIS_POSITION_BRANCH call WinUncommon_ObjMessageCallFixupDS ;since we have handled geometry, clear invalid flags now mov cx, (mask VOF_GEOMETRY_INVALID or \ mask VOF_GEO_UPDATE_PATH) shl 8 stc ;^lbx:si is object call OpenWinSetObjVisOptFlags ;reset these flags done: ret OLBaseWinEnableAndPositionHeaderIcon endp endif ; _GCM COMMENT @---------------------------------------------------------------------- FUNCTION: OLBaseWinPositionGCMHeaderIcons DESCRIPTION: This procedure positions and enables the "Exit" and "Help" icons in the header when running in GC mode. CALLED BY: OpenWinCalcWinHdrGeometry (cwinClassCommon.asm) ONLY PASS: ds:*si - instance data RETURN: nothing DESTROYED: ? PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 1/90 Initial version ------------------------------------------------------------------------------@ if _GCM OLBaseWinPositionGCMHeaderIcons proc far class OLBaseWinClass ;are we in General Consumer Mode? EC < call WinUncommon_DerefVisSpec_DI > EC < test ds:[di].OLWI_fixedAttr, mask OWFA_GCM_TITLED > EC < ERROR_Z OL_ERROR ;must have OWFA_GCM_TITLED > ;ERROR CHECK: test for OLBaseWinClass ;See if there is an icon on the left. test ds:[di].OLBWI_gcmFlags, mask GCMF_LEFT_ICON jz checkForRight ;skip if not... ;move title bar in according to width of left side icon mov cx, ds:[di].OLWI_titleBarBounds.R_left mov dx, ds:[di].OLWI_titleBarBounds.R_top OLS < add cx, 2 ;move icon over 2 pixels > OLS < add dx, 2 ;move icon down 2 pixels > CUAS < inc dx ;move icon down 1 pixel > OLS < mov ax, OLS_GCM_HEADER_HEIGHT > CUAS < mov ax, CUAS_GCM_HEADER_HEIGHT > call OpenWinCheckIfSquished jnc 10$ CUAS < mov ax, CUAS_GCM_CGA_HEADER_HEIGHT > 10$: OLS < add ds:[di].OLWI_titleBarBounds.R_left, OLS_GCM_HEADER_ICON_WIDTH+4> CUAS < add ds:[di].OLWI_titleBarBounds.R_left, CUAS_GCM_HEADER_ICON_WIDTH > ;reduce the size of the title area push si mov bx, ds:[LMBH_handle] mov si, ds:[di].OLBWI_gcmLeftIcon push ax OLS < mov bp, OLS_GCM_HEADER_ICON_WIDTH > MO < mov bp, CUAS_GCM_HEADER_ICON_WIDTH-1 > ISU < mov bp, CUAS_GCM_HEADER_ICON_WIDTH-1 > NOT_MO <mov bp, CUAS_GCM_HEADER_ICON_WIDTH > call OLBaseWinEnableAndPositionHeaderIcon pop ax pop si checkForRight: ;"Help" icon: call WinUncommon_DerefVisSpec_DI test ds:[di].OLBWI_gcmFlags, mask GCMF_RIGHT_ICON jz done ;skip if not... ;move title bar in according to width of right side icon OLS < sub ds:[di].OLWI_titleBarBounds.R_right,OLS_GCM_HEADER_ICON_WIDTH+4> CUAS < sub ds:[di].OLWI_titleBarBounds.R_right, CUAS_GCM_HEADER_ICON_WIDTH> mov cx, ds:[di].OLWI_titleBarBounds.R_right mov dx, ds:[di].OLWI_titleBarBounds.R_top OLS < add cx, 3 ;adjust for subtract, add 2 > OLS < add dx, 2 ;move icon down 2 pixels > CUAS < inc cx ;adjust for subtract > CUAS < inc dx ;move icon down 1 pixel > push si mov bx, ds:[LMBH_handle] mov si, ds:[di].OLBWI_gcmRightIcon OLS < mov bp, OLS_GCM_HEADER_ICON_WIDTH > MO < mov bp, CUAS_GCM_HEADER_ICON_WIDTH-1 > ISU < mov bp, CUAS_GCM_HEADER_ICON_WIDTH-1 > NOT_MO <mov bp, CUAS_GCM_HEADER_ICON_WIDTH > call OLBaseWinEnableAndPositionHeaderIcon pop si done: ret OLBaseWinPositionGCMHeaderIcons endp endif ; if _GCM ------------------------------------------------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLBaseWinUpdateForTitleGroup %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: update express menu button, if any CALLED BY: MSG_OL_WIN_UPDATE_FOR_TITLE_GROUP PASS: *ds:si = OLBaseWinClass object ds:di = OLBaseWinClass instance data ds:bx = OLBaseWinClass object (same as *ds:si) es = segment of OLBaseWinClass ax = message # RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 12/21/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ OLBaseWinUpdateForTitleGroup method dynamic OLBaseWinClass, MSG_OL_WIN_UPDATE_FOR_TITLE_GROUP .enter ; ; normal update first ; mov di, offset OLBaseWinClass call ObjCallSuperNoLock ; ; update express menu button ; mov ax, MSG_OL_BASE_WIN_UPDATE_EXPRESS_TOOL_AREA mov bx, ds:[LMBH_handle] mov di, mask MF_FORCE_QUEUE call ObjMessage .leave ret OLBaseWinUpdateForTitleGroup endm WinUncommon ends ;------------------- WinClasses segment resource COMMENT @---------------------------------------------------------------------- METHOD: OLBaseWinGetHeaderTitleBounds -- MSG_OL_WIN_GET_HEADER_TITLE_BOUNDS for OLBaseWinClass DESCRIPTION: Returns widths of icons left and right of title bar. PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_OL_WIN_GET_HEADER_TITLE_BOUNDS RETURN: ax - width of icons left of title bp - width of icons right of title cx, dx - preserved ALLOWED TO DESTROY: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chris 2/ 7/92 Initial Version ------------------------------------------------------------------------------@ OLBaseWinGetHeaderTitleBounds method dynamic OLBaseWinClass, \ MSG_OL_WIN_GET_HEADER_TITLE_BOUNDS if _GCM ;---------------------------------------------------------------------- mov ax, CUAS_GCM_HEADER_ICON_WIDTH ;assume GCM mov bp, CUAS_GCM_HEADER_ICON_WIDTH test ds:[di].OLWI_fixedAttr, mask OWFA_GCM_TITLED ;GCM? jnz done ;yes, have widths ;call superclass to get ; system menu icon width endif ; if _GCM ------------------------------------------------------------- mov ax, MSG_OL_WIN_GET_HEADER_TITLE_BOUNDS call WinClasses_ObjCallSuperNoLock_OLBaseWinClass ;ax, bp = widths call WinClasses_DerefVisSpec_DI ; ds:di = instance data test ds:[di].OLBWI_flags, mask OLBWF_HAS_EXPRESS_TOOL_AREA jz done ; nope push bp ;save right side width call OLBaseWinGetExpressMenuButtonWidth ; bp = width dec bp ;overlap express menu button ; with other left side ; icons, but not with ; title bar add ax, bp ;compute left side width if EVENT_MENU call OLBaseWinGetEventMenuButtonWidth dec bp add ax, bp endif pop bp ;restore right side width done: ret OLBaseWinGetHeaderTitleBounds endm COMMENT @---------------------------------------------------------------------- FUNCTION: OLBaseWinGetExpressMenuButtonWidth DESCRIPTION: Returns width of window's system menu button. CALLED BY: INTERNAL PASS: *ds:si - instance data ds:di - instance data RETURN: bp = width of button DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 2/7/92 initial version doug 6/92 new for new Express menu ------------------------------------------------------------------------------@ OLBaseWinGetExpressMenuButtonWidth proc near uses ax, bx, cx, dx .enter push si mov bx, segment OLFieldClass mov si, offset OLFieldClass mov ax, MSG_OL_FIELD_GET_TOOL_AREA_SIZE mov di, mask MF_RECORD call ObjMessage pop si mov cx, di mov ax, MSG_GEN_GUP_CALL_OBJECT_OF_CLASS call GenCallParent mov bp, cx ; ; mystery adjustment for B/W - brianc 2/5/93 ; call OpenCheckIfBW jnc done ; not B/W, no adjustment dec bp done: .leave ret OLBaseWinGetExpressMenuButtonWidth endp if EVENT_MENU OLBaseWinGetEventMenuButtonWidth proc near uses ax, bx, cx, dx, di .enter push si mov bx, segment OLFieldClass mov si, offset OLFieldClass mov ax, MSG_OL_FIELD_GET_TOOL_AREA_SIZE mov di, mask MF_RECORD call ObjMessage pop si mov cx, di mov ax, MSG_GEN_GUP_CALL_OBJECT_OF_CLASS call GenCallParent ; bp = width of event menu area ; ; mystery adjustment for B/W - brianc 2/5/93 ; call OpenCheckIfBW jnc done ; not B/W, no adjustment dec bp done: .leave ret OLBaseWinGetEventMenuButtonWidth endp endif if TOOL_AREA_IS_TASK_BAR OLWinGetToolAreaSize proc far uses ax, bx, di, bp .enter ; ; doesn't work from UI thread, so return 0 as size mov bx, 0 mov dx, bx mov cx, bx call GeodeGetProcessHandle cmp bx, handle ui je done push si mov bx, segment OLFieldClass mov si, offset OLFieldClass mov ax, MSG_OL_FIELD_GET_TOOL_AREA_SIZE mov di, mask MF_RECORD call ObjMessage pop si mov ax, MSG_GEN_GUP_CALL_OBJECT_OF_CLASS mov cx, di call UserCallApplication ; cx,dx = tool area size done: .leave ret OLWinGetToolAreaSize endp endif ; TOOL_AREA_IS_TASK_BAR WinClasses ends KbdNavigation segment resource COMMENT @---------------------------------------------------------------------- FUNCTION: OLBaseWinFupKbdChar - MSG_META_FUP_KBD_CHAR handler DESCRIPTION: This method is sent by child which 1) is the focused object and 2) has received a MSG_META_KBD_CHAR or MSG_META_FUP_KBD_CHAR which is does not care about. Since we also don't care about the character, we forward this method up to the parent in the focus hierarchy. At this class level, the parent in the focus hierarchy is is the generic parent. PASS: *ds:si = instance data for object ds:di = specific instance data for object cx = character value dl = CharFlags dh = ShiftState (ModBits) bp low = ToggleState bp high = scan code RETURN: carry set if handled DESTROYED: ? PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 2/92 Initial version (adapted from similar handlers) ------------------------------------------------------------------------------@ OLBaseWinFupKbdChar method dynamic OLBaseWinClass, \ MSG_META_FUP_KBD_CHAR, MSG_META_KBD_CHAR ;Don't handle state keys (shift, ctrl, etc). test dl, mask CF_STATE_KEY or mask CF_TEMP_ACCENT jnz callSuper ;ignore character... test dl, mask CF_FIRST_PRESS or mask CF_REPEAT_PRESS jz callSuper ;skip if not press event... if (0) ; this should be done by system/field object... ; ; Check for Ctrl-Esc - express menu ; test dh, mask SS_LCTRL or mask SS_RCTRL jz callSuper cmp cx, (CS_CONTROL shl 8) or VC_ESCAPE jne callSuper mov bx, ds:[di].OLBWI_expressMenuButton.handle mov si, ds:[di].OLBWI_expressMenuButton.chunk mov ax, MSG_GEN_ACTIVATE mov di, mask MF_FIXUP_DS call ObjMessage stc ;say handled ret endif if _USE_KBD_ACCELERATORS ; ; Check for Ctrl-F1 - temporary measure to restore menu bar ; test dh, mask SS_LCTRL or mask SS_RCTRL jz callSuper SBCS < cmp cx, (CS_CONTROL shl 8) or VC_F1 > DBCS < cmp cx, C_SYS_F1 > jne callSuper tst ds:[di].OLMDWI_menuBar jz callSuper ;no menu bar, let it go up? mov ax, MSG_OL_BASE_WIN_TOGGLE_MENU_BAR callSelfRetHandled: call ObjCallInstanceNoLock stc ;say handled ret endif callSuper: mov di, offset OLBaseWinClass call ObjCallSuperNoLock ret OLBaseWinFupKbdChar endm KbdNavigation ends ActionObscure segment resource COMMENT @---------------------------------------------------------------------- METHOD: OLBaseWinSpecSetUsable DESCRIPTION: Handle set-usable by maximizing OLBaseWin if HINT_DISPLAY_MAXIMIZED_ON_STARTUP is set. PASS: *ds:si - instance data es - segment of OLBaseWinClass ax - MSG_SPEC_SET_USABLE dl - VisUpdateMode RETURN: carry - ? ax, cx, dx, bp - ? DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 3/13/92 Initial version ------------------------------------------------------------------------------@ if 0 ; "on-startup" no longer includes setting usable ; - brianc 7/9/92 OLBaseWinSpecSetUsable method dynamic OLBaseWinClass, MSG_SPEC_SET_USABLE ; ; Check if we should be maximized on startup (additional ; interpretation of this is to maximize on usable). If so, set ; ATTR_GEN_DISPLAY_MAXIMIZED_STATE. OLMenuedWinSpecBuild will ; take care of the rest. ; push ax, cx, dx, bp mov ax, HINT_DISPLAY_MAXIMIZED_ON_STARTUP call ObjVarFindData ; carry set if found jnc notMaximized ; ; if maximized on startup, set ATTR_GEN_DISPLAY_MAXIMIZED_STATE ; mov ax, ATTR_GEN_DISPLAY_MAXIMIZED_STATE or mask VDF_SAVE_TO_STATE clr cx call ObjVarAddData notMaximized: pop ax, cx, dx, bp ; ; then, let superclass handle ; mov di, offset OLBaseWinClass call ObjCallSuperNoLock ret OLBaseWinSpecSetUsable endm endif OLBaseWinSpecSetUsable method dynamic OLBaseWinClass, MSG_SPEC_SET_USABLE call RemoveTitleBarIfPossible mov ax, MSG_SPEC_SET_USABLE mov di, offset OLBaseWinClass GOTO ObjCallSuperNoLock OLBaseWinSpecSetUsable endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLBaseWinToggleMenuBar %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: toggle menu bar, if togglable CALLED BY: MSG_OL_BASE_WIN_TOGGLE_MENU_BAR PASS: *ds:si = OLBaseWin object ds:di = OLBaseWin instance data es = segment of OLBaseWinClass ax = MSG_OL_BASE_WIN_TOGGLE_MENU_BAR RETURN: nothing ALLOWED TO DESTROY: ax, cx, dx, bp bx, si, di, ds, es SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 11/25/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ OLBaseWinToggleMenuBar method dynamic OLBaseWinClass, MSG_OL_BASE_WIN_TOGGLE_MENU_BAR mov si, ds:[di].OLMDWI_menuBar tst si jz done ; no menu bar mov di, segment OLPopoutClass ; make sure it is a popout mov es, di mov di, offset OLPopoutClass call ObjIsObjectInClass jnc done ; not a popout mov ax, MSG_OL_POPOUT_TOGGLE_POPOUT call ObjCallInstanceNoLock done: ret OLBaseWinToggleMenuBar endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLBaseWinMetaNotify %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle changes of Secret Mode CALLED BY: MSG_META_NOTIFY PASS: *ds:si = OLBaseWinClass object ds:di = OLBaseWinClass instance data ds:bx = OLBaseWinClass object (same as *ds:si) es = segment of OLBaseWinClass ax = message # cx:dx = NotificationType cx - NT_manuf dx - NT_type bp = change specific data RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- grisco 10/17/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if _DUI OLBaseWinMetaNotify method dynamic OLBaseWinClass, MSG_META_NOTIFY uses ax, cx, dx, bp .enter cmp cx, MANUFACTURER_ID_NEC LONG jne callSuper cmp dx, NECNT_SECRET_MODE_CHANGE LONG jne callSuper ; ; The "Secret Mode" status has changed (either on / off). ; Redraw the primary so the indicator will redraw in the ; titlebar. ; mov cl, mask OLWHS_TITLE_AREA_INVALID call OpenWinHeaderMarkInvalid callSuper: mov di, offset OLBaseWinClass call ObjCallSuperNoLock done: .leave ret OLBaseWinMetaNotify endm endif ActionObscure ends
oeis/024/A024063.asm
neoneye/loda-programs
11
164847
; A024063: 6^n-n. ; 1,5,34,213,1292,7771,46650,279929,1679608,10077687,60466166,362797045,2176782324,13060694003,78364164082,470184984561,2821109907440,16926659444719,101559956668398,609359740010477,3656158440062956,21936950640377835,131621703842267114,789730223053602793,4738381338321616872,28430288029929701351,170581728179578208230,1023490369077469249509,6140942214464815497188,36845653286788892983267,221073919720733357899746,1326443518324400147398625,7958661109946400884391904,47751966659678405306351583 mov $1,6 pow $1,$0 sub $1,$0 mov $0,$1
oeis/026/A026356.asm
neoneye/loda-programs
11
5829
; A026356: a(n) = floor((n-1)*phi) + n + 1, n > 0, where phi = (1+sqrt(5))/2. ; Submitted by <NAME>(s3) ; 2,4,7,9,12,15,17,20,22,25,28,30,33,36,38,41,43,46,49,51,54,56,59,62,64,67,70,72,75,77,80,83,85,88,91,93,96,98,101,104,106,109,111,114,117,119,122,125,127,130,132,135,138,140,143,145,148,151,153,156,159,161,164,166,169,172,174,177,180,182,185,187,190,193,195,198,200,203,206,208,211,214,216,219,221,224,227,229,232,235,237,240,242,245,248,250,253,255,258,261 mov $1,$0 trn $0,1 seq $0,19446 ; a(n) = ceiling(n/tau), where tau = (1+sqrt(5))/2. mul $1,2 add $1,$0 mov $0,$1 add $0,1
programs/oeis/016/A016957.asm
neoneye/loda
22
95690
<reponame>neoneye/loda ; A016957: a(n) = 6*n + 4. ; 4,10,16,22,28,34,40,46,52,58,64,70,76,82,88,94,100,106,112,118,124,130,136,142,148,154,160,166,172,178,184,190,196,202,208,214,220,226,232,238,244,250,256,262,268,274,280,286,292,298,304,310,316,322,328 mul $0,6 add $0,4
grammars/src/main/antlr/Adl.g4
subigre/archie
44
5760
// // description: Antlr4 grammar for Archetype Definition Language (ADL2) // author: <NAME> <<EMAIL>> // support: openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues> // copyright: Copyright (c) 2015 openEHR Foundation // license: Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0.html> // grammar Adl; import cadl, odin; // // ============== Parser rules ============== // adl: ( archetype | template | templateOverlay | operationalTemplate ) EOF ; archetype: SYM_ARCHETYPE metaData? ARCHETYPE_HRID specializationSection? languageSection descriptionSection definitionSection rulesSection? rmOverlaySection? terminologySection annotationsSection? ; template: SYM_TEMPLATE metaData? ARCHETYPE_HRID specializationSection languageSection descriptionSection definitionSection rulesSection? rmOverlaySection? terminologySection annotationsSection? (templateOverlay)* ; templateOverlay: SYM_TEMPLATE_OVERLAY //this token includes the horizontal comment line ARCHETYPE_HRID specializationSection definitionSection rmOverlaySection? terminologySection ; operationalTemplate: SYM_OPERATIONAL_TEMPLATE metaData? ARCHETYPE_HRID specializationSection? languageSection descriptionSection definitionSection rulesSection? rmOverlaySection? terminologySection annotationsSection? componentTerminologiesSection? ; specializationSection : SYM_SPECIALIZE archetype_ref ; languageSection : SYM_LANGUAGE odin_text ; descriptionSection : SYM_DESCRIPTION odin_text ; definitionSection : SYM_DEFINITION c_complex_object ; rulesSection : SYM_RULES assertion_list; terminologySection : SYM_TERMINOLOGY odin_text ; annotationsSection : SYM_ANNOTATIONS odin_text ; rmOverlaySection : SYM_RM_OVERLAY odin_text ; componentTerminologiesSection: SYM_COMPONENT_TERMINOLOGIES odin_text ; metaData: '(' metaDataItem (';' metaDataItem )* ')' ; metaDataItem: metaDataTagAdlVersion '=' VERSION_ID | metaDataTagUid '=' GUID | metaDataTagBuildUid '=' GUID | metaDataTagRmRelease '=' VERSION_ID | metaDataTagIsControlled | metaDataTagIsGenerated | identifier ( '=' metaDataValue )? ; metaDataValue: primitive_value | GUID | VERSION_ID ; metaDataTagAdlVersion : 'adl_version' ; metaDataTagUid : 'uid' ; metaDataTagBuildUid : 'build_uid' ; metaDataTagRmRelease : 'rm_release' ; metaDataTagIsControlled : 'controlled' ; metaDataTagIsGenerated : 'generated' ;
src/parser/Datalog.g4
iliastsa/woof
6
6413
grammar Datalog; datalogMain : mRule* EOF; term : value=Constant # Const | name=Identifier # Variable ; atom : name=Identifier ('(' terms=termList? ')')? ; termList : term (',' term)* ; mRule : head=atom (':-' body=literals)? '.' ; literal : atom # LiteralAtom | '!' atom # LiteralNegAtom ; literals : literal (',' literal)* ; Identifier : ID_START ID_REST* ; fragment ID_START : [a-zA-Z_] ; fragment ID_REST : [a-zA-Z0-9_?] ; Constant : '"' DoubleQuotedStringCharacter* '"' | '\'' SingleQuotedStringCharacter* '\'' ; fragment DoubleQuotedStringCharacter : ~["\r\n\\] | ('\\' .) ; fragment SingleQuotedStringCharacter : ~['\r\n\\] | ('\\' .) ; WS : [ \t\r\n]+ -> skip ;
programs/oeis/122/A122770.asm
neoneye/loda
22
16775
<gh_stars>10-100 ; A122770: Numbers k such that A056109(k) is a square. ; 0,6,88,1230,17136,238678,3324360,46302366,644908768,8982420390,125108976696,1742543253358,24270496570320,338044408731126,4708351225665448,65578872750585150,913395867282526656,12721963269204788038,177194089901584505880,2467995295352978294286,34374740045040111614128,478778365335208584303510,6668522374647880068635016,92880534879735112376586718,1293658965941643693203579040,18018344988303276592473519846,250963170870304228601425698808,3495466047195955923827486263470,48685561489873078704983381989776,678102394811027145945939861593398,9444747965864506964538174680317800,131548369127292070357588505662855806 mul $0,2 mov $1,2 mov $2,2 lpb $0 sub $0,1 add $1,$2 add $2,$1 add $1,$2 lpe div $1,6 mov $0,$1
programs/oeis/158/A158135.asm
neoneye/loda
22
240494
; A158135: a(n) = 144*n^2 - 2*n. ; 142,572,1290,2296,3590,5172,7042,9200,11646,14380,17402,20712,24310,28196,32370,36832,41582,46620,51946,57560,63462,69652,76130,82896,89950,97292,104922,112840,121046,129540,138322,147392,156750,166396,176330,186552,197062,207860,218946,230320,241982,253932,266170,278696,291510,304612,318002,331680,345646,359900,374442,389272,404390,419796,435490,451472,467742,484300,501146,518280,535702,553412,571410,589696,608270,627132,646282,665720,685446,705460,725762,746352,767230,788396,809850,831592,853622,875940,898546,921440,944622,968092,991850,1015896,1040230,1064852,1089762,1114960,1140446,1166220,1192282,1218632,1245270,1272196,1299410,1326912,1354702,1382780,1411146,1439800 add $0,1 mul $0,72 bin $0,2 div $0,36 mul $0,2
EffectAnnotations.agda
danelahman/aeff-agda
4
12933
<reponame>danelahman/aeff-agda open import Data.Bool hiding (if_then_else_) open import Data.Empty open import Data.List open import Data.List.Properties open import Data.Maybe open import Data.Product open import Data.Sum open import Data.Unit open import Relation.Binary.PropositionalEquality hiding (Extensionality ; [_]) open import Relation.Nullary open import Relation.Nullary.Negation module EffectAnnotations where open import Axiom.Extensionality.Propositional open import Axiom.UniquenessOfIdentityProofs -- ASSUMING FUNCTION EXTENSIONALITY postulate fun-ext : ∀ {a b} → Extensionality a b ifun-ext : ∀ {a b} → ExtensionalityImplicit a b -- SIGNAL AND INTERRUPT NAMES postulate Σₛ : Set -- SIGNAL AND INTERRUPT NAMES HAVE DECIDABLE EQUALITY postulate decₛ : (op op' : Σₛ) → Dec (op ≡ op') if_≡_then_else_ : {A : Set} → Σₛ → Σₛ → A → A → A if op ≡ op' then x else y with decₛ op op' ... | yes p = x ... | no ¬p = y ite-≡ : {A : Set} {op : Σₛ} {x y : A} → ----------------------------- if op ≡ op then x else y ≡ x ite-≡ {A} {op} with decₛ op op ite-≡ {A} {op} | yes p = refl ite-≡ {A} {op} | no ¬p = ⊥-elim (¬p refl) ite-≢ : {A : Set} {op op' : Σₛ} {x y : A} → op ≢ op' → ------------------------------ if op ≡ op' then x else y ≡ y ite-≢ {A} {op} {op'} p with decₛ op op' ite-≢ {A} {op} {op'} p | yes q = ⊥-elim (p q) ite-≢ {A} {op} {op'} p | no ¬q = refl -- EFFECT ANNOTATIONS FOR OUTGOING SIGNALS (O) AND INTERRUPT HANDLERS (I) mutual data O : Set where omap : (Σₛ → Maybe ⊤) → O data I : Set where imap : (Σₛ → Maybe (O × I)) → I -- EMPTY EFFECT ANNOTATIONS ∅ₒ : O ∅ₒ = omap (λ _ → nothing) ∅ᵢ : I ∅ᵢ = imap (λ _ → nothing) -- UNION OF EFFECT ANNOTATIONS ∪ₒ-aux' : (o o' : Maybe ⊤) → Maybe ⊤ ∪ₒ-aux' nothing o' = o' ∪ₒ-aux' (just tt) o' = just tt ∪ₒ-aux : (o o' : Σₛ → Maybe ⊤) → Σₛ → Maybe ⊤ ∪ₒ-aux o o' op = ∪ₒ-aux' (o op) (o' op) _∪ₒ_ : O → O → O (omap o) ∪ₒ (omap o') = omap (∪ₒ-aux o o') mutual ∪ᵢ-aux : (i i' : Σₛ → Maybe (O × I)) → Σₛ → Maybe (O × I) ∪ᵢ-aux i i' op = ∪ᵢ-aux' (i op) (i' op) ∪ᵢ-aux' : (oi oi' : Maybe (O × I)) → Maybe (O × I) ∪ᵢ-aux' nothing oi' = oi' ∪ᵢ-aux' (just oi'') nothing = just oi'' ∪ᵢ-aux' (just (o'' , (imap i''))) (just (o''' , (imap i'''))) = just (o'' ∪ₒ o''' , imap (∪ᵢ-aux i'' i''')) _∪ᵢ_ : I → I → I (imap i) ∪ᵢ (imap i') = imap (∪ᵢ-aux i i') -- SETTING THE VALUE OF EFFECT ANNOTATION AT A SPECIFIC INTERRUPT NAME _[_↦_]ᵢ : I → Σₛ → Maybe (O × I) → I (imap i) [ op ↦ v ]ᵢ = imap (λ op' → if op ≡ op' then v else i op') -- ACTION OF INTERRUPTS ON EFFECT ANNOTATIONS infix 40 _↓ₑ_ ↓ₑ-auxₒ : Σₛ → Maybe (O × I) → O → O ↓ₑ-auxₒ op nothing o = o ↓ₑ-auxₒ op (just (o' , i')) o = o ∪ₒ o' ↓ₑ-auxᵢ : Σₛ → Maybe (O × I) → I → I ↓ₑ-auxᵢ op nothing i = i ↓ₑ-auxᵢ op (just (o' , i')) i = (i [ op ↦ nothing ]ᵢ) ∪ᵢ i' _↓ₑ_ : Σₛ → O × I → O × I op ↓ₑ (omap o , imap i) = (↓ₑ-auxₒ op (i op) (omap o) , ↓ₑ-auxᵢ op (i op) (imap i)) -- GENERALISED ACTION OF INTERRUPTS ON EFFECT ANNOTATIONS _↓↓ₑ_ : List Σₛ → O × I → O × I [] ↓↓ₑ (o , i) = (o , i) (op ∷ ops) ↓↓ₑ (o , i) = op ↓ₑ (ops ↓↓ₑ (o , i)) ↓↓ₑ-act : {o : O} {i : I} → (ops ops' : List Σₛ) → ------------------------------------------------------ (ops ++ ops') ↓↓ₑ (o , i) ≡ ops ↓↓ₑ (ops' ↓↓ₑ (o , i)) ↓↓ₑ-act [] ops' = refl ↓↓ₑ-act (op ∷ ops) ops' = cong (λ oi → op ↓ₑ oi) (↓↓ₑ-act ops ops') -- CHECKING THE CONTENTS OF EFFECT ANNOTATIONS _∈ₒ_ : Σₛ → O → Set op ∈ₒ (omap o) = o op ≡ just tt lkpᵢ : Σₛ → I → Maybe (O × I) lkpᵢ op (imap i) = i op -- SUBTYPING RELATIONS FOR EFFECT ANNOTATIONS _⊑ₒ_ : O → O → Set o ⊑ₒ o' = (op : Σₛ) → op ∈ₒ o → op ∈ₒ o' data _⊑ᵢ_ (i i' : I) : Set where rel : ((op : Σₛ) → {o : O} → {i'' : I} → lkpᵢ op i ≡ just (o , i'') → Σ[ o' ∈ O ] Σ[ i''' ∈ I ] (lkpᵢ op i' ≡ just (o' , i''') × o ⊑ₒ o' × i'' ⊑ᵢ i''')) → i ⊑ᵢ i' -- SUBTYPING RELATIONS ARE PREORDERS ⊑ₒ-refl : {o : O} → --------- o ⊑ₒ o ⊑ₒ-refl = λ op p → p ⊑ₒ-trans : {o o' o'' : O} → o ⊑ₒ o' → o' ⊑ₒ o'' → ---------------- o ⊑ₒ o'' ⊑ₒ-trans p q = λ op r → q op (p op r) ⊑ᵢ-refl : {i : I} → --------- i ⊑ᵢ i ⊑ᵢ-refl {imap i} = rel (λ op {o'} → λ { {imap i'} → λ p → ⊑ᵢ-refl-aux (i op) p }) where ⊑ᵢ-refl-aux : (oi : Maybe (O × I)) → ---------------------------------------------------------------------------------- {o' : O} {i' : Σₛ → Maybe (O × I)} → oi ≡ just (o' , imap i') → Σ[ o'' ∈ O ] Σ[ i'' ∈ I ] (oi ≡ just (o'' , i'') × (o' ⊑ₒ o'') × (imap i' ⊑ᵢ i'')) ⊑ᵢ-refl-aux (just .(o' , imap i')) {o'} {i'} refl = o' , (imap i' , (refl , (⊑ₒ-refl , ⊑ᵢ-refl {imap i'}))) ⊑ᵢ-trans : {i i' i'' : I} → i ⊑ᵢ i' → i' ⊑ᵢ i'' → ----------------- i ⊑ᵢ i'' ⊑ᵢ-trans {i} {i'} {i''} (rel p) (rel q) = rel (λ op {o} {j} r → ⊑ᵢ-trans-aux o j op (p op r)) where ⊑ᵢ-trans-aux' : (o : O) → (j : I) → (op : Σₛ) → (o' : O) → (j' : I) → lkpᵢ op i' ≡ just (o' , j') → (o ⊑ₒ o') → (j ⊑ᵢ j') → Σ[ o'' ∈ O ] Σ[ j'' ∈ I ] (lkpᵢ op i'' ≡ just (o'' , j'') × (o' ⊑ₒ o'') × (j' ⊑ᵢ j'')) → Σ[ o'' ∈ O ] Σ[ j'' ∈ I ] (lkpᵢ op i'' ≡ just (o'' , j'') × (o ⊑ₒ o'') × (j ⊑ᵢ j'')) ⊑ᵢ-trans-aux' o j op o' j' r' s t (o'' , j'' , r'' , s' , t') = o'' , j'' , r'' , ⊑ₒ-trans s s' , ⊑ᵢ-trans t t' ⊑ᵢ-trans-aux : (o : O) → (j : I) → (op : Σₛ) → Σ[ o' ∈ O ] Σ[ j' ∈ I ] (lkpᵢ op i' ≡ just (o' , j') × (o ⊑ₒ o') × (j ⊑ᵢ j')) → Σ[ o'' ∈ O ] Σ[ j'' ∈ I ] (lkpᵢ op i'' ≡ just (o'' , j'') × (o ⊑ₒ o'') × (j ⊑ᵢ j'')) ⊑ᵢ-trans-aux o j op (o' , j' , r' , s , t) = ⊑ᵢ-trans-aux' o j op o' j' r' s t (q op r') -- SUBTYPING RELATIONS ARE PROOF-IRRELEVANT ≡-uip : {X : Set} {x x' : X} → (p q : x ≡ x') → ---------------- p ≡ q ≡-uip refl refl = refl ⊑ₒ-irrelevant : {o o' : O} (p q : o ⊑ₒ o') → ----------------- p ≡ q ⊑ₒ-irrelevant {omap o} {omap o'} p q = fun-ext (λ op → fun-ext (λ r → ⊑ₒ-irrelevant-aux r)) where ⊑ₒ-irrelevant-aux : {op : Σₛ} → (r : op ∈ₒ (omap o)) → ---------------------- p op r ≡ q op r ⊑ₒ-irrelevant-aux {op} r with p op r | q op r ... | s | t = ≡-uip s t ⊑ᵢ-irrelevant : {i i' : I} (p q : i ⊑ᵢ i') → ----------------- p ≡ q ⊑ᵢ-irrelevant {imap i} {imap i'} (rel p) (rel q) = cong (λ r → rel r) (fun-ext (λ op → ifun-ext (λ {o''} → ifun-ext (λ {i''} → fun-ext (λ r → ⊑ᵢ-irrelevant-aux r))))) where ⊑ᵢ-irrelevant-aux : {op : Σₛ} {o'' : O} {i'' : I} → (r : i op ≡ just (o'' , i'')) → ------------------------------- p op r ≡ q op r ⊑ᵢ-irrelevant-aux {op} r with p op r | q op r ... | o''' , i''' , s , s' , s'' | o'''' , i'''' , t , t' , t'' with trans (sym s) t ... | refl with ⊑ₒ-irrelevant s' t' ... | refl with ⊑ᵢ-irrelevant s'' t'' ... | refl with ≡-uip s t ... | refl = refl -- LEFT UNIT FOR UNIONS OF EFFECT ANNOTATIONS ∪ₒ-lunit : (o : O) → ----------- ∅ₒ ∪ₒ o ≡ o ∪ₒ-lunit (omap o) = cong omap (fun-ext ∪ₒ-lunit-aux) where ∪ₒ-lunit-aux : (op : Σₛ) → ---------------------------------- ∪ₒ-aux (λ _ → nothing) o op ≡ o op ∪ₒ-lunit-aux op with o op ... | nothing = refl ... | just _ = refl ∪ᵢ-lunit : (i : I) → ----------- ∅ᵢ ∪ᵢ i ≡ i ∪ᵢ-lunit (imap i) = cong imap (fun-ext ∪ᵢ-lunit-aux) where ∪ᵢ-lunit-aux : (op : Σₛ) → ---------------------------------- ∪ᵢ-aux (λ _ → nothing) i op ≡ i op ∪ᵢ-lunit-aux op with i op ... | nothing = refl ... | just _ = refl -- LEFT AND RIGHT INCLUSIONS INTO UNIONS OF EFFECT ANNOTATIONS ∪ₒ-inl : {o o' : O} → ------------- o ⊑ₒ (o ∪ₒ o') ∪ₒ-inl {omap o} {omap o'} op with o op | o' op ... | nothing | nothing = λ p → p ... | nothing | just tt = λ _ → refl ... | just tt | nothing = λ p → p ... | just tt | just tt = λ p → p ∪ₒ-inr : {o o' : O} → ------------- o' ⊑ₒ (o ∪ₒ o') ∪ₒ-inr {omap o} {omap o'} op with o op | o' op ... | nothing | nothing = λ p → p ... | nothing | just tt = λ p → p ... | just tt | nothing = λ _ → refl ... | just tt | just tt = λ p → p ∪ᵢ-inl : {i i' : I} → ------------- i ⊑ᵢ (i ∪ᵢ i') ∪ᵢ-inl {imap i} {imap i'} = rel (λ op → ∪ᵢ-inl-aux (i op) (i' op)) where ∪ᵢ-inl-aux : (oi oi' : Maybe (O × I)) → {o : O} {i'' : I} → oi ≡ just (o , i'') → Σ[ o' ∈ O ] Σ[ i''' ∈ I ] (∪ᵢ-aux' oi oi' ≡ just (o' , i''') × (o ⊑ₒ o') × (i'' ⊑ᵢ i''')) ∪ᵢ-inl-aux (just .(o , i'')) nothing {o} {i''} refl = o , i'' , refl , ⊑ₒ-refl , ⊑ᵢ-refl ∪ᵢ-inl-aux (just .(o , imap i'')) (just (o' , imap i''')) {o} {imap i''} refl = o ∪ₒ o' , imap (∪ᵢ-aux i'' i''') , refl , ∪ₒ-inl , ∪ᵢ-inl ∪ᵢ-inr : {i i' : I} → ------------- i' ⊑ᵢ (i ∪ᵢ i') ∪ᵢ-inr {imap i} {imap i'} = rel (λ op → ∪ᵢ-inr-aux (i op) (i' op)) where ∪ᵢ-inr-aux : (oi oi' : Maybe (O × I)) → {o : O} {i'' : I} → oi' ≡ just (o , i'') → Σ[ o' ∈ O ] Σ[ i''' ∈ I ] (∪ᵢ-aux' oi oi' ≡ just (o' , i''') × (o ⊑ₒ o') × (i'' ⊑ᵢ i''')) ∪ᵢ-inr-aux nothing (just .(o , i'')) {o} {i''} refl = o , i'' , refl , ⊑ₒ-refl , ⊑ᵢ-refl ∪ᵢ-inr-aux (just (o' , imap i''')) (just .(o , imap i'')) {o} {imap i''} refl = o' ∪ₒ o , imap (∪ᵢ-aux i''' i'') , refl , ∪ₒ-inr , ∪ᵢ-inr -- COPAIRING FOR UNIONS OF EFFECT ANNOTATIONS ∪ₒ-copair : {o o' o'' : O} → o ⊑ₒ o'' → o' ⊑ₒ o'' → ---------------- (o ∪ₒ o') ⊑ₒ o'' ∪ₒ-copair {omap o} {omap o'} {omap o''} p q op = ∪ₒ-copair-aux (p op) (q op) where ∪ₒ-copair-aux : (p : op ∈ₒ (omap o) → op ∈ₒ (omap o'')) → (q : op ∈ₒ (omap o') → op ∈ₒ (omap o'')) → --------------------------------------------- op ∈ₒ (omap (∪ₒ-aux o o')) → op ∈ₒ (omap o'') ∪ₒ-copair-aux p q with o op | o' op ... | nothing | nothing = q ... | nothing | just tt = q ... | just tt | nothing = p ... | just tt | just tt = p inj-just : {X : Set} {x x' : X} → just x ≡ just x' → x ≡ x' inj-just refl = refl inj-pair₁ : {X Y : Set} {x x' : X} {y y' : Y} → (x , y) ≡ (x' , y') → x ≡ x' inj-pair₁ refl = refl inj-pair₂ : {X Y : Set} {x x' : X} {y y' : Y} → (x , y) ≡ (x' , y') → y ≡ y' inj-pair₂ refl = refl ∪ᵢ-copair : {i i' i'' : I} → i ⊑ᵢ i'' → i' ⊑ᵢ i'' → ---------------- (i ∪ᵢ i') ⊑ᵢ i'' ∪ᵢ-copair {imap i} {imap i'} {imap i''} (rel p) (rel q) = rel (λ op {o'''} {i'''} r → ∪ᵢ-copair-aux op o''' i''' (i op) (i' op) (i'' op) refl refl refl r) where ∪ᵢ-copair-aux : (op : Σₛ) → (o''' : O) → (i''' : I) (oi oi' oi'' : Maybe (O × I)) → (oi ≡ i op) → (oi' ≡ i' op) → (oi'' ≡ i'' op) → (r : ∪ᵢ-aux' oi oi' ≡ just (o''' , i''')) → Σ[ o' ∈ O ] Σ[ i'''' ∈ I ] (oi'' ≡ just (o' , i'''') × (o''' ⊑ₒ o') × (i''' ⊑ᵢ i'''')) ∪ᵢ-copair-aux op o''' i''' nothing (just oi') nothing r s t u with trans t (proj₁ (proj₂ (proj₂ (q op (trans (sym s) u))))) ... | () ∪ᵢ-copair-aux op o''' i''' nothing (just oi') (just oi'') r s t u = proj₁ (q op (trans (sym s) u)) , proj₁ (proj₂ (q op (trans (sym s) u))) , trans t (proj₁ (proj₂ (proj₂ (q op (trans (sym s) u))))) , proj₁ (proj₂ (proj₂ (proj₂ (q op (trans (sym s) u))))) , proj₂ (proj₂ (proj₂ (proj₂ (q op (trans (sym s) u))))) ∪ᵢ-copair-aux op o''' i''' (just oi) nothing oi'' r s t u = proj₁ (p op (trans (sym r) u)) , proj₁ (proj₂ (p op (trans (sym r) u))) , trans t (proj₁ (proj₂ (proj₂ (p op (trans (sym r) u))))) , proj₁ (proj₂ (proj₂ (proj₂ (p op (trans (sym r) u))))) , proj₂ (proj₂ (proj₂ (proj₂ (p op (trans (sym r) u))))) ∪ᵢ-copair-aux op o''' i''' (just (omap o'''' , imap i'''')) (just (omap o''''' , imap i''''')) nothing r s t u with trans t (proj₁ (proj₂ (proj₂ (p op (sym r))))) ... | () ∪ᵢ-copair-aux op o''' i''' (just (omap o'''' , imap i'''')) (just (omap o''''' , imap i''''')) (just (omap o'''''' , imap i'''''')) r s t u = omap o'''''' , imap i'''''' , refl , subst (λ o → o ⊑ₒ omap o'''''') (inj-pair₁ (inj-just u)) (∪ₒ-copair (subst (λ o → omap o'''' ⊑ₒ o) (inj-pair₁ (inj-just (sym (trans t (proj₁ (proj₂ (proj₂ (p op (sym r))))))))) (proj₁ (proj₂ (proj₂ (proj₂ (p op (sym r))))))) (subst (λ o → omap o''''' ⊑ₒ o) (inj-pair₁ (inj-just (sym (trans t (proj₁ (proj₂ (proj₂ (q op (sym s))))))))) (proj₁ (proj₂ (proj₂ (proj₂ (q op (sym s)))))))) , subst (λ i → i ⊑ᵢ imap i'''''') (inj-pair₂ (inj-just u)) (∪ᵢ-copair (subst (λ i → imap i'''' ⊑ᵢ i) (inj-pair₂ (inj-just (sym (trans t (proj₁ (proj₂ (proj₂ (p op (sym r))))))))) (proj₂ (proj₂ (proj₂ (proj₂ (p op (sym r))))))) (subst (λ i → imap i''''' ⊑ᵢ i) (inj-pair₂ (inj-just (sym (trans t (proj₁ (proj₂ (proj₂ (q op (sym s))))))))) (proj₂ (proj₂ (proj₂ (proj₂ (q op (sym s)))))))) -- FUNCTORIALITY OF UNIONS OF EFFECT ANNOTATIONS ∪ₒ-fun : {o o' o'' o''' : O} → o ⊑ₒ o'' → o' ⊑ₒ o''' → -------------------------- (o ∪ₒ o') ⊑ₒ (o'' ∪ₒ o''') ∪ₒ-fun p q = ∪ₒ-copair (⊑ₒ-trans p ∪ₒ-inl) (⊑ₒ-trans q ∪ₒ-inr) ∪ᵢ-fun : {i i' i'' i''' : I} → i ⊑ᵢ i'' → i' ⊑ᵢ i''' → -------------------------- (i ∪ᵢ i') ⊑ᵢ (i'' ∪ᵢ i''') ∪ᵢ-fun p q = ∪ᵢ-copair (⊑ᵢ-trans p ∪ᵢ-inl) (⊑ᵢ-trans q ∪ᵢ-inr) -- UNIONS OF INTERRUPT ANNOTATIONS ARE GIVEN BY POINTWISE UNIONS ∪ᵢ-∪ₒ : {op : Σₛ} {o'' o''' o'''' : O} {i i' i'' i''' i'''' : I} → lkpᵢ op (i ∪ᵢ i') ≡ just (o'' , i'') → lkpᵢ op i ≡ just (o''' , i''') → lkpᵢ op i' ≡ just (o'''' , i'''') → --------------------------------------- o'' ≡ o''' ∪ₒ o'''' ∪ᵢ-∪ₒ {op} {o''} {o'''} {o''''} {imap i} {imap i'} p q r with i op | i' op ∪ᵢ-∪ₒ {op} {.(o''' ∪ₒ o'''')} {o'''} {o''''} {imap i} {imap i'} {_} {imap i'''} {imap i''''} refl refl refl | just .(o''' , imap i''') | just .(o'''' , imap i'''') = refl ∪ᵢ-∪ᵢ : {op : Σₛ} {o'' o''' o'''' : O} {i i' i'' i''' i'''' : I} → lkpᵢ op (i ∪ᵢ i') ≡ just (o'' , i'') → lkpᵢ op i ≡ just (o''' , i''') → lkpᵢ op i' ≡ just (o'''' , i'''') → --------------------------------------- i'' ≡ i''' ∪ᵢ i'''' ∪ᵢ-∪ᵢ {op} {o''} {o'''} {o''''} {imap i} {imap i'} p q r with i op | i' op ∪ᵢ-∪ᵢ {op} {.(o''' ∪ₒ o'''')} {o'''} {o''''} {imap i} {imap i'} {_} {imap i'''} {imap i''''} refl refl refl | just .(o''' , imap i''') | just .(o'''' , imap i'''') = refl -- INCLUSION INTO ACTED UPON EFFECT ANNOTATION {- LEMMA 3.1 (1) -} ↓ₑ-⊑ₒ : {o : O} {i : I} {op : Σₛ} → -------------------------- o ⊑ₒ proj₁ (op ↓ₑ (o , i)) ↓ₑ-⊑ₒ {omap o} {imap i} {op} op' p with i (op) ... | nothing = p ... | just (o' , i') = ∪ₒ-inl op' p {- LEMMA 3.1 (2) - the O part -} ↓ₑ-⊑ₒ-o' : {o o' : O} {i i' : I} {op : Σₛ} → lkpᵢ op i ≡ just (o' , i') → --------------------------- o' ⊑ₒ proj₁ (op ↓ₑ (o , i)) ↓ₑ-⊑ₒ-o' {omap o} {omap o'} {imap i} {imap i'} {op} p with i (op) ↓ₑ-⊑ₒ-o' {omap o} {omap o'} {imap i} {imap i'} {op} refl | just .(omap o' , imap i') = ↓ₑ-⊑ₒ-o'-aux where ↓ₑ-⊑ₒ-o'-aux : (op' : Σₛ) → o' op' ≡ just tt → ∪ₒ-aux o o' op' ≡ just tt ↓ₑ-⊑ₒ-o'-aux op' p with o op' ↓ₑ-⊑ₒ-o'-aux op' p | nothing = p ↓ₑ-⊑ₒ-o'-aux op' p | just tt = refl {- LEMMA 3.1 (2) - the I part -} ↓ₑ-⊑ₒ-i' : {o o' : O} {i i' : I} {op : Σₛ} → lkpᵢ op i ≡ just (o' , i') → --------------------------- i' ⊑ᵢ proj₂ (op ↓ₑ (o , i)) ↓ₑ-⊑ₒ-i' {omap o} {omap o'} {imap i} {imap i'} {op} p with i (op) ↓ₑ-⊑ₒ-i' {omap o} {omap o'} {imap i} {imap i'} {op} refl | just .(omap o' , imap i') = rel ↓ₑ-⊑ₒ-i'-aux where ↓ₑ-⊑ₒ-i'-aux : (op' : Σₛ) {o'' : O} {i'' : I} → i' op' ≡ just (o'' , i'') → Σ[ o''' ∈ O ] Σ[ i''' ∈ I ] (∪ᵢ-aux (λ op' → if op ≡ op' then nothing else i op') i' op' ≡ just (o''' , i''') × (o'' ⊑ₒ o''') × (i'' ⊑ᵢ i''')) ↓ₑ-⊑ₒ-i'-aux op' {o''} {i''} p with decₛ op op' ↓ₑ-⊑ₒ-i'-aux op' {o''} {i''} p | yes refl with i' (op) ↓ₑ-⊑ₒ-i'-aux op' {o''} {i''} refl | yes refl | just .(o'' , i'') = o'' , (i'' , refl , (⊑ₒ-refl , ⊑ᵢ-refl)) ↓ₑ-⊑ₒ-i'-aux op' {o''} {i''} p | no ¬q with i (op') | i' (op') ↓ₑ-⊑ₒ-i'-aux op' {o''} {i''} refl | no ¬q | nothing | just .(o'' , i'') = o'' , (i'' , refl , (⊑ₒ-refl , ⊑ᵢ-refl)) ↓ₑ-⊑ₒ-i'-aux op' {o''} {imap i''} refl | no ¬q | just (o''' , (imap i''')) | just .(o'' , (imap i'')) = (o''' ∪ₒ o'') , (imap (∪ᵢ-aux i''' i'') , (refl , (∪ₒ-inr , ∪ᵢ-inr))) -- EFFECT ANNOTATION OF AN INTERRUPT THAT WAS NOT ACTED WITH {- LEMMA 3.1 (3) -} lkpᵢ-↓ₑ-neq : {o o' : O} {i i' : I} {op op' : Σₛ} → ¬ op ≡ op' → lkpᵢ op' i ≡ just (o' , i') → ------------------------------------------------------------------------------------------------------- Σ[ o'' ∈ O ] Σ[ i'' ∈ I ] (lkpᵢ op' (proj₂ (op ↓ₑ (o , i))) ≡ just (o'' , i'') × o' ⊑ₒ o'' × i' ⊑ᵢ i'') lkpᵢ-↓ₑ-neq {omap o} {o'} {imap i} {imap i'} {op} {op'} p q with i (op) ... | nothing = o' , imap i' , q , ⊑ₒ-refl , ⊑ᵢ-refl lkpᵢ-↓ₑ-neq {omap o} {o'} {imap i} {imap i'} {op} {op'} p q | just (o'' , imap i'') with decₛ op op' ... | yes r with p r ... | () lkpᵢ-↓ₑ-neq {omap o} {o'} {imap i} {imap i'} {op} {op'} p q | just (o'' , imap i'') | no ¬r with i (op') | i'' (op') lkpᵢ-↓ₑ-neq {omap o} {.o'''} {imap i} {imap i'} {op} {op'} p refl | just (o'' , imap i'') | no ¬r | just (o''' , .(imap i')) | nothing = o''' , imap i' , refl , ⊑ₒ-refl , ⊑ᵢ-refl ... | just (o''' , imap i''') | just (o'''' , imap i'''') with q lkpᵢ-↓ₑ-neq {omap o} {.o'''} {imap i} {imap .i'''} {op} {op'} p q | just (o'' , imap i'') | no ¬r | just (o''' , imap i''') | just (o'''' , imap i'''') | refl = (o''' ∪ₒ o'''') , (imap i''') ∪ᵢ (imap i'''') , refl , ∪ₒ-inl , ∪ᵢ-inl -- NEXT DEFINED EFFECT ANNOTATION UNDER SUBTYPING EFFECT ANNOTATIONS lkpᵢ-nextₒ : {o'' : O} {i i' i'' : I} {op : Σₛ} → i ⊑ᵢ i' → lkpᵢ op i ≡ just (o'' , i'') → O lkpᵢ-nextₒ {o''} {i} {i'} {i''} {op} (rel p) q = proj₁ (p op q) lkpᵢ-nextᵢ : {o'' : O} {i i' i'' : I} {op : Σₛ} → i ⊑ᵢ i' → lkpᵢ op i ≡ just (o'' , i'') → I lkpᵢ-nextᵢ {o''} {i} {i'} {i''} {op} (rel p) q = proj₁ (proj₂ (p op q)) lkpᵢ-next-eq : {o'' : O} {i i' i'' : I} {op : Σₛ} → (p : i ⊑ᵢ i') → (q : lkpᵢ op i ≡ just (o'' , i'')) → ------------------------------------------------ lkpᵢ op i' ≡ just (lkpᵢ-nextₒ p q , lkpᵢ-nextᵢ p q) lkpᵢ-next-eq {o''} {i} {i'} {i''} {op} (rel p) q = proj₁ (proj₂ (proj₂ (p op q))) lkpᵢ-next-⊑ₒ : {o'' : O} {i i' i'' : I} {op : Σₛ} → (p : i ⊑ᵢ i') → (q : lkpᵢ op i ≡ just (o'' , i'')) → ----------------------------------- o'' ⊑ₒ lkpᵢ-nextₒ p q lkpᵢ-next-⊑ₒ {o''} {i} {i'} {i''} {op} (rel p) q = proj₁ (proj₂ (proj₂ (proj₂ (p op q)))) lkpᵢ-next-⊑ᵢ : {o'' : O} {i i' i'' : I} {op : Σₛ} → (p : i ⊑ᵢ i') → (q : lkpᵢ op i ≡ just (o'' , i'')) → ----------------------------------- i'' ⊑ᵢ lkpᵢ-nextᵢ p q lkpᵢ-next-⊑ᵢ {o''} {i} {i'} {i''} {op} (rel p) q = proj₂ (proj₂ (proj₂ (proj₂ (p op q)))) -- ACTION OF INTERRUPTS ON EFFECT ANNOTATIONS IS MONOTONIC mutual ↓ₑ-monotonicₒ : {o o' : O} {i i' : I} {op : Σₛ} → o ⊑ₒ o' → i ⊑ᵢ i' → ------------------------------------------------ proj₁ (op ↓ₑ (o , i)) ⊑ₒ proj₁ (op ↓ₑ (o' , i')) ↓ₑ-monotonicₒ {omap o} {omap o'} {imap i} {imap i'} {op} p (rel q) = ↓ₑ-monotonicₒ-aux (i op) (i' op) refl refl where ↓ₑ-monotonicₒ-aux : (oi oi' : Maybe (O × I)) → i op ≡ oi → i' op ≡ oi' → ---------------------------- ↓ₑ-auxₒ op oi (omap o) ⊑ₒ ↓ₑ-auxₒ op oi' (omap o') ↓ₑ-monotonicₒ-aux nothing nothing r s = p ↓ₑ-monotonicₒ-aux nothing (just (omap o''' , imap i''')) r s = ⊑ₒ-trans p ∪ₒ-inl ↓ₑ-monotonicₒ-aux (just (omap o'' , imap i'')) nothing r s with trans (sym s) (proj₁ (proj₂ (proj₂ (q op r)))) ... | () ↓ₑ-monotonicₒ-aux (just (omap o'' , imap i'')) (just (omap o''' , imap i''')) r s with trans (sym s) (proj₁ (proj₂ (proj₂ (q op r)))) ... | t = ∪ₒ-fun p (⊑ₒ-trans (proj₁ (proj₂ (proj₂ (proj₂ (q op r))))) (subst (λ o → o ⊑ₒ omap o''') (inj-pair₁ (inj-just t)) ⊑ₒ-refl)) ↓ₑ-monotonicᵢ : {o o' : O} {i i' : I} {op : Σₛ} → o ⊑ₒ o' → i ⊑ᵢ i' → ------------------------------------------------ proj₂ (op ↓ₑ (o , i)) ⊑ᵢ proj₂ (op ↓ₑ (o' , i')) ↓ₑ-monotonicᵢ {omap o} {omap o'} {imap i} {imap i'} {op} p (rel q) = ↓ₑ-monotonicᵢ-aux (i op) (i' op) refl refl where ↓ₑ-monotonicᵢ-aux : (oi oi' : Maybe (O × I)) → oi ≡ i op → oi' ≡ i' op → ----------------------------------------- ↓ₑ-auxᵢ op oi (imap i) ⊑ᵢ ↓ₑ-auxᵢ op oi' (imap i') ↓ₑ-monotonicᵢ-aux nothing nothing r s = rel q ↓ₑ-monotonicᵢ-aux nothing (just (omap o''' , imap i''')) r s = ⊑ᵢ-trans (rel (λ op' {o''''} {i''''} t → ↓ₑ-monotonicᵢ-aux' op' o'''' i'''' t)) (∪ᵢ-inl {(imap i') [ op ↦ nothing ]ᵢ} {imap i'''}) where ↓ₑ-monotonicᵢ-aux' : (op' : Σₛ) → (o'''' : O) → (i'''' : I) → i op' ≡ just (o'''' , i'''') → -------------------------------------------------------------------- Σ[ o''''' ∈ O ] Σ[ i''''' ∈ I ] ((if op ≡ op' then nothing else i' op') ≡ just (o''''' , i''''') × (o'''' ⊑ₒ o''''') × (i'''' ⊑ᵢ i''''')) ↓ₑ-monotonicᵢ-aux' op' o'''' i'''' t with decₛ op op' ↓ₑ-monotonicᵢ-aux' op' o'''' i'''' t | yes refl with trans r t ... | () ↓ₑ-monotonicᵢ-aux' op' o'''' i'''' t | no ¬u = lkpᵢ-nextₒ (rel q) t , lkpᵢ-nextᵢ (rel q) t , lkpᵢ-next-eq (rel q) t , lkpᵢ-next-⊑ₒ (rel q) t , lkpᵢ-next-⊑ᵢ (rel q) t ↓ₑ-monotonicᵢ-aux (just (omap o'' , imap i'')) nothing r s with trans s (proj₁ (proj₂ (proj₂ (q op (sym r))))) ... | () ↓ₑ-monotonicᵢ-aux (just (omap o'' , imap i'')) (just (omap o''' , imap i''')) r s = ∪ᵢ-fun {_} {imap i''} {_} {imap i'''} (rel λ op' {o''''} {i''''} t → ↓ₑ-monotonicᵢ-aux' op' o'''' i'''' t) (subst (λ i → imap i'' ⊑ᵢ i) (sym (inj-pair₂ (inj-just (trans s (proj₁ (proj₂ (proj₂ (q op (sym r))))))))) (proj₂ (proj₂ (proj₂ (proj₂ (q op (sym r))))))) where ↓ₑ-monotonicᵢ-aux' : (op' : Σₛ) → (o'''' : O) → (i'''' : I) → lkpᵢ op' (imap i [ op ↦ nothing ]ᵢ) ≡ just (o'''' , i'''') → -------------------------- Σ[ o''''' ∈ O ] Σ[ i''''' ∈ I ] (lkpᵢ op' (imap i' [ op ↦ nothing ]ᵢ) ≡ just (o''''' , i''''') × (o'''' ⊑ₒ o''''') × (i'''' ⊑ᵢ i''''')) ↓ₑ-monotonicᵢ-aux' op' o'''' i'''' t with decₛ op op' ↓ₑ-monotonicᵢ-aux' op' o'''' i'''' t | no ¬u = lkpᵢ-nextₒ (rel q) t , lkpᵢ-nextᵢ (rel q) t , lkpᵢ-next-eq (rel q) t , lkpᵢ-next-⊑ₒ (rel q) t , lkpᵢ-next-⊑ᵢ (rel q) t -- GENERALISED ACTION OF INTERRUPTS ON EFFECT ANNOTATIONS IS MONOTONIC mutual ↓↓ₑ-monotonicₒ : {o o' : O} {i i' : I} → (ops : List Σₛ) → o ⊑ₒ o' → i ⊑ᵢ i' → ---------------------------------------------------- proj₁ (ops ↓↓ₑ (o , i)) ⊑ₒ proj₁ (ops ↓↓ₑ (o' , i')) ↓↓ₑ-monotonicₒ {omap o} {omap o'} {imap i} {imap i'} [] p q = p ↓↓ₑ-monotonicₒ (op ∷ ops) p q = ↓ₑ-monotonicₒ (↓↓ₑ-monotonicₒ ops p q) (↓↓ₑ-monotonicᵢ ops p q) ↓↓ₑ-monotonicᵢ : {o o' : O} {i i' : I} → (ops : List Σₛ) → o ⊑ₒ o' → i ⊑ᵢ i' → ---------------------------------------------------- proj₂ (ops ↓↓ₑ (o , i)) ⊑ᵢ proj₂ (ops ↓↓ₑ (o' , i')) ↓↓ₑ-monotonicᵢ [] p q = q ↓↓ₑ-monotonicᵢ (op ∷ ops) p q = ↓ₑ-monotonicᵢ (↓↓ₑ-monotonicₒ ops p q) (↓↓ₑ-monotonicᵢ ops p q) -- INCLUSION INTO GENERALLY ACTED UPON EFFECT ANNOTATION ↓↓ₑ-⊑ₒ : {o : O} {i : I} → (ops : List Σₛ) → -------------------------- o ⊑ₒ proj₁ (ops ↓↓ₑ (o , i)) ↓↓ₑ-⊑ₒ [] = ⊑ₒ-refl ↓↓ₑ-⊑ₒ (op ∷ ops) = ⊑ₒ-trans (↓↓ₑ-⊑ₒ ops) (↓ₑ-⊑ₒ {op = op}) -- A PATH OF INTERRUPT NAMES THAT REVEALS THE GIVEN SIGNAL IN AN EFFECT ANNOTATION data _`at_`in_,_ (op : Σₛ) : List Σₛ → O → I → Set where stop : {o : O} {i : I} → op ∈ₒ o → ------------------- op `at [] `in o , i next : {o o' : O} {i i' : I} {op' : Σₛ} {ops : List Σₛ} → lkpᵢ op' i ≡ just (o' , i') → op `at ops `in o' , i' → ----------------------------- op `at (op' ∷ ops) `in o , i -- ACTING ON AN ANNOTATION WITH EMPTY SIGNALS PART JUST REVEALS THE INNER LAYER IF THE INTERRUPTS MATCH ↓ₑ-∅-↦-≡ : {op : Σₛ} {o : O} {i : I} → ----------------------------- op ↓ₑ (∅ₒ , imap (λ op' → if op' ≡ op then just (o , i) else nothing)) ≡ (o , i) ↓ₑ-∅-↦-≡ {op} {o} {i} with decₛ op op ↓ₑ-∅-↦-≡ {op} {omap o} {i} | yes refl = cong₂ (λ x y → x , y) (∪ₒ-lunit (omap o)) (trans (cong (λ i' → i' ∪ᵢ i) ↓ₑ-∅-↦-≡-aux) (∪ᵢ-lunit i)) where ↓ₑ-∅-↦-≡-aux : imap (λ op' → if op ≡ op' then nothing else (if op' ≡ op then just (omap o , i) else nothing)) ≡ ∅ᵢ ↓ₑ-∅-↦-≡-aux = cong imap (fun-ext ↓ₑ-∅-↦-≡-aux-aux) where ↓ₑ-∅-↦-≡-aux-aux : (op' : Σₛ) → --------------------------------------------------------------------------------- (if op ≡ op' then nothing else (if op' ≡ op then just (omap o , i) else nothing)) ≡ nothing ↓ₑ-∅-↦-≡-aux-aux op' with decₛ op op' ... | yes refl = refl ... | no ¬p = ite-≢ (λ q → ¬p (sym q)) ↓ₑ-∅-↦-≡ {op} {o} {i} | no ¬p = ⊥-elim (¬p refl) -- ACTING ON AN ANNOTATION WITH EMPTY SIGNALS IS IDEMPOTENT IF THE INTERRUPTS DO NOT MATCH ↓ₑ-∅-↦-≢ : {op op' : Σₛ} {o : O} {i : I} → op ≢ op' → ----------------------------- op' ↓ₑ (∅ₒ , imap (λ op'' → if op'' ≡ op then just (o , i) else nothing)) ≡ (∅ₒ , imap (λ op'' → if op'' ≡ op then just (o , i) else nothing)) ↓ₑ-∅-↦-≢ {op} {op'} p with decₛ op' op ↓ₑ-∅-↦-≢ {op} {.op} p | yes refl = ⊥-elim (p refl) ↓ₑ-∅-↦-≢ {op} {op'} p | no ¬q = refl -- A MINIMAL EFFECT ANNOTATION SUCH THAT A GIVEN PATH OF INTERRUPTS REVEALS THE GIVEN SIGNAL NAME mutual ⦃⦃_↦_⦄⦄ₒ : List Σₛ → Σₛ → O ⦃⦃ [] ↦ op ⦄⦄ₒ = omap (λ op' → if op ≡ op' then just tt else nothing) ⦃⦃ op' ∷ ops ↦ op ⦄⦄ₒ = ∅ₒ ⦃⦃_↦_⦄⦄ᵢ : List Σₛ → Σₛ → I ⦃⦃ [] ↦ op ⦄⦄ᵢ = ∅ᵢ ⦃⦃ op' ∷ ops ↦ op ⦄⦄ᵢ = imap (λ op'' → if op'' ≡ op' then just (⦃⦃ ops ↦ op ⦄⦄ₒ , ⦃⦃ ops ↦ op ⦄⦄ᵢ) else nothing) -- IF THERE IS A PATH TO A SIGNAL IN AN EFFECT ANNOTATION, THE MINIMAL EFFECT ANNOTATION IS INCLUDED IN IT mutual `at-minₒ : {op : Σₛ} {ops : List Σₛ} {o : O} {i : I} → op `at ops `in o , i → ---------------------- ⦃⦃ ops ↦ op ⦄⦄ₒ ⊑ₒ o `at-minₒ {op} {_} {omap o} (stop p) op' with decₛ op op' `at-minₒ {.op'} {.[]} {omap o} (stop p) op' | yes refl = λ _ → p `at-minₒ {op} {.[]} {omap o} (stop p) op'' | no ¬q = λ () `at-minₒ (next p q) op'' = λ () `at-minᵢ : {op : Σₛ} {ops : List Σₛ} {o : O} {i : I} → op `at ops `in o , i → ---------------------- ⦃⦃ ops ↦ op ⦄⦄ᵢ ⊑ᵢ i `at-minᵢ (stop p) = rel (λ op'' → λ ()) `at-minᵢ {op} (next {o} {o'} {i} {i'} {op'} {ops} p q) = rel (λ op'' {o''} {i''} r → `at-minᵢ-aux r) where `at-minᵢ-aux : {op'' : Σₛ} {o'' : O} {i'' : I} → lkpᵢ op'' ⦃⦃ op' ∷ ops ↦ op ⦄⦄ᵢ ≡ just (o'' , i'') → --------------------------------------------------- Σ[ o''' ∈ O ] Σ[ i''' ∈ I ] (lkpᵢ op'' i ≡ just (o''' , i''') × (o'' ⊑ₒ o''') × (i'' ⊑ᵢ i''')) `at-minᵢ-aux {op''} p with decₛ op'' op' `at-minᵢ-aux {op'} refl | yes refl = o' , i' , p , `at-minₒ q , `at-minᵢ q -- SUBPATHS OF (INTERRUPT) NAMES data _⊆_ : List Σₛ → List Σₛ → Set where [] : {ops' : List Σₛ} → ---------------- [] ⊆ ops' ∷-≡ : {op : Σₛ} {ops ops' : List Σₛ} → ops ⊆ ops' → ------------------------ (op ∷ ops) ⊆ (op ∷ ops') ∷-≢ : {op op' : Σₛ} {ops ops' : List Σₛ} → op ≢ op' → (op ∷ ops) ⊆ ops' → ------------------------- (op ∷ ops) ⊆ (op' ∷ ops') mutual ∷-≢-swap : {op op' : Σₛ} {ops ops' : List Σₛ} → op ≢ op' → (op ∷ ops) ⊆ (op' ∷ op ∷ ops') → -------------------------------- (op ∷ ops) ⊆ (op ∷ op' ∷ ops') ∷-≢-swap {op} {.op} {ops} {ops'} p (∷-≡ q) = ∷-≡ q ∷-≢-swap {op} {op'} {ops} {ops'} p (∷-≢ q (∷-≡ r)) = ∷-≡ (∷-∷ r) ∷-≢-swap {op} {op'} {ops} {ops'} p (∷-≢ q (∷-≢ r s)) = ⊥-elim (r refl) ∷-∷ : {op' : Σₛ} {ops : List Σₛ} → {ops' : List Σₛ} → ops ⊆ ops' → ------------------- ops ⊆ (op' ∷ ops') ∷-∷ [] = [] ∷-∷ {op'} (∷-≡ {op} p) with decₛ op op' ∷-∷ {.op} (∷-≡ {op} p) | yes refl = ∷-≡ (∷-∷ p) ∷-∷ {op'} (∷-≡ {op} p) | no ¬q = ∷-≢ ¬q (∷-≡ p) ∷-∷ {op'} (∷-≢ {op} {op''} p q) with decₛ op op' ∷-∷ {.op} (∷-≢ {op} {op''} p q) | yes refl = ∷-≢-swap p (∷-≢ p (∷-∷ q)) ∷-∷ {op'} (∷-≢ {op} {op''} p q) | no ¬r = ∷-≢ ¬r (∷-≢ p q) -- IF A SUBPATH OF INTERRUPTS REVEALS A SIGNAL, THEN ACTING WITH THE WHOLE PATH ALSO REVEALS IT ⊆-↓↓ : {op : Σₛ} {ops ops' : List Σₛ} → ops ⊆ ops' → --------------------------------------------------------------- op ∈ₒ proj₁ (reverse ops' ↓↓ₑ (⦃⦃ ops ↦ op ⦄⦄ₒ , ⦃⦃ ops ↦ op ⦄⦄ᵢ)) ⊆-↓↓ {op} {ops} {ops'} [] = (↓↓ₑ-⊑ₒ (reverse ops')) op ⊆-↓↓-aux where ⊆-↓↓-aux : (if op ≡ op then just tt else nothing) ≡ just tt ⊆-↓↓-aux with decₛ op op ⊆-↓↓-aux | yes refl = refl ⊆-↓↓-aux | no ¬p = ⊥-elim (¬p refl) ⊆-↓↓ {op} (∷-≡ {op'} {ops} {ops'} p) = subst (λ ops'' → op ∈ₒ proj₁ (ops'' ↓↓ₑ (⦃⦃ (op' ∷ ops) ↦ op ⦄⦄ₒ , ⦃⦃ (op' ∷ ops) ↦ op ⦄⦄ᵢ))) (sym (unfold-reverse op' ops')) (subst (λ oi → op ∈ₒ proj₁ oi) (sym (↓↓ₑ-act (reverse ops') [ op' ])) (subst (λ oi → op ∈ₒ proj₁ (reverse ops' ↓↓ₑ oi)) (sym ↓ₑ-∅-↦-≡) (⊆-↓↓ p))) ⊆-↓↓ {op} (∷-≢ {op'} {op''} {ops} {ops'} p q) = subst (λ ops'' → op ∈ₒ proj₁ (ops'' ↓↓ₑ (⦃⦃ (op' ∷ ops) ↦ op ⦄⦄ₒ , ⦃⦃ (op' ∷ ops) ↦ op ⦄⦄ᵢ))) (sym (unfold-reverse op'' ops')) (subst (λ oi → op ∈ₒ proj₁ oi) (sym (↓↓ₑ-act (reverse ops') [ op'' ])) (subst (λ oi → op ∈ₒ proj₁ (reverse ops' ↓↓ₑ oi)) (sym (↓ₑ-∅-↦-≢ p)) (⊆-↓↓ q))) -- IF A PATH REVEALS A SIGNAL IN A UNION OF EFFECT ANNOTATIONS, THE PATH REVEALS THE SIGNAL IN ONE OF THE SUMMANDS `at-⊎ : {op : Σₛ} {ops : List Σₛ} {o o' : O} {i i' : I} → op `at ops `in (o ∪ₒ o') , (i ∪ᵢ i') → ------------------------------------------------- (op `at ops `in o , i) ⊎ (op `at ops `in o' , i') `at-⊎ {op} {ops} {omap o} {omap o'} {i} {i'} (stop p) = `at-⊎-aux p (o op) (o' op) refl refl where `at-⊎-aux : (∪ₒ-aux o o' op ≡ just tt) → (t t' : Maybe ⊤) → o op ≡ t → o' op ≡ t' → ----------------------------------------------------------- (op `at ops `in omap o , i) ⊎ (op `at ops `in omap o' , i') `at-⊎-aux p nothing nothing q r with o op | o' op `at-⊎-aux () nothing nothing q r | nothing | nothing `at-⊎-aux p nothing nothing q () | nothing | just tt `at-⊎-aux p nothing (just tt) q r = inj₂ (stop r) `at-⊎-aux p (just tt) t' q r = inj₁ (stop q) `at-⊎ {op} {_} {o} {o'} {imap i} {imap i'} (next {o''} {o'''} {i''} {i'''} {op'} {ops} p q) = `at-⊎-aux p q (i op') (i' op') refl refl where `at-⊎-aux : ∪ᵢ-aux i i' op' ≡ just (o''' , i''') → op `at ops `in o''' , i''' → (oi oi' : Maybe (O × I)) → i op' ≡ oi → i' op' ≡ oi' → --------------------------------------------------------------------------- (op `at (op' ∷ ops) `in o , imap i) ⊎ (op `at (op' ∷ ops) `in o' , imap i') `at-⊎-aux p q nothing nothing r s with i op' | i' op' `at-⊎-aux () q nothing nothing r s | nothing | nothing `at-⊎-aux p q nothing nothing r () | nothing | just _ `at-⊎-aux p q nothing (just (o'''' , i'''')) r s = inj₂ (next (trans (sym (`at-⊎-aux-aux r s)) p) q) where `at-⊎-aux-aux : i op' ≡ nothing → i' op' ≡ just (o'''' , i'''') → ------------------------------- ∪ᵢ-aux i i' op' ≡ i' op' `at-⊎-aux-aux r s with i op' | i' op' `at-⊎-aux-aux r s | nothing | just _ = refl `at-⊎-aux p q (just (o'''' , i'''')) nothing r s = inj₁ (next (trans (sym (`at-⊎-aux-aux r s)) p) q) where `at-⊎-aux-aux : i op' ≡ just (o'''' , i'''') → i' op' ≡ nothing → ------------------------------- ∪ᵢ-aux i i' op' ≡ i op' `at-⊎-aux-aux r s with i op' | i' op' `at-⊎-aux-aux r s | just _ | nothing = refl `at-⊎-aux p q (just (o'''' , i'''')) (just (o''''' , i''''')) r s with ∪ᵢ-∪ₒ {i = imap i} {i' = imap i'} p r s | ∪ᵢ-∪ᵢ {i = imap i} {i' = imap i'} p r s ... | refl | refl with `at-⊎ q ... | inj₁ t = inj₁ (next r t) ... | inj₂ t = inj₂ (next s t) -- IF ACTING WITH A PATH REVEALS A SIGNAL, THEN THERE IS A SUBPATH TO THAT SIGNAL ↓↓-⊆-rw : (o : O) (i : I) (op : Σₛ) (ops : List Σₛ) → ---------------------------------------------------------------- reverse (op ∷ ops) ↓↓ₑ (o , i) ≡ reverse ops ↓↓ₑ (op ↓ₑ (o , i)) ↓↓-⊆-rw o i op ops = trans (cong (λ ops' → ops' ↓↓ₑ (o , i)) (unfold-reverse op ops)) (↓↓ₑ-act (reverse ops) [ op ]) ↓↓-⊆ : {op : Σₛ} → (ops : List Σₛ) → {o : O} {i : I} → op ∈ₒ proj₁ (reverse ops ↓↓ₑ (o , i)) → ---------------------------------------------------------- Σ[ ops' ∈ List Σₛ ] (ops' ⊆ ops × (op `at ops' `in o , i)) ↓↓-⊆ [] p = [] , [] , stop p ↓↓-⊆ {op} (op' ∷ ops) {omap o} {imap i} p rewrite ↓↓-⊆-rw (omap o) (imap i) op' ops = ↓↓-⊆-aux (i op') refl where ↓↓-⊆-aux : (oi : Maybe (O × I)) → i op' ≡ oi → ---------------------------------------------------------------------------- Σ[ ops' ∈ List Σₛ ] (ops' ⊆ (op' ∷ ops) × (op `at ops' `in omap o , imap i)) ↓↓-⊆-aux nothing q with ↓↓-⊆ ops p ... | ops' , r , s rewrite q = ops' , ∷-∷ r , s ↓↓-⊆-aux (just (omap o' , imap i')) q with ↓↓-⊆ ops p ... | ops' , r , s rewrite q with `at-⊎ {o = omap o} {o' = omap o'} {i' = imap i'} s ... | inj₁ t = ↓↓-⊆-aux-aux ops' r t where ↓↓-⊆-aux-aux : (ops' : List Σₛ) → ops' ⊆ ops → (op `at ops' `in omap o , ((imap i) [ op' ↦ nothing ]ᵢ)) → ------------------------------------------------------------------------------- Σ[ ops'' ∈ List Σₛ ] (ops'' ⊆ (op' ∷ ops) × (op `at ops'' `in omap o , imap i)) ↓↓-⊆-aux-aux [] r (stop t) = [] , [] , stop t ↓↓-⊆-aux-aux (op'' ∷ ops'') r (next t u) with decₛ op' op'' ... | no ¬v = op'' ∷ ops'' , ∷-≢ (λ w → ¬v (sym w)) r , next t u ... | inj₂ t = op' ∷ ops' , ∷-≡ r , next q t -- ENVELOPING THE EFFECT ANNOTATION REDUCTION WITH MLTIPLE INTERRUPT ACTIONS {- LEMMA 4.5 -} ↓↓ₑ-⊑ₒ-act : {o : O} {i : I} → (ops : List Σₛ) → (op : Σₛ) → ---------------------------------------------------------- proj₁ (ops ↓↓ₑ (o , i)) ⊑ₒ proj₁ (ops ↓↓ₑ (op ↓ₑ (o , i))) ↓↓ₑ-⊑ₒ-act {o} {i} ops op op' p rewrite sym (reverse-involutive ops) with ↓↓-⊆ (reverse ops) p ... | ops' , q , r with ⊆-↓↓ {op'} (∷-∷ {op} q) ... | s with ↓↓ₑ-monotonicₒ (reverse (op ∷ reverse ops)) (`at-minₒ r) (`at-minᵢ r) op' s ... | t rewrite ↓↓-⊆-rw o i op (reverse ops) | reverse-involutive ops = t
src/kernel/interrupt.asm
zys1310992814/BookOSv0.2
3
2271
<filename>src/kernel/interrupt.asm ;kernel/interrupt.asm ;description: interrupt ;auther: huzicheng ;time: 2019/2/20 ;Copyright: (C) 2018-2019 by BookOS developers. All rights reserved. ;E-mail: <EMAIL> %include "sys/const.inc" extern exception_handler extern irq_table extern sys_call_table extern tss global switch_to global divide_error global single_step_exception global nmi global breakpoint_exception global overflow global bounds_check global inval_opcode global copr_not_available global double_fault global copr_seg_overrun global inval_tss global segment_not_present global stack_exception global general_protection global page_fault global copr_error global intr_exit_clock CLOCK_IRQ equ 0 KEYBOARD_IRQ equ 1 MOUSE_IRQ equ 12 PRIMARY_IRQ equ 14 SECONDARY_IRQ equ 15 [section .text] [bits 32] ; 中断和异常 -- 异常 divide_error: push 0xFFFFFFFF ; no err code push 0 ; vector_no = 0 jmp exception single_step_exception: push 0xFFFFFFFF ; no err code push 1 ; vector_no = 1 jmp exception nmi: push 0xFFFFFFFF ; no err code push 2 ; vector_no = 2 jmp exception breakpoint_exception: push 0xFFFFFFFF ; no err code push 3 ; vector_no = 3 jmp exception overflow: push 0xFFFFFFFF ; no err code push 4 ; vector_no = 4 jmp exception bounds_check: push 0xFFFFFFFF ; no err code push 5 ; vector_no = 5 jmp exception inval_opcode: push 0xFFFFFFFF ; no err code push 6 ; vector_no = 6 jmp exception copr_not_available: push 0xFFFFFFFF ; no err code push 7 ; vector_no = 7 jmp exception double_fault: push 8 ; vector_no = 8 jmp exception copr_seg_overrun: push 0xFFFFFFFF ; no err code push 9 ; vector_no = 9 jmp exception inval_tss: push 10 ; vector_no = A jmp exception segment_not_present: push 11 ; vector_no = B jmp exception stack_exception: push 12 ; vector_no = C jmp exception general_protection: push 13 ; vector_no = D jmp exception page_fault: push 14 ; vector_no = E jmp exception copr_error: push 0xFFFFFFFF ; no err code push 16 ; vector_no = 10h jmp exception exception: push esp call exception_handler add esp, 4*3 ; 让栈顶指向 EIP,堆栈中从顶向下依次是:EIP、CS、EFLAGS hlt global IRQ_clock IRQ_clock: push ds push es push fs push gs pushad mov dx,ss mov ds, dx mov es, dx ;mov esp, INTERRUPT_STACK_TOP cli mov al, EOI out INT_M_CTL, al push CLOCK_IRQ call [irq_table + CLOCK_IRQ*4] add esp, 4 sti jmp intr_exit global IRQ_keyboard IRQ_keyboard: push ds push es push fs push gs pushad mov dx,ss mov ds, dx mov es, dx ;mov esp, INTERRUPT_STACK_TOP cli mov al, EOI out INT_M_CTL, al push KEYBOARD_IRQ call [irq_table + KEYBOARD_IRQ*4] add esp, 4 sti jmp intr_exit global IRQ_mouse IRQ_mouse: push ds push es push fs push gs pushad mov dx,ss mov ds, dx mov es, dx cli ;intr over mov al, EOI ;master out INT_M_CTL, al ;slaver out INT_S_CTL, al push MOUSE_IRQ call [irq_table + MOUSE_IRQ*4] add esp, 4 sti jmp intr_exit global IRQ_primary_channel IRQ_primary_channel: push ds push es push fs push gs pushad mov dx,ss mov ds, dx mov es, dx ;mov esp, INTERRUPT_STACK_TOP cli ;intr over mov al, EOI ;master out INT_M_CTL, al ;slaver out INT_S_CTL, al push PRIMARY_IRQ call [irq_table + PRIMARY_IRQ*4] add esp, 4 sti jmp intr_exit global IRQ_secondary_channel IRQ_secondary_channel: push ds push es push fs push gs pushad mov dx,ss mov ds, dx mov es, dx cli ;intr over mov al, EOI ;master out INT_M_CTL, al ;slaver out INT_S_CTL, al push SECONDARY_IRQ call [irq_table + SECONDARY_IRQ*4] add esp, 4 sti jmp intr_exit global intrrupt_sys_call intrrupt_sys_call: push ds push es push fs push gs pushad cli mov edi, edx mov dx,ss mov ds, dx mov es, dx mov edx, edi ;先把后面的参数压栈, 最多支持4个参数 push esi push edx push ecx push ebx call [sys_call_table + eax*4] add esp, 4*4 ;keep eax in return stack mov [esp + 4*7], eax sti jmp intr_exit global thread_intr_exit global intr_exit thread_intr_exit: mov esp, [esp + 4] sti intr_exit: popad pop gs pop fs pop es pop ds iretd global intr_exit_clock intr_exit_clock: ;mov esp, [task_ready] ;lea eax, [esp + STACKTOP] ;mov dword [tss + TSS_ESP0], eax pop gs pop fs pop es pop ds popad iretd
source/Alfred/Alfred.applescript
whtsky/PopClip-Extensions
3
941
tell application "Alfred 2" to search "{popclip text}"
programs/oeis/100/A100159.asm
karttu/loda
1
86363
<filename>programs/oeis/100/A100159.asm<gh_stars>1-10 ; A100159: Structured disdyakis triacontahedral numbers (vertex structure 7). ; 1,62,297,820,1745,3186,5257,8072,11745,16390,22121,29052,37297,46970,58185,71056,85697,102222,120745,141380,164241,189442,217097,247320,280225,315926,354537,396172,440945,488970,540361,595232,653697,715870,781865,851796,925777,1003922,1086345,1173160,1264481,1360422,1461097,1566620,1677105,1792666,1913417,2039472,2170945,2307950,2450601,2599012,2753297,2913570,3079945,3252536,3431457,3616822,3808745,4007340,4212721,4425002,4644297,4870720,5104385,5345406,5593897,5849972,6113745,6385330,6664841,6952392,7248097,7552070,7864425,8185276,8514737,8852922,9199945,9555920,9920961,10295182,10678697,11071620,11474065,11886146,12307977,12739672,13181345,13633110,14095081,14567372,15050097,15543370,16047305,16562016,17087617,17624222,18171945,18730900,19301201,19882962,20476297,21081320,21698145,22326886,22967657,23620572,24285745,24963290,25653321,26355952,27071297,27799470,28540585,29294756,30062097,30842722,31636745,32444280,33265441,34100342,34949097,35811820,36688625,37579626,38484937,39404672,40338945,41287870,42251561,43230132,44223697,45232370,46256265,47295496,48350177,49420422,50506345,51608060,52725681,53859322,55009097,56175120,57357505,58556366,59771817,61003972,62252945,63518850,64801801,66101912,67419297,68754070,70106345,71476236,72863857,74269322,75692745,77134240,78593921,80071902,81568297,83083220,84616785,86169106,87740297,89330472,90939745,92568230,94216041,95883292,97570097,99276570,101002825,102748976,104515137,106301422,108107945,109934820,111782161,113650082,115538697,117448120,119378465,121329846,123302377,125296172,127311345,129348010,131406281,133486272,135588097,137711870,139857705,142025716,144216017,146428722,148663945,150921800,153202401,155505862,157832297,160181820,162554545,164950586,167370057,169813072,172279745,174770190,177284521,179822852,182385297,184971970,187582985,190218456,192878497,195563222,198272745,201007180,203766641,206551242,209361097,212196320,215057025,217943326,220855337,223793172,226756945,229746770,232762761,235805032,238873697,241968870,245090665,248239196,251414577,254616922,257846345,261102960,264386881,267698222,271037097,274403620,277797905,281220066,284670217,288148472,291654945,295189750 mov $1,$0 add $1,6 pow $1,2 sub $1,35 mov $3,$0 mul $3,$0 mov $2,$3 mul $2,29 add $1,$2 mul $3,$0 mov $2,$3 mul $2,19 add $1,$2
msp430-gcc-tics/msp430-gcc-7.3.1.24-source-full/gcc/gcc/testsuite/gnat.dg/generic_disp.adb
TUDSSL/TICS
7
8653
<reponame>TUDSSL/TICS -- { dg-do run } with Generic_Disp_Pkg; use Generic_Disp_Pkg; procedure Generic_Disp is I : aliased Integer := 0; D : Iface'Class := Dispatching_Constructor (DT'Tag, I'access); begin null; end Generic_Disp;
elan520-reset_generation_registers.ads
Jellix/elan520
0
7800
------------------------------------------------------------------------ -- Copyright (C) 2004-2020 by <<EMAIL>> -- -- -- -- This work is free. You can redistribute it and/or modify it under -- -- the terms of the Do What The Fuck You Want To Public License, -- -- Version 2, as published by Sam Hocevar. See the LICENSE file for -- -- more details. -- ------------------------------------------------------------------------ pragma License (Unrestricted); ------------------------------------------------------------------------ -- AMD Élan(tm) SC 520 embedded microprocessor -- -- MMCR -> Reset Generation Registers -- -- -- -- reference: Register Set Manual Chapter 4 -- ------------------------------------------------------------------------ with Elan520.Basic_Types; package Elan520.Reset_Generation_Registers is --------------------------------------------------------------------- -- System Board Information (SYSINFO) -- -- Memory Mapped, Read Only -- -- MMCR Offset D70h -- --------------------------------------------------------------------- MMCR_OFFSET_SYS_INFO : constant := 16#D70#; SYS_INFO_SIZE : constant := 8; type System_Board_Information is mod 2**8; for System_Board_Information'Size use SYS_INFO_SIZE; --------------------------------------------------------------------- -- Reset Configuration (RESCFG) -- -- Memory Mapped, Read/Write -- -- MMCR Offset D72h -- --------------------------------------------------------------------- MMCR_OFFSET_RES_CFG : constant := 16#D72#; RES_CFG_SIZE : constant := 8; type Reset_Configuration is record Sys_Rst : Basic_Types.Positive_Bit; GP_Rst : Basic_Types.Positive_Bit; Prg_Rst_Enb : Basic_Types.Positive_Bit; ICE_On_Rst : Basic_Types.Positive_Bit; end record; for Reset_Configuration use record Sys_Rst at 0 range 0 .. 0; GP_Rst at 0 range 1 .. 1; Prg_Rst_Enb at 0 range 2 .. 2; ICE_On_Rst at 0 range 3 .. 3; -- bits 4 .. 7 are reserved end record; for Reset_Configuration'Size use RES_CFG_SIZE; --------------------------------------------------------------------- -- Reset Status (RESSTA) -- -- Memory Mapped, Read/Write -- -- MMCR Offset D74h -- --------------------------------------------------------------------- MMCR_OFFSET_RES_STA : constant := 16#D74#; RES_STA_SIZE : constant := 8; type Reset_Status is record Pwr_Good_Det : Basic_Types.Positive_Bit; Prg_Rst_Det : Basic_Types.Positive_Bit; SD_Rst_Det : Basic_Types.Positive_Bit; WDT_Rst_Det : Basic_Types.Positive_Bit; ICE_S_Rst : Basic_Types.Positive_Bit; ICE_H_Rst : Basic_Types.Positive_Bit; SCP_Rst_Det : Basic_Types.Positive_Bit; end record; for Reset_Status use record Pwr_Good_Det at 0 range 0 .. 0; Prg_Rst_Det at 0 range 1 .. 1; SD_Rst_Det at 0 range 2 .. 2; WDT_Rst_Det at 0 range 3 .. 3; ICE_S_Rst at 0 range 4 .. 4; ICE_H_Rst at 0 range 5 .. 5; SCP_Rst_Det at 0 range 6 .. 6; -- bit 7 is reserved; end record; for Reset_Status'Size use RES_STA_SIZE; end Elan520.Reset_Generation_Registers;
programs/oeis/137/A137362.asm
jmorken/loda
1
82076
; A137362: Positions at which the truncated square root of triangular numbers is unique. ; 4,7,8,11,14,17,18,21,24,25,28,31,34,35,38,41,42,45,48,49,52,55,58,59,62,65,66,69,72,75,76,79,82,83,86,89,92,93,96,99,100,103,106,107,110,113,116,117,120,123,124,127,130,133,134,137,140,141,144,147,148,151,154,157,158,161,164,165,168,171,174,175,178,181,182,185,188,191,192,195,198,199,202,205,206,209,212,215,216,219,222,223,226,229,232,233,236,239,240,243,246,247,250,253,256,257,260,263,264,267,270,273,274,277,280,281,284,287,288,291,294,297,298,301,304,305,308,311,314,315,318,321,322,325,328,331,332,335,338,339,342,345,346,349,352,355,356,359,362,363,366,369,372,373,376,379,380,383,386,387,390,393,396,397,400,403,404,407,410,413,414,417,420,421,424,427,430,431,434,437,438,441,444,445,448,451,454,455,458,461,462,465,468,471,472,475,478,479,482,485,486,489,492,495,496,499,502,503,506,509,512,513,516,519,520,523,526,529,530,533,536,537,540,543,544,547,550,553,554,557,560,561,564,567,570,571,574,577,578,581,584,585,588,591,594,595,598,601,602,605 mov $2,$0 mov $3,$0 add $0,1 lpb $0 lpb $2 add $0,$2 sub $2,1 lpe lpb $0 add $1,2 trn $0,$1 lpe lpe lpb $3 add $1,1 sub $3,1 lpe add $1,2
c-ops.ads
mikequentel/c2ada
4
26013
<reponame>mikequentel/c2ada<filename>c-ops.ads<gh_stars>1-10 -- $Source: /home/CVSROOT/c2ada/c-ops.ads,v $ -- $Revision: 1.1.1.1 $ $Date: 1999/02/02 12:01:51 $ with Ada.Unchecked_Conversion; package C.Ops is subtype Uchar is C.Unsigned_Char; subtype Ushort is C.Unsigned_Short; subtype Uint is C.Unsigned_Int; subtype Ulong is C.Unsigned_Long; -- unchecked conversions between signed and unsigned types -------------- function To_Unsigned is new Ada.Unchecked_Conversion (Char, UChar); function To_Unsigned is new Ada.Unchecked_Conversion (Short, Ushort); function To_Unsigned is new Ada.Unchecked_Conversion (Int, Uint); function To_Unsigned is new Ada.Unchecked_Conversion (Long, Ulong); function To_Signed is new Ada.Unchecked_Conversion (UChar, Char); function To_Signed is new Ada.Unchecked_Conversion (UShort, Short); function To_Signed is new Ada.Unchecked_Conversion (UInt, Int); function To_Signed is new Ada.Unchecked_Conversion (ULong, Long); -- and, or, xor, not ----------------------------------------------------- function "and" (I1, I2: Uchar) return Uchar renames Interfaces.C."and"; function "and" (I1, I2: Ushort) return Ushort renames Interfaces.C."and"; function "and" (I1, I2: Uint) return Uint renames Interfaces.C."and"; function "and" (I1, I2: Ulong) return Ulong renames Interfaces.C."and"; function "and" (I1, I2: Char) return Char; pragma Inline("and"); function "and" (I1, I2: Short) return Short; pragma Inline("and"); function "and" (I1, I2: Int) return Int; pragma Inline("and"); function "and" (I1, I2: Long) return Long; pragma Inline("and"); function "or" (I1, I2: Uchar) return Uchar renames Interfaces.C."or"; function "or" (I1, I2: Ushort) return Ushort renames Interfaces.C."or"; function "or" (I1, I2: Uint) return Uint renames Interfaces.C."or"; function "or" (I1, I2: Ulong) return Ulong renames Interfaces.C."or"; function "or" (I1, I2: Char) return Char; pragma Inline("or"); function "or" (I1, I2: Short) return Short; pragma Inline("or"); function "or" (I1, I2: Int) return Int; pragma Inline("or"); function "or" (I1, I2: Long) return Long; pragma Inline("or"); function "xor" (I1, I2: Uchar) return Uchar renames Interfaces.C."xor"; function "xor" (I1, I2: Ushort) return Ushort renames Interfaces.C."xor"; function "xor" (I1, I2: Uint) return Uint renames Interfaces.C."xor"; function "xor" (I1, I2: Ulong) return Ulong renames Interfaces.C."xor"; function "xor" (I1, I2: Char) return Char; pragma Inline("xor"); function "xor" (I1, I2: Short) return Short; pragma Inline("xor"); function "xor" (I1, I2: Int) return Int; pragma Inline("xor"); function "xor" (I1, I2: Long) return Long; pragma Inline("xor"); function "not" (I1: Uchar) return Uchar renames Interfaces.C."not"; function "not" (I1: Ushort) return Ushort renames Interfaces.C."not"; function "not" (I1: Uint) return Uint renames Interfaces.C."not"; function "not" (I1: Ulong) return Ulong renames Interfaces.C."not"; function "not" (I1: Char) return Char; pragma Inline("not"); function "not" (I1: Short) return Short; pragma Inline("not"); function "not" (I1: Int) return Int; pragma Inline("not"); function "not" (I1: Long) return Long; pragma Inline("not"); -- Shift left and right --------------------------------------------------- function Shift_Left (Value: Uchar; Amount: Natural) return Uchar; pragma Inline(Shift_Left); function Shift_Left (Value: Ushort; Amount: Natural) return Ushort; pragma Inline(Shift_Left); function Shift_Left (Value: Uint; Amount: Natural) return Uint; pragma Inline(Shift_Left); function Shift_Left (Value: Ulong; Amount: Natural) return Ulong; pragma Inline(Shift_Left); function Shift_Left (Value: Char; Amount: Natural) return Char; pragma Inline(Shift_Left); function Shift_Left (Value: Short; Amount: Natural) return Short; pragma Inline(Shift_Left); function Shift_Left (Value: Int; Amount: Natural) return Int; pragma Inline(Shift_Left); function Shift_Left (Value: Long; Amount: Natural) return Long; pragma Inline(Shift_Left); function Shift_Right (Value: Uchar; Amount: Natural) return Uchar; pragma Inline(Shift_Right); function Shift_Right (Value: Ushort; Amount: Natural) return Ushort; pragma Inline(Shift_Right); function Shift_Right (Value: Uint; Amount: Natural) return Uint; pragma Inline(Shift_Right); function Shift_Right (Value: Ulong; Amount: Natural) return Ulong; pragma Inline(Shift_Right); function Shift_Right (Value: Char; Amount: Natural) return Char; pragma Inline(Shift_Right); function Shift_Right (Value: Short; Amount: Natural) return Short; pragma Inline(Shift_Right); function Shift_Right (Value: Int; Amount: Natural) return Int; pragma Inline(Shift_Right); function Shift_Right (Value: Long; Amount: Natural) return Long; pragma Inline(Shift_Right); function Shift_Right_Arithmetic (Value: Uchar; Amount: Natural) return Uchar; pragma Inline(Shift_Right_Arithmetic); function Shift_Right_Arithmetic (Value: Ushort; Amount: Natural) return Ushort; pragma Inline(Shift_Right_Arithmetic); function Shift_Right_Arithmetic (Value: Uint; Amount: Natural) return Uint; pragma Inline(Shift_Right_Arithmetic); function Shift_Right_Arithmetic (Value: Ulong; Amount: Natural) return Ulong; pragma Inline(Shift_Right_Arithmetic); function Shift_Right_Arithmetic (Value: Char; Amount: Natural) return Char; pragma Inline(Shift_Right_Arithmetic); function Shift_Right_Arithmetic (Value: Short; Amount: Natural) return Short; pragma Inline(Shift_Right_Arithmetic); function Shift_Right_Arithmetic (Value: Int; Amount: Natural) return Int; pragma Inline(Shift_Right_Arithmetic); function Shift_Right_Arithmetic (Value: Long; Amount: Natural) return Long; pragma Inline(Shift_Right_Arithmetic); end C.Ops;
programs/oeis/190/A190785.asm
neoneye/loda
22
176242
; A190785: Numbers that are congruent to {0, 2, 3, 5, 7, 9, 11} mod 12. ; 0,2,3,5,7,9,11,12,14,15,17,19,21,23,24,26,27,29,31,33,35,36,38,39,41,43,45,47,48,50,51,53,55,57,59,60,62,63,65,67,69,71,72,74,75,77,79,81,83,84,86,87,89,91,93,95,96,98,99,101,103,105,107,108,110,111,113,115,117,119,120,122,123,125,127,129,131,132,134,135,137,139,141,143,144,146,147,149,151,153,155,156,158,159,161,163,165,167,168,170 lpb $0 add $1,$0 trn $0,2 mov $2,$0 trn $0,5 add $1,$2 add $1,1 trn $2,4 sub $1,$2 sub $1,$0 lpe mov $0,$1
source/strings/a-zchhan.ads
ytomino/drake
33
21793
<filename>source/strings/a-zchhan.ads pragma License (Unrestricted); -- Ada 2012 with Ada.Characters.Handling; private with Ada.UCD; package Ada.Wide_Wide_Characters.Handling is -- pragma Pure; pragma Preelaborate; -- function Character_Set_Version return String; Character_Set_Version : constant String; function Is_Control (Item : Wide_Wide_Character) return Boolean renames Characters.Handling.Overloaded_Is_Control; function Is_Letter (Item : Wide_Wide_Character) return Boolean renames Characters.Handling.Overloaded_Is_Letter; function Is_Lower (Item : Wide_Wide_Character) return Boolean renames Characters.Handling.Overloaded_Is_Lower; function Is_Upper (Item : Wide_Wide_Character) return Boolean renames Characters.Handling.Overloaded_Is_Upper; function Is_Basic (Item : Wide_Wide_Character) return Boolean renames Characters.Handling.Overloaded_Is_Basic; -- Note: Wide_Wide_Characters.Handling.Is_Basic is incompatible with -- Characters.Handling.Is_Basic. See AI12-0260-1. function Is_Digit (Item : Wide_Wide_Character) return Boolean renames Characters.Handling.Overloaded_Is_Digit; function Is_Decimal_Digit (Item : Wide_Wide_Character) return Boolean renames Is_Digit; function Is_Hexadecimal_Digit (Item : Wide_Wide_Character) return Boolean renames Characters.Handling.Overloaded_Is_Hexadecimal_Digit; function Is_Alphanumeric (Item : Wide_Wide_Character) return Boolean renames Characters.Handling.Overloaded_Is_Alphanumeric; function Is_Special (Item : Wide_Wide_Character) return Boolean renames Characters.Handling.Overloaded_Is_Special; -- function Is_Line_Terminator (Item : Wide_Wide_Character) return Boolean; -- function Is_Mark (Item : Wide_Wide_Character) return Boolean; -- function Is_Other_Format (Item : Wide_Wide_Character) return Boolean; -- function Is_Punctuation_Connector (Item : Wide_Wide_Character) -- return Boolean; -- function Is_Space (Item : Wide_Wide_Character) return Boolean; function Is_Graphic (Item : Wide_Wide_Character) return Boolean renames Characters.Handling.Overloaded_Is_Graphic; function To_Basic (Item : Wide_Wide_Character) return Wide_Wide_Character renames Characters.Handling.Overloaded_To_Basic; function To_Lower (Item : Wide_Wide_Character) return Wide_Wide_Character renames Characters.Handling.Overloaded_To_Lower; function To_Upper (Item : Wide_Wide_Character) return Wide_Wide_Character renames Characters.Handling.Overloaded_To_Upper; function To_Lower (Item : Wide_Wide_String) return Wide_Wide_String renames Characters.Handling.Overloaded_To_Lower; function To_Upper (Item : Wide_Wide_String) return Wide_Wide_String renames Characters.Handling.Overloaded_To_Upper; function To_Basic (Item : Wide_Wide_String) return Wide_Wide_String renames Characters.Handling.Overloaded_To_Basic; private Character_Set_Version : constant String := UCD.Version; end Ada.Wide_Wide_Characters.Handling;
alloy4fun_models/trashltl/models/5/Jp9TRtzehJrYoFQTr.als
Kaixi26/org.alloytools.alloy
0
284
open main pred idJp9TRtzehJrYoFQTr_prop6 { all f : File | f in Trash => always f in Trash } pred __repair { idJp9TRtzehJrYoFQTr_prop6 } check __repair { idJp9TRtzehJrYoFQTr_prop6 <=> prop6o }
RASD/Latex File/Alloy/Model3.als
SaeidRezaei90/GalbiatiRezaei
0
1800
open util/boolean //sig string {} //sig Name, Surname{} sig Email, Password{} abstract sig User { //name: one Name, //surname: some Surname, email: one Email, password: some Password, accessLevel: one Bool, minedInfo: some MinedInfo, } sig EndUser extends User{ userLocation: one Location, }{ accessLevel = False } sig Authority extends User{ tickets: Ticket, }{ #tickets >= 1 accessLevel = True } sig Location { latitude: one Int , longitude:one Int } sig Photo {} sig Violation { location: one Location, addr: some ReverseGioCoding, reporter: one EndUser, //type: one string, photo: one Photo, licensePlate: one ALPR, } sig ReverseGioCoding { loc: some Location, //addr: one string }{#ReverseGioCoding = 1} sig ALPR { picture: some Photo , // licenseP: one string }{ #ALPR = 1} abstract sig MinedInfo { violations: some Violation, } sig MinedStreet extends MinedInfo{ /* // name: some string, frequency: some Int, location : one Location,*/ } sig MinedOffender extends MinedInfo{ /* n_Violations: one Int, licensePlate: one Int, uuid: one Int*/ } sig Ticket { violations: one Violation, valid: one Bool, approved: one Bool, } { valid = True approved= True } //Two different users can’t have the same Location fact NoSameGPSForDifferentUsers { no disjoint u1, u2 : EndUser | u1.userLocation = u2.userLocation } //Two different Locations can’t have the same Reverse Address fact NoSameGPSForDifferentReverseGio { no disjoint revGio1, revGio2: ReverseGioCoding | revGio1.loc = revGio2.loc } fact NoSamePhotoForDifferentViolation { no disjoint v1,v2 : Violation | v1.photo = v2.photo } //Two different Violatins can’t report by the same user at the same time fact NoSameViolationForDiffReporter{ no disjoint v1, v2 : Violation | v1.reporter = v2.reporter } //Each ticket should issue by onle one Authority fact EachTicketOneAuthority { all t: Ticket | one au: Authority | au.tickets = t } //Two different users can’t have the same email fact NoSameEmailForDifferentUsers { no disjoint u1, u2 : User | u1.email = u2.email } //Two different users can't request for the same MinedInformation fact NoSameMinedInfoForDifferentUsers { all disjoint u1,u2: User | u1.minedInfo != u2.minedInfo /* no disjoint u1,u2: User | u1.minedInfo = u2.minedInfo */ } //Number of Locations should be equall to number of Users fact EqualUserAndLocation{ #EndUser = #Location } //fact {all u: User | some n: Name | u.name = n} //fact {all u: User | all n: Surname | u.surname = n} //End users should only be allowed to access Mine street not mined offenders fact EndUserRelateOnlyMinedStreet { all user: EndUser | user.minedInfo = MinedStreet } //There is only one ALPR Entity who is responsible to process Photos fact EachPhotoBelongsAlpr { all ph: Photo| one alpr: ALPR | alpr.picture = ph } //The location of an EndUSers should be equal to reverse giocodding location fact EqualLocationForEndUserAndGio { one revGio: ReverseGioCoding| one u: EndUser | revGio.loc = u.userLocation } //A violation and an Enduser should have the same location fact EqualLocationForViolationAndEndUser { all viol: Violation | some u:EndUser| viol.location = u.userLocation } //For each violation there should be only one corresponding ticket fact EachViolatioContainsOneTicket { one t: Ticket , v:Violation | t.violations = v } //****************ASSERTIONS************* //Two different users should have two different Emails assert noTwoUserWithSameEmail { no disjoint u1, u2: User | u1.email = u2.email } check noTwoUserWithSameEmail for 2 //Two different Tickets should not be issued for one violation assert noTwoTicketsForOneViolatios{ no disjoint t1, t2: Ticket | t1.violations = t2.violations } check noTwoTicketsForOneViolatios for 2 //an Enduser shouldn't be allowed to access MinedOffender assert EndUseCanNotAccessMinedOffender{ no u: EndUser | some m:MinedOffender| u.minedInfo= m } check EndUseCanNotAccessMinedOffender for 2 pred showViolation { #Password >=1 } run showViolation for 2
programs/oeis/035/A035336.asm
neoneye/loda
22
244656
; A035336: a(n) = 2*floor(n*phi) + n - 1, where phi = (1+sqrt(5))/2. ; 2,7,10,15,20,23,28,31,36,41,44,49,54,57,62,65,70,75,78,83,86,91,96,99,104,109,112,117,120,125,130,133,138,143,146,151,154,159,164,167,172,175,180,185,188,193,198,201,206,209,214,219,222,227,230,235,240,243,248,253,256,261,264,269,274,277,282,287,290,295,298,303,308,311,316,319,324,329,332,337,342,345,350,353,358,363,366,371,376,379,384,387,392,397,400,405,408,413,418,421 mov $1,$0 seq $1,283233 ; 2*A000201. add $0,$1
test/Succeed/Issue3564.agda
shlevy/agda
1,989
5402
{-# OPTIONS --cubical --no-sized-types --guardedness --safe #-} module Issue3564 where record Stream (A : Set) : Set where coinductive field head : A field tail : Stream A open Stream data A : Set where a : A someA : Stream A head someA = a tail someA = someA -- WAS: termination check failed -- NOW: OK
MinesweeperASM/MinesweeperASM/minesweeper.asm
aliascc/aliascc-PoCs
1
873
<gh_stars>1-10 .model flat, c printf PROTO arg1:Ptr BYTE, printlist:VARARG scanf PROTO arg2:Ptr BYTE, inputlist:VARARG system PROTO arg1:Ptr BYTE helper_random PROTO arg1:DWORD .data B_BLANK equ 1 B_MINE equ 2 B_NUMBER equ 4 B_HIDDEN equ 8 B_ALL equ 15 B_INVALIDPOS equ 0 B_GAME_OVER equ 1 B_GAME_WIN equ 2 B_OK equ 3 ;Game Table rowSize equ 10 colSize equ 10 maxMines equ 10 tableSize equ (rowSize * colSize) gameTableType DD (tableSize) DUP(B_HIDDEN) gameTableNumbers DD (tableSize) DUP(0) gameDisplayedLocs DD 0 ;Strings for Menus strScanfInt DB "%d", 0 strEndLine DB 10, 0 strChooseX DB "Choose X: ", 0 strChooseY DB "Choose Y: ", 0 strWinMsg DB "You've won the Game!", 0 strLostMsg DB "You've lost the game!", 0 ;String for Game Table strHidden DB "-", 0 strBlank DB " ", 0 strMine DB "*", 0 strNumber DB "%d", 0 strNumberBlank DB "%d ", 0 strNumber2Blank DB "%d ", 0 strNumberTableSepFL DB "%d |", 0 strTableSep DB " | ", 0 strTableSepFL DB " |", 0 strTableBlank DB " ", 0 strTable2Blank DB " ", 0 ;Other Strings strClearScreen DB "cls", 0 ;Input to read intToRead DD 0 .code ; Clears the Screen ; no params ; no return clear_screen PROC push OFFSET strClearScreen call system add esp, 4 ; Stack cleaning ret clear_screen ENDP ; Read and integer from a user ; no params ; return <eax>: integer that was read read_int PROC push OFFSET intToRead push OFFSET strScanfInt call scanf add esp, 8 ; Stack cleaning mov eax, intToRead ret read_int ENDP ; Print String ; param <ecx>: String to print ; no return print_str PROC push ecx call printf add esp, 4 ; Stack cleaning ret print_str ENDP ; Print end line ; no return print_end_line PROC push OFFSET strEndLine call printf add esp, 4 ; Stack cleaning ret print_end_line ENDP ; Print String with a number ; param <edx>: Integer to print ; param <ecx>: String to print ; no return print_str_num PROC push edx push ecx call printf add esp, 8 ; Stack Cleaning ret print_str_num ENDP ; Get Location from X & Y ; param <ecx>: X Position ; param <edx>: Y Position ; return <eax>: location in table get_location PROC ;Save Y value push edx ;Get offset for row mov eax, colSize mul ecx pop edx add eax, edx ret get_location ENDP ; Traverse the table when selecting a node ; param <eax>: Table Position ; param <ecx>: X Position ; param <edx>: Y Position ; no returns traverse_table PROC ;if (ebx & B_MINE || ebx & B_HIDDEN) mov ebx, [gameTableType + (eax*4)] and ebx, B_MINE cmp ebx, B_MINE je traverse_table_is_mine mov ebx, [gameTableType + (eax*4)] and ebx, B_HIDDEN cmp ebx, B_HIDDEN je traverse_table_not_mine traverse_table_is_mine: ret ;End if traverse_table_not_mine: ;Remove Hidden xor [gameTableType + (eax*4)], B_HIDDEN ;Increase Displayed Locations inc gameDisplayedLocs ;if(ebx != B_BLANK) mov ebx, [gameTableType + (eax*4)] and ebx, B_BLANK cmp ebx, B_BLANK je traverse_table_is_blank ret ;End if traverse_table_is_blank: ;Save Table Position push eax ;Save Y push edx ;Save X push ecx ;Look in top left ;row -1, col -1 ;if (row > 0 && col > 0) cmp ecx, 0 jle set_number_for_location_top_left_done cmp edx, 0 jle set_number_for_location_top_left_done sub ecx, 1 sub edx, 1 call get_location call traverse_table ;Restore X & Y and Position mov ecx, [esp] ;X mov edx, [esp + 4] ;Y mov eax, [esp + 8] ;Table Position set_number_for_location_top_left_done: ;Look in top center ;row -1 ;if (row > 0) cmp ecx, 0 jle set_number_for_location_top_center_done sub ecx, 1 call get_location call traverse_table ;Restore X & Y and Position mov ecx, [esp] ;X mov edx, [esp + 4] ;Y mov eax, [esp + 8] ;Table Position set_number_for_location_top_center_done: ;Look in top right ;if (row > 0 && col < (colSize - 1)) ;row - 1, col +1 cmp ecx, 0 jle set_number_for_location_top_right_done mov ebx, colSize sub ebx, 1 cmp edx, ebx jge set_number_for_location_top_right_done sub ecx, 1 add edx, 1 call get_location call traverse_table ;Restore X & Y and Position mov ecx, [esp] ;X mov edx, [esp + 4] ;Y mov eax, [esp + 8] ;Table Position set_number_for_location_top_right_done: ;Look in left ;if (col > 0) ;col - 1 cmp edx, 0 jle set_number_for_location_left_done sub edx, 1 call get_location call traverse_table ;Restore X & Y and Position mov ecx, [esp] ;X mov edx, [esp + 4] ;Y mov eax, [esp + 8] ;Table Position set_number_for_location_left_done: ;Look in right ;if (col < (colSize - 1)) ;col + 1 mov ebx, colSize sub ebx, 1 cmp edx, ebx jge set_number_for_location_right_done add edx, 1 call get_location call traverse_table ;Restore X & Y and Position mov ecx, [esp] ;X mov edx, [esp + 4] ;Y mov eax, [esp + 8] ;Table Position set_number_for_location_right_done: ;Look in botton left ;if (row < (rowSize - 1) && col > 0) ;row + 1, col -1 mov ebx, rowSize sub ebx, 1 cmp ecx, ebx jge set_number_for_location_bottom_left_done cmp edx, 0 jle set_number_for_location_bottom_left_done add ecx, 1 sub edx, 1 call get_location call traverse_table ;Restore X & Y and Position mov ecx, [esp] ;X mov edx, [esp + 4] ;Y mov eax, [esp + 8] ;Table Position set_number_for_location_bottom_left_done: ;Look in botton center ;if (row < (rowSize - 1)) ;row + 1 mov ebx, rowSize sub ebx, 1 cmp ecx, ebx jge set_number_for_location_bottom_center_done add ecx, 1 call get_location call traverse_table ;Restore X & Y and Position mov ecx, [esp] ;X mov edx, [esp + 4] ;Y mov eax, [esp + 8] ;Table Position set_number_for_location_bottom_center_done: ;Look in botton right ;if (row < (rowSize - 1) && col < (colSize - 1)) ;row + 1, col +1 mov ebx, rowSize sub ebx, 1 cmp ecx, ebx jge set_number_for_location_bottom_right_done mov ebx, colSize sub ebx, 1 cmp edx, ebx jge set_number_for_location_bottom_right_done add ecx, 1 add edx, 1 call get_location call traverse_table set_number_for_location_bottom_right_done: ;pop X & Y pop ecx pop edx ;Restore Table location pop eax ret traverse_table ENDP ; Select Position ; param <ecx>: X Position ; param <edx>: Y Position ; return <eax>: return option select_pos PROC ;Verify correct locations ;if (ecx >= rowSize || edx >= colSize) cmp ecx, rowSize jge select_pos_cont_wrong_x cmp edx, colSize jle select_pos_cont_correct_y select_pos_cont_wrong_x: ;Incorrect Size mov eax, B_INVALIDPOS ret select_pos_cont_correct_y: ;Get table location call get_location ;If is mine mov ebx, [gameTableType + (eax*4)] and ebx, B_MINE cmp ebx, B_MINE jne select_pos_end_is_mine xor [gameTableType + (eax*4)], B_HIDDEN mov eax, B_GAME_OVER ret ;End if select_pos_end_is_mine: ;Traverse the Table call traverse_table mov ebx, tableSize sub ebx, maxMines cmp ebx, gameDisplayedLocs jne select_pos_end_is_game_won ;Return Game Win mov eax, B_GAME_WIN ret select_pos_end_is_game_won: ;Return Ok mov eax, B_OK ret select_pos ENDP ; Set Mines ; No params ; no return set_mines PROC ;Set Number of mines to set mov ecx, maxMines ;Loop 1 set_mines_while: ;Save loop counter push ecx ;Get Random T push colSize call helper_random pop ecx push eax ;Get Random X push rowSize call helper_random pop ecx mov ecx, eax ;Retrieve Y pop edx ;Get table location call get_location ;Check if Table Location has mine mov edx, [gameTableType + (eax*4)] ;Retrieve loop counter pop ecx ;if (edx & B_MINE) and edx, B_MINE cmp edx, B_MINE jne set_mines_else_is_mine ;Mine has been set, continue looping inc ecx jmp set_mines_end_if_is_mine set_mines_else_is_mine: ;Set Mine to location or [gameTableType + (eax*4)], B_MINE ;End if set_mines_end_if_is_mine: loop set_mines_while ret set_mines ENDP ; Checks the table location for a mine ; if one is found increases counter ; restores X & Y to original value, they must be in the stack X on top, Y next ; param <eax>: location in the table ; param <ebx>: counter to increases ; no returns check_if_mine_inc_counter_restore_pos PROC mov edx, [gameTableType + (eax * 4)] and edx, B_MINE cmp edx, B_MINE jne set_number_for_location_top_left_no_mine inc ebx set_number_for_location_top_left_no_mine: ;Restore X & Y mov ecx, [esp + 4] ;X mov edx, [esp + 8] ;Y ret check_if_mine_inc_counter_restore_pos ENDP ; Sets the number of mines around a locations in the table ; param <eax>: location in the table ; param <ecx>: X Position ; param <edx>: Y Position ; no returns set_number_for_location PROC ;Save Table Position push eax ;Save Y push edx ;Save X push ecx ;Number counter mov ebx, 0 ;Look in top left ;row -1, col -1 ;if (row > 0 && col > 0) cmp ecx, 0 jle set_number_for_location_top_left_done cmp edx, 0 jle set_number_for_location_top_left_done sub ecx, 1 sub edx, 1 ;Get Table location call get_location call check_if_mine_inc_counter_restore_pos set_number_for_location_top_left_done: ;Look in top center ;row -1 ;if (row > 0) cmp ecx, 0 jle set_number_for_location_top_center_done sub ecx, 1 ;Get Table location call get_location call check_if_mine_inc_counter_restore_pos set_number_for_location_top_center_done: ;Look in top right ;if (row > 0 && col < (colSize - 1)) ;row - 1, col +1 cmp ecx, 0 jle set_number_for_location_top_right_done mov eax, colSize sub eax, 1 cmp edx, eax jge set_number_for_location_top_right_done sub ecx, 1 add edx, 1 ;Get Table location call get_location call check_if_mine_inc_counter_restore_pos set_number_for_location_top_right_done: ;Look in left ;if (col > 0) ;col - 1 cmp edx, 0 jle set_number_for_location_left_done sub edx, 1 ;Get Table location call get_location call check_if_mine_inc_counter_restore_pos set_number_for_location_left_done: ;Look in right ;if (col < (colSize - 1)) ;col + 1 mov eax, colSize sub eax, 1 cmp edx, eax jge set_number_for_location_right_done add edx, 1 ;Get Table location call get_location call check_if_mine_inc_counter_restore_pos set_number_for_location_right_done: ;Look in botton left ;if (row < (rowSize - 1) && col > 0) ;row + 1, col -1 mov eax, rowSize sub eax, 1 cmp ecx, eax jge set_number_for_location_bottom_left_done cmp edx, 0 jle set_number_for_location_bottom_left_done add ecx, 1 sub edx, 1 ;Get Table location call get_location call check_if_mine_inc_counter_restore_pos set_number_for_location_bottom_left_done: ;Look in botton center ;if (row < (rowSize - 1)) ;row + 1 mov eax, rowSize sub eax, 1 cmp ecx, eax jge set_number_for_location_bottom_center_done add ecx, 1 ;Get Table location call get_location call check_if_mine_inc_counter_restore_pos set_number_for_location_bottom_center_done: ;Look in botton right ;if (row < (rowSize - 1) && col < (colSize - 1)) ;row + 1, col +1 mov eax, rowSize sub eax, 1 cmp ecx, eax jge set_number_for_location_bottom_right_done mov eax, colSize sub eax, 1 cmp edx, eax jge set_number_for_location_bottom_right_done add ecx, 1 add edx, 1 ;Get Table location call get_location call check_if_mine_inc_counter_restore_pos set_number_for_location_bottom_right_done: ;pop X & Y pop ecx pop edx ;Restore Table location pop eax ; if (ebx != 0) cmp ebx, 0 je set_number_for_location_else_if_num_zero or [gameTableType + (eax*4)], B_NUMBER mov [gameTableNumbers + (eax*4)], ebx jmp set_number_for_location_end_if_num_zero ;else set_number_for_location_else_if_num_zero: or [gameTableType + (eax*4)], B_BLANK ;End if set_number_for_location_end_if_num_zero: ret set_number_for_location ENDP ; Sets the number of mines around all the locations of the table ; no params ; no returns set_numbers PROC ;Initialize table location mov eax, tableSize - 1 ;Initialize counter for Loop 1 mov ecx, rowSize ;Loop 1 set_numbers_for1: ;Save Loop 1 counter push ecx ;Get a copy of the current counter mov ebx, ecx ;Initialize counter for Loop 2 mov ecx, colSize ;Loop 2 set_numbers_for2: ;Save registers push ebx push ecx push eax ;Get which Table String to print mov edx, [gameTableType + (eax*4)] ;if(edx & B_MINE) and edx, B_MINE cmp edx, B_MINE je set_numbers_end_if_not_mine ;Set Y mov edx, ecx sub edx, 1 ;Set X mov ecx, ebx sub ecx, 1 ;Set the numberr for the location call set_number_for_location ;end if set_numbers_end_if_not_mine: ;Restore Registers pop eax pop ecx pop ebx ;Increase table location dec eax ;End Loop 2 loop set_numbers_for2 ;Restore Loop 1 counter pop ecx ;End Loop 1 loop set_numbers_for1 ret set_numbers ENDP ; Prints the character for the Location of the table ; param <eax>: Table location ; no return print_character_table_position PROC ;Get which Table String to print mov edx, [gameTableType + (eax*4)] ;switch edx ;;;;;;;;;;;;;;; ;case B_BLANK: mov ebx, edx and ebx, B_BLANK cmp ebx, B_BLANK jne p_case_mine ;Print Blank mov ecx, OFFSET strBlank call print_str jmp p_end_switch ;case B_MINE: p_case_mine: mov ebx, edx and ebx, B_MINE cmp ebx, B_MINE jne p_case_number ;Print Blank mov ecx, OFFSET strMine call print_str jmp p_end_switch ;case B_NUMBER: p_case_number: ;Print Blank mov edx, [gameTableNumbers + (eax*4)] mov ecx, OFFSET strNumber call print_str_num p_end_switch: ret print_character_table_position ENDP print_first_line PROC push ecx push eax push ebx push edx ;Print Blank mov ecx, OFFSET strTable2Blank call print_str mov ecx, rowSize mov eax, 0 print_first_line_loop: ;Save values push eax push ecx ;Print Blank Space mov ecx, OFFSET strBlank call print_str ;Restore counter mov eax, [esp + 4] ;Print Number mov ecx, OFFSET strNumberTableSepFL mov edx, eax call print_str_num ;Restore values pop ecx pop eax ;Increase counter inc eax loop print_first_line_loop ;Print end line call print_end_line pop edx pop ebx pop eax pop ecx ret print_first_line ENDP ; Print Game Table ; param <ebx>: if not zero it will ignore the hidden value ; no return print_table PROC ;Initialize table location mov eax, 0 ;Initialize counter for Loop 1 mov ecx, rowSize ;Loop 1 for1: ;Save Loop 1 counter push ecx ;copy loop 1 counter mov edx, ecx ;Initialize counter for Loop 2 mov ecx, colSize ;Loop 2 for2: ;if (x == rowSize && y == colSize) cmp edx, rowSize jne print_table_first_line_end cmp ecx, colSize jne print_table_first_line_end call print_first_line print_table_first_line_end: ;if (y == 0) cmp ecx, colSize jne print_table_first_blank_space_end push ecx push eax push ebx ;Print Number mov eax, edx mov edx, rowSize sub edx, eax mov ecx, OFFSET strNumber2Blank call print_str_num pop ebx pop eax pop ecx print_table_first_blank_space_end: ;Save registers push ebx push ecx push eax ;Get which Table String to print mov edx, [gameTableType + (eax*4)] ;if(ebx != 0 && edx & B_HIDDEN) cmp ebx, 0 jne else_hidden and edx, B_HIDDEN cmp edx, B_HIDDEN jne else_hidden ;Print Blank mov ecx, OFFSET strHidden call print_str jmp end_if_hidden ;else else_hidden: call print_character_table_position ;end if end_if_hidden: ;Print Separator mov ecx, OFFSET strTableSep call print_str ;Restore Registers pop eax pop ecx pop ebx ;Increase table location inc eax ;End Loop 2 loop for2 ;Print end line push eax push ebx call print_end_line pop ebx pop eax ;Restore Loop 1 counter pop ecx ;End Loop 1 loop for1 ret print_table ENDP ; Play Game play_asm PROC ;Init Game Table call set_mines call set_numbers ;Init ecx loop counter mov ecx, 1 while1: ;Save loop counter push ecx ;Print Table mov ebx, 0 call print_table ;Get X mov ecx, OFFSET strChooseX call print_str call read_int push eax ;Get Y mov ecx, OFFSET strChooseY call print_str call read_int mov edx, eax ;Retrieve X pop ecx ;Select Position in the table call select_pos ;Save register push eax ;clear the screen call clear_screen ;Retrieve register pop eax ;Retrieve loop counter pop ecx ;if (eax != B_GAME_OVER && eax != B_GAME_WIN) cmp eax, B_GAME_OVER je play_asm_else_game_end cmp eax, B_GAME_WIN je play_asm_else_game_end ;Increase to make loop infinite inc ecx jmp play_asm_end_if_game_end ;else play_asm_else_game_end: ;End loop mov ecx, 1 ;End if play_asm_end_if_game_end: loop while1 ;if(eax == B_GAME_WIN) cmp eax, B_GAME_WIN jne play_asm_else_game_over_msg ;Print Win Message mov ecx, OFFSET strWinMsg call print_str jmp play_asm_end_if_game_over_msg ;else play_asm_else_game_over_msg: ;Print lost Message mov ecx, OFFSET strLostMsg call print_str ;End if play_asm_end_if_game_over_msg: ;End line call print_end_line ;Print Table mov ebx, 1 call print_table ;End line call print_end_line ret play_asm ENDP END
bootstrap/nasm_x86_64_linux.asm
DimaPekutko/malanka
2
161616
; extern printf ; extern puts ; extern exit global __bootstrap global char_to_int global int_to_doub global __ARGC__ global __ARGV__ section .text __bootstrap: ; argc init mov rax, rsp add rax, 0x8 mov [__ARGC__], rax ;argv* init mov rax, rsp add rax, 0x16 mov [__ARGV__], rax ; mov rdi, [__ARGV__] ; xor rax, rax ; call printf ; call exit xor rdi, rdi xor rsi, rsi xor rax, rax xor rbx, rbx xor rcx, rcx xor rdx, rdx ret char_to_int: push rbp mov rbp, rsp mov rax, rdi add rax, '0' mov rsp, rbp pop rbp ret int_to_doub: push rbp mov rbp, rsp mov [rbp-8], rdi pxor xmm0, xmm0 cvtsi2sd xmm0, [rbp-8] movq rax, xmm0 mov rsp, rbp pop rbp ret section .data s db "args count %d", 0xa, 0 __ARGC__ dq 0 __ARGV__ dq 0
scr/zotpick-pandoc.applescript
alexandergogl/zotpick-osx_services
0
2335
<reponame>alexandergogl/zotpick-osx_services<filename>scr/zotpick-pandoc.applescript tell application "System Events" try set appName to (the name of every process whose frontmost is true) as string on error errMsg display alert "Problem" message "Could not get the name of the frontmost application." error number -128 end try end tell set zotRunning to do shell script "/usr/bin/curl 'http://localhost:23119/better-bibtex/cayw?probe=probe' 2>/dev/null; exit 0" if zotRunning is "" then display alert "Zotero not running" message "This script will not work unless Zotero is running. Please launch Zotero and try again" tell application appName activate end tell error number -128 else if zotRunning is "No endpoint found" then display alert "Better BibTeX not installed" message "This script will not work unless Better BibTeX is installed. Please make sure that Better BibTeX is installed in the running instance of Zotero" tell application appName activate end tell error number -128 else if zotRunning is "ready" then set theReference to do shell script "/usr/bin/curl 'http://localhost:23119/better-bibtex/cayw?format=pandoc' 2>/dev/null; exit 0" try repeat until application appName is frontmost tell application appName to activate end repeat on error errMsg display alert errMsg end try tell application "System Events" try keystroke theReference on error errMsg display alert errMsg end try end tell end if
oeis/134/A134226.asm
neoneye/loda-programs
11
164213
; A134226: Triangle T(n, k) = 3*n - 4 if k = n-1 otherwise k, read by rows. ; Submitted by <NAME> ; 1,2,2,1,5,3,1,2,8,4,1,2,3,11,5,1,2,3,4,14,6,1,2,3,4,5,17,7,1,2,3,4,5,6,20,8,1,2,3,4,5,6,7,23,9,1,2,3,4,5,6,7,8,26,10,1,2,3,4,5,6,7,8,9,29,11,1,2,3,4,5,6,7,8,9,10,32,12,1,2,3,4,5,6,7,8,9,10,11,35,13,1,2,3,4,5,6,7,8,9 lpb $0 add $1,$2 add $2,1 sub $0,$2 cmp $1,$0 mul $1,$2 lpe mul $1,2 trn $1,1 add $1,$0 mov $0,$1 add $0,1
test3.asm
ray5273/os_project4
0
247748
_test3: file format elf32-i386 Disassembly of section .text: 00000000 <thread>: void *stack[NTHREAD]; int tid[NTHREAD]; void *retval[NTHREAD]; void *thread(void *arg){ 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 83 ec 08 sub $0x8,%esp thread_exit(arg); 6: 83 ec 0c sub $0xc,%esp 9: ff 75 08 pushl 0x8(%ebp) c: e8 08 06 00 00 call 619 <thread_exit> 00000011 <thread2>: } void *thread2(void *arg){ 11: 55 push %ebp 12: 89 e5 mov %esp,%ebp 14: 83 ec 08 sub $0x8,%esp printf(1, "OK\n"); 17: 83 ec 08 sub $0x8,%esp 1a: 68 c6 0a 00 00 push $0xac6 1f: 6a 01 push $0x1 21: e8 ea 06 00 00 call 710 <printf> 26: 83 c4 10 add $0x10,%esp exit(); 29: e8 3b 05 00 00 call 569 <exit> 0000002e <main>: } int main(int argc, char **argv) { 2e: 8d 4c 24 04 lea 0x4(%esp),%ecx 32: 83 e4 f0 and $0xfffffff0,%esp 35: ff 71 fc pushl -0x4(%ecx) 38: 55 push %ebp 39: 89 e5 mov %esp,%ebp 3b: 51 push %ecx 3c: 83 ec 14 sub $0x14,%esp int i; int j; printf(1, "TEST3: "); 3f: 83 ec 08 sub $0x8,%esp 42: 68 ca 0a 00 00 push $0xaca 47: 6a 01 push $0x1 49: e8 c2 06 00 00 call 710 <printf> 4e: 83 c4 10 add $0x10,%esp // exit(); for(i=0;i<NTHREAD;i++) 51: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 58: eb 20 jmp 7a <main+0x4c> stack[i] = malloc(4096); 5a: 83 ec 0c sub $0xc,%esp 5d: 68 00 10 00 00 push $0x1000 62: e8 7c 09 00 00 call 9e3 <malloc> 67: 83 c4 10 add $0x10,%esp 6a: 89 c2 mov %eax,%edx 6c: 8b 45 f4 mov -0xc(%ebp),%eax 6f: 89 14 85 00 0e 00 00 mov %edx,0xe00(,%eax,4) int i; int j; printf(1, "TEST3: "); // exit(); for(i=0;i<NTHREAD;i++) 76: 83 45 f4 01 addl $0x1,-0xc(%ebp) 7a: 83 7d f4 07 cmpl $0x7,-0xc(%ebp) 7e: 7e da jle 5a <main+0x2c> stack[i] = malloc(4096); for(i=0;i<100;i++){ 80: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 87: e9 df 00 00 00 jmp 16b <main+0x13d> for(j=0;j<NTHREAD-1;j++){ 8c: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 93: eb 54 jmp e9 <main+0xbb> tid[j] = thread_create(thread, 30, (void *)j, stack[j]); 95: 8b 45 f0 mov -0x10(%ebp),%eax 98: 8b 14 85 00 0e 00 00 mov 0xe00(,%eax,4),%edx 9f: 8b 45 f0 mov -0x10(%ebp),%eax a2: 52 push %edx a3: 50 push %eax a4: 6a 1e push $0x1e a6: 68 00 00 00 00 push $0x0 ab: e8 61 05 00 00 call 611 <thread_create> b0: 83 c4 10 add $0x10,%esp b3: 89 c2 mov %eax,%edx b5: 8b 45 f0 mov -0x10(%ebp),%eax b8: 89 14 85 20 0e 00 00 mov %edx,0xe20(,%eax,4) if(tid[j] == -1){ bf: 8b 45 f0 mov -0x10(%ebp),%eax c2: 8b 04 85 20 0e 00 00 mov 0xe20(,%eax,4),%eax c9: 83 f8 ff cmp $0xffffffff,%eax cc: 75 17 jne e5 <main+0xb7> printf(1, "ONE WRONG\n"); ce: 83 ec 08 sub $0x8,%esp d1: 68 d2 0a 00 00 push $0xad2 d6: 6a 01 push $0x1 d8: e8 33 06 00 00 call 710 <printf> dd: 83 c4 10 add $0x10,%esp exit(); e0: e8 84 04 00 00 call 569 <exit> // exit(); for(i=0;i<NTHREAD;i++) stack[i] = malloc(4096); for(i=0;i<100;i++){ for(j=0;j<NTHREAD-1;j++){ e5: 83 45 f0 01 addl $0x1,-0x10(%ebp) e9: 83 7d f0 06 cmpl $0x6,-0x10(%ebp) ed: 7e a6 jle 95 <main+0x67> if(tid[j] == -1){ printf(1, "ONE WRONG\n"); exit(); } } for(j=0;j<NTHREAD-1;j++){ ef: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) f6: eb 69 jmp 161 <main+0x133> if(thread_join(tid[j], &retval[j]) == -1){ f8: 8b 45 f0 mov -0x10(%ebp),%eax fb: c1 e0 02 shl $0x2,%eax fe: 8d 90 40 0e 00 00 lea 0xe40(%eax),%edx 104: 8b 45 f0 mov -0x10(%ebp),%eax 107: 8b 04 85 20 0e 00 00 mov 0xe20(,%eax,4),%eax 10e: 83 ec 08 sub $0x8,%esp 111: 52 push %edx 112: 50 push %eax 113: e8 09 05 00 00 call 621 <thread_join> 118: 83 c4 10 add $0x10,%esp 11b: 83 f8 ff cmp $0xffffffff,%eax 11e: 75 17 jne 137 <main+0x109> printf(1, "TWO WRONG\n"); 120: 83 ec 08 sub $0x8,%esp 123: 68 dd 0a 00 00 push $0xadd 128: 6a 01 push $0x1 12a: e8 e1 05 00 00 call 710 <printf> 12f: 83 c4 10 add $0x10,%esp exit(); 132: e8 32 04 00 00 call 569 <exit> } if((int)retval[j] != j){ 137: 8b 45 f0 mov -0x10(%ebp),%eax 13a: 8b 04 85 40 0e 00 00 mov 0xe40(,%eax,4),%eax 141: 3b 45 f0 cmp -0x10(%ebp),%eax 144: 74 17 je 15d <main+0x12f> printf(1, "THREE WRONG\n"); 146: 83 ec 08 sub $0x8,%esp 149: 68 e8 0a 00 00 push $0xae8 14e: 6a 01 push $0x1 150: e8 bb 05 00 00 call 710 <printf> 155: 83 c4 10 add $0x10,%esp exit(); 158: e8 0c 04 00 00 call 569 <exit> if(tid[j] == -1){ printf(1, "ONE WRONG\n"); exit(); } } for(j=0;j<NTHREAD-1;j++){ 15d: 83 45 f0 01 addl $0x1,-0x10(%ebp) 161: 83 7d f0 06 cmpl $0x6,-0x10(%ebp) 165: 7e 91 jle f8 <main+0xca> printf(1, "TEST3: "); // exit(); for(i=0;i<NTHREAD;i++) stack[i] = malloc(4096); for(i=0;i<100;i++){ 167: 83 45 f4 01 addl $0x1,-0xc(%ebp) 16b: 83 7d f4 63 cmpl $0x63,-0xc(%ebp) 16f: 0f 8e 17 ff ff ff jle 8c <main+0x5e> } } } for(i=0;i<NTHREAD-1;i++){ 175: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 17c: eb 52 jmp 1d0 <main+0x1a2> tid[i] = thread_create(thread, 30, 0, stack[i]); 17e: 8b 45 f4 mov -0xc(%ebp),%eax 181: 8b 04 85 00 0e 00 00 mov 0xe00(,%eax,4),%eax 188: 50 push %eax 189: 6a 00 push $0x0 18b: 6a 1e push $0x1e 18d: 68 00 00 00 00 push $0x0 192: e8 7a 04 00 00 call 611 <thread_create> 197: 83 c4 10 add $0x10,%esp 19a: 89 c2 mov %eax,%edx 19c: 8b 45 f4 mov -0xc(%ebp),%eax 19f: 89 14 85 20 0e 00 00 mov %edx,0xe20(,%eax,4) if(tid[i] == -1){ 1a6: 8b 45 f4 mov -0xc(%ebp),%eax 1a9: 8b 04 85 20 0e 00 00 mov 0xe20(,%eax,4),%eax 1b0: 83 f8 ff cmp $0xffffffff,%eax 1b3: 75 17 jne 1cc <main+0x19e> printf(1, " FOURWRONG\n"); 1b5: 83 ec 08 sub $0x8,%esp 1b8: 68 f5 0a 00 00 push $0xaf5 1bd: 6a 01 push $0x1 1bf: e8 4c 05 00 00 call 710 <printf> 1c4: 83 c4 10 add $0x10,%esp exit(); 1c7: e8 9d 03 00 00 call 569 <exit> } } } for(i=0;i<NTHREAD-1;i++){ 1cc: 83 45 f4 01 addl $0x1,-0xc(%ebp) 1d0: 83 7d f4 06 cmpl $0x6,-0xc(%ebp) 1d4: 7e a8 jle 17e <main+0x150> printf(1, " FOURWRONG\n"); exit(); } } if(thread_create(thread, 30, 0, stack[NTHREAD-1]) != -1){ 1d6: a1 1c 0e 00 00 mov 0xe1c,%eax 1db: 50 push %eax 1dc: 6a 00 push $0x0 1de: 6a 1e push $0x1e 1e0: 68 00 00 00 00 push $0x0 1e5: e8 27 04 00 00 call 611 <thread_create> 1ea: 83 c4 10 add $0x10,%esp 1ed: 83 f8 ff cmp $0xffffffff,%eax 1f0: 74 17 je 209 <main+0x1db> printf(1, "FIVEWRONG\n"); 1f2: 83 ec 08 sub $0x8,%esp 1f5: 68 01 0b 00 00 push $0xb01 1fa: 6a 01 push $0x1 1fc: e8 0f 05 00 00 call 710 <printf> 201: 83 c4 10 add $0x10,%esp exit(); 204: e8 60 03 00 00 call 569 <exit> } for(i=0;i<NTHREAD-1;i++){ 209: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 210: eb 43 jmp 255 <main+0x227> if(thread_join(tid[i], &retval[i]) == -1){ 212: 8b 45 f4 mov -0xc(%ebp),%eax 215: c1 e0 02 shl $0x2,%eax 218: 8d 90 40 0e 00 00 lea 0xe40(%eax),%edx 21e: 8b 45 f4 mov -0xc(%ebp),%eax 221: 8b 04 85 20 0e 00 00 mov 0xe20(,%eax,4),%eax 228: 83 ec 08 sub $0x8,%esp 22b: 52 push %edx 22c: 50 push %eax 22d: e8 ef 03 00 00 call 621 <thread_join> 232: 83 c4 10 add $0x10,%esp 235: 83 f8 ff cmp $0xffffffff,%eax 238: 75 17 jne 251 <main+0x223> printf(1, "SIXWRONG\n"); 23a: 83 ec 08 sub $0x8,%esp 23d: 68 0c 0b 00 00 push $0xb0c 242: 6a 01 push $0x1 244: e8 c7 04 00 00 call 710 <printf> 249: 83 c4 10 add $0x10,%esp exit(); 24c: e8 18 03 00 00 call 569 <exit> if(thread_create(thread, 30, 0, stack[NTHREAD-1]) != -1){ printf(1, "FIVEWRONG\n"); exit(); } for(i=0;i<NTHREAD-1;i++){ 251: 83 45 f4 01 addl $0x1,-0xc(%ebp) 255: 83 7d f4 06 cmpl $0x6,-0xc(%ebp) 259: 7e b7 jle 212 <main+0x1e4> printf(1, "SIXWRONG\n"); exit(); } } for(i=0;i<NTHREAD-1;i++){ 25b: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 262: eb 52 jmp 2b6 <main+0x288> tid[i] = thread_create(thread2, 30, 0, stack[i]); 264: 8b 45 f4 mov -0xc(%ebp),%eax 267: 8b 04 85 00 0e 00 00 mov 0xe00(,%eax,4),%eax 26e: 50 push %eax 26f: 6a 00 push $0x0 271: 6a 1e push $0x1e 273: 68 11 00 00 00 push $0x11 278: e8 94 03 00 00 call 611 <thread_create> 27d: 83 c4 10 add $0x10,%esp 280: 89 c2 mov %eax,%edx 282: 8b 45 f4 mov -0xc(%ebp),%eax 285: 89 14 85 20 0e 00 00 mov %edx,0xe20(,%eax,4) if(tid[i] == -1){ 28c: 8b 45 f4 mov -0xc(%ebp),%eax 28f: 8b 04 85 20 0e 00 00 mov 0xe20(,%eax,4),%eax 296: 83 f8 ff cmp $0xffffffff,%eax 299: 75 17 jne 2b2 <main+0x284> printf(1, "SEVENWRONG\n"); 29b: 83 ec 08 sub $0x8,%esp 29e: 68 16 0b 00 00 push $0xb16 2a3: 6a 01 push $0x1 2a5: e8 66 04 00 00 call 710 <printf> 2aa: 83 c4 10 add $0x10,%esp exit(); 2ad: e8 b7 02 00 00 call 569 <exit> printf(1, "SIXWRONG\n"); exit(); } } for(i=0;i<NTHREAD-1;i++){ 2b2: 83 45 f4 01 addl $0x1,-0xc(%ebp) 2b6: 83 7d f4 06 cmpl $0x6,-0xc(%ebp) 2ba: 7e a8 jle 264 <main+0x236> printf(1, "SEVENWRONG\n"); exit(); } } thread_join(tid[0], &retval[0]); 2bc: a1 20 0e 00 00 mov 0xe20,%eax 2c1: 83 ec 08 sub $0x8,%esp 2c4: 68 40 0e 00 00 push $0xe40 2c9: 50 push %eax 2ca: e8 52 03 00 00 call 621 <thread_join> 2cf: 83 c4 10 add $0x10,%esp for(i=0;i<NTHREAD;i++) 2d2: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 2d9: eb 1a jmp 2f5 <main+0x2c7> free(stack[i]); 2db: 8b 45 f4 mov -0xc(%ebp),%eax 2de: 8b 04 85 00 0e 00 00 mov 0xe00(,%eax,4),%eax 2e5: 83 ec 0c sub $0xc,%esp 2e8: 50 push %eax 2e9: e8 b3 05 00 00 call 8a1 <free> 2ee: 83 c4 10 add $0x10,%esp } } thread_join(tid[0], &retval[0]); for(i=0;i<NTHREAD;i++) 2f1: 83 45 f4 01 addl $0x1,-0xc(%ebp) 2f5: 83 7d f4 07 cmpl $0x7,-0xc(%ebp) 2f9: 7e e0 jle 2db <main+0x2ad> free(stack[i]); printf(1, "WRONG\n"); 2fb: 83 ec 08 sub $0x8,%esp 2fe: 68 22 0b 00 00 push $0xb22 303: 6a 01 push $0x1 305: e8 06 04 00 00 call 710 <printf> 30a: 83 c4 10 add $0x10,%esp exit(); 30d: e8 57 02 00 00 call 569 <exit> 00000312 <stosb>: "cc"); } static inline void stosb(void *addr, int data, int cnt) { 312: 55 push %ebp 313: 89 e5 mov %esp,%ebp 315: 57 push %edi 316: 53 push %ebx asm volatile("cld; rep stosb" : 317: 8b 4d 08 mov 0x8(%ebp),%ecx 31a: 8b 55 10 mov 0x10(%ebp),%edx 31d: 8b 45 0c mov 0xc(%ebp),%eax 320: 89 cb mov %ecx,%ebx 322: 89 df mov %ebx,%edi 324: 89 d1 mov %edx,%ecx 326: fc cld 327: f3 aa rep stos %al,%es:(%edi) 329: 89 ca mov %ecx,%edx 32b: 89 fb mov %edi,%ebx 32d: 89 5d 08 mov %ebx,0x8(%ebp) 330: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 333: 90 nop 334: 5b pop %ebx 335: 5f pop %edi 336: 5d pop %ebp 337: c3 ret 00000338 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 338: 55 push %ebp 339: 89 e5 mov %esp,%ebp 33b: 83 ec 10 sub $0x10,%esp char *os; os = s; 33e: 8b 45 08 mov 0x8(%ebp),%eax 341: 89 45 fc mov %eax,-0x4(%ebp) while((*s++ = *t++) != 0) 344: 90 nop 345: 8b 45 08 mov 0x8(%ebp),%eax 348: 8d 50 01 lea 0x1(%eax),%edx 34b: 89 55 08 mov %edx,0x8(%ebp) 34e: 8b 55 0c mov 0xc(%ebp),%edx 351: 8d 4a 01 lea 0x1(%edx),%ecx 354: 89 4d 0c mov %ecx,0xc(%ebp) 357: 0f b6 12 movzbl (%edx),%edx 35a: 88 10 mov %dl,(%eax) 35c: 0f b6 00 movzbl (%eax),%eax 35f: 84 c0 test %al,%al 361: 75 e2 jne 345 <strcpy+0xd> ; return os; 363: 8b 45 fc mov -0x4(%ebp),%eax } 366: c9 leave 367: c3 ret 00000368 <strcmp>: int strcmp(const char *p, const char *q) { 368: 55 push %ebp 369: 89 e5 mov %esp,%ebp while(*p && *p == *q) 36b: eb 08 jmp 375 <strcmp+0xd> p++, q++; 36d: 83 45 08 01 addl $0x1,0x8(%ebp) 371: 83 45 0c 01 addl $0x1,0xc(%ebp) } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 375: 8b 45 08 mov 0x8(%ebp),%eax 378: 0f b6 00 movzbl (%eax),%eax 37b: 84 c0 test %al,%al 37d: 74 10 je 38f <strcmp+0x27> 37f: 8b 45 08 mov 0x8(%ebp),%eax 382: 0f b6 10 movzbl (%eax),%edx 385: 8b 45 0c mov 0xc(%ebp),%eax 388: 0f b6 00 movzbl (%eax),%eax 38b: 38 c2 cmp %al,%dl 38d: 74 de je 36d <strcmp+0x5> p++, q++; return (uchar)*p - (uchar)*q; 38f: 8b 45 08 mov 0x8(%ebp),%eax 392: 0f b6 00 movzbl (%eax),%eax 395: 0f b6 d0 movzbl %al,%edx 398: 8b 45 0c mov 0xc(%ebp),%eax 39b: 0f b6 00 movzbl (%eax),%eax 39e: 0f b6 c0 movzbl %al,%eax 3a1: 29 c2 sub %eax,%edx 3a3: 89 d0 mov %edx,%eax } 3a5: 5d pop %ebp 3a6: c3 ret 000003a7 <strlen>: uint strlen(char *s) { 3a7: 55 push %ebp 3a8: 89 e5 mov %esp,%ebp 3aa: 83 ec 10 sub $0x10,%esp int n; for(n = 0; s[n]; n++) 3ad: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 3b4: eb 04 jmp 3ba <strlen+0x13> 3b6: 83 45 fc 01 addl $0x1,-0x4(%ebp) 3ba: 8b 55 fc mov -0x4(%ebp),%edx 3bd: 8b 45 08 mov 0x8(%ebp),%eax 3c0: 01 d0 add %edx,%eax 3c2: 0f b6 00 movzbl (%eax),%eax 3c5: 84 c0 test %al,%al 3c7: 75 ed jne 3b6 <strlen+0xf> ; return n; 3c9: 8b 45 fc mov -0x4(%ebp),%eax } 3cc: c9 leave 3cd: c3 ret 000003ce <memset>: void* memset(void *dst, int c, uint n) { 3ce: 55 push %ebp 3cf: 89 e5 mov %esp,%ebp stosb(dst, c, n); 3d1: 8b 45 10 mov 0x10(%ebp),%eax 3d4: 50 push %eax 3d5: ff 75 0c pushl 0xc(%ebp) 3d8: ff 75 08 pushl 0x8(%ebp) 3db: e8 32 ff ff ff call 312 <stosb> 3e0: 83 c4 0c add $0xc,%esp return dst; 3e3: 8b 45 08 mov 0x8(%ebp),%eax } 3e6: c9 leave 3e7: c3 ret 000003e8 <strchr>: char* strchr(const char *s, char c) { 3e8: 55 push %ebp 3e9: 89 e5 mov %esp,%ebp 3eb: 83 ec 04 sub $0x4,%esp 3ee: 8b 45 0c mov 0xc(%ebp),%eax 3f1: 88 45 fc mov %al,-0x4(%ebp) for(; *s; s++) 3f4: eb 14 jmp 40a <strchr+0x22> if(*s == c) 3f6: 8b 45 08 mov 0x8(%ebp),%eax 3f9: 0f b6 00 movzbl (%eax),%eax 3fc: 3a 45 fc cmp -0x4(%ebp),%al 3ff: 75 05 jne 406 <strchr+0x1e> return (char*)s; 401: 8b 45 08 mov 0x8(%ebp),%eax 404: eb 13 jmp 419 <strchr+0x31> } char* strchr(const char *s, char c) { for(; *s; s++) 406: 83 45 08 01 addl $0x1,0x8(%ebp) 40a: 8b 45 08 mov 0x8(%ebp),%eax 40d: 0f b6 00 movzbl (%eax),%eax 410: 84 c0 test %al,%al 412: 75 e2 jne 3f6 <strchr+0xe> if(*s == c) return (char*)s; return 0; 414: b8 00 00 00 00 mov $0x0,%eax } 419: c9 leave 41a: c3 ret 0000041b <gets>: char* gets(char *buf, int max) { 41b: 55 push %ebp 41c: 89 e5 mov %esp,%ebp 41e: 83 ec 18 sub $0x18,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 421: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 428: eb 42 jmp 46c <gets+0x51> cc = read(0, &c, 1); 42a: 83 ec 04 sub $0x4,%esp 42d: 6a 01 push $0x1 42f: 8d 45 ef lea -0x11(%ebp),%eax 432: 50 push %eax 433: 6a 00 push $0x0 435: e8 47 01 00 00 call 581 <read> 43a: 83 c4 10 add $0x10,%esp 43d: 89 45 f0 mov %eax,-0x10(%ebp) if(cc < 1) 440: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 444: 7e 33 jle 479 <gets+0x5e> break; buf[i++] = c; 446: 8b 45 f4 mov -0xc(%ebp),%eax 449: 8d 50 01 lea 0x1(%eax),%edx 44c: 89 55 f4 mov %edx,-0xc(%ebp) 44f: 89 c2 mov %eax,%edx 451: 8b 45 08 mov 0x8(%ebp),%eax 454: 01 c2 add %eax,%edx 456: 0f b6 45 ef movzbl -0x11(%ebp),%eax 45a: 88 02 mov %al,(%edx) if(c == '\n' || c == '\r') 45c: 0f b6 45 ef movzbl -0x11(%ebp),%eax 460: 3c 0a cmp $0xa,%al 462: 74 16 je 47a <gets+0x5f> 464: 0f b6 45 ef movzbl -0x11(%ebp),%eax 468: 3c 0d cmp $0xd,%al 46a: 74 0e je 47a <gets+0x5f> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 46c: 8b 45 f4 mov -0xc(%ebp),%eax 46f: 83 c0 01 add $0x1,%eax 472: 3b 45 0c cmp 0xc(%ebp),%eax 475: 7c b3 jl 42a <gets+0xf> 477: eb 01 jmp 47a <gets+0x5f> cc = read(0, &c, 1); if(cc < 1) break; 479: 90 nop buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 47a: 8b 55 f4 mov -0xc(%ebp),%edx 47d: 8b 45 08 mov 0x8(%ebp),%eax 480: 01 d0 add %edx,%eax 482: c6 00 00 movb $0x0,(%eax) return buf; 485: 8b 45 08 mov 0x8(%ebp),%eax } 488: c9 leave 489: c3 ret 0000048a <stat>: int stat(char *n, struct stat *st) { 48a: 55 push %ebp 48b: 89 e5 mov %esp,%ebp 48d: 83 ec 18 sub $0x18,%esp int fd; int r; fd = open(n, O_RDONLY); 490: 83 ec 08 sub $0x8,%esp 493: 6a 00 push $0x0 495: ff 75 08 pushl 0x8(%ebp) 498: e8 0c 01 00 00 call 5a9 <open> 49d: 83 c4 10 add $0x10,%esp 4a0: 89 45 f4 mov %eax,-0xc(%ebp) if(fd < 0) 4a3: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 4a7: 79 07 jns 4b0 <stat+0x26> return -1; 4a9: b8 ff ff ff ff mov $0xffffffff,%eax 4ae: eb 25 jmp 4d5 <stat+0x4b> r = fstat(fd, st); 4b0: 83 ec 08 sub $0x8,%esp 4b3: ff 75 0c pushl 0xc(%ebp) 4b6: ff 75 f4 pushl -0xc(%ebp) 4b9: e8 03 01 00 00 call 5c1 <fstat> 4be: 83 c4 10 add $0x10,%esp 4c1: 89 45 f0 mov %eax,-0x10(%ebp) close(fd); 4c4: 83 ec 0c sub $0xc,%esp 4c7: ff 75 f4 pushl -0xc(%ebp) 4ca: e8 c2 00 00 00 call 591 <close> 4cf: 83 c4 10 add $0x10,%esp return r; 4d2: 8b 45 f0 mov -0x10(%ebp),%eax } 4d5: c9 leave 4d6: c3 ret 000004d7 <atoi>: int atoi(const char *s) { 4d7: 55 push %ebp 4d8: 89 e5 mov %esp,%ebp 4da: 83 ec 10 sub $0x10,%esp int n; n = 0; 4dd: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) while('0' <= *s && *s <= '9') 4e4: eb 25 jmp 50b <atoi+0x34> n = n*10 + *s++ - '0'; 4e6: 8b 55 fc mov -0x4(%ebp),%edx 4e9: 89 d0 mov %edx,%eax 4eb: c1 e0 02 shl $0x2,%eax 4ee: 01 d0 add %edx,%eax 4f0: 01 c0 add %eax,%eax 4f2: 89 c1 mov %eax,%ecx 4f4: 8b 45 08 mov 0x8(%ebp),%eax 4f7: 8d 50 01 lea 0x1(%eax),%edx 4fa: 89 55 08 mov %edx,0x8(%ebp) 4fd: 0f b6 00 movzbl (%eax),%eax 500: 0f be c0 movsbl %al,%eax 503: 01 c8 add %ecx,%eax 505: 83 e8 30 sub $0x30,%eax 508: 89 45 fc mov %eax,-0x4(%ebp) atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 50b: 8b 45 08 mov 0x8(%ebp),%eax 50e: 0f b6 00 movzbl (%eax),%eax 511: 3c 2f cmp $0x2f,%al 513: 7e 0a jle 51f <atoi+0x48> 515: 8b 45 08 mov 0x8(%ebp),%eax 518: 0f b6 00 movzbl (%eax),%eax 51b: 3c 39 cmp $0x39,%al 51d: 7e c7 jle 4e6 <atoi+0xf> n = n*10 + *s++ - '0'; return n; 51f: 8b 45 fc mov -0x4(%ebp),%eax } 522: c9 leave 523: c3 ret 00000524 <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 524: 55 push %ebp 525: 89 e5 mov %esp,%ebp 527: 83 ec 10 sub $0x10,%esp char *dst, *src; dst = vdst; 52a: 8b 45 08 mov 0x8(%ebp),%eax 52d: 89 45 fc mov %eax,-0x4(%ebp) src = vsrc; 530: 8b 45 0c mov 0xc(%ebp),%eax 533: 89 45 f8 mov %eax,-0x8(%ebp) while(n-- > 0) 536: eb 17 jmp 54f <memmove+0x2b> *dst++ = *src++; 538: 8b 45 fc mov -0x4(%ebp),%eax 53b: 8d 50 01 lea 0x1(%eax),%edx 53e: 89 55 fc mov %edx,-0x4(%ebp) 541: 8b 55 f8 mov -0x8(%ebp),%edx 544: 8d 4a 01 lea 0x1(%edx),%ecx 547: 89 4d f8 mov %ecx,-0x8(%ebp) 54a: 0f b6 12 movzbl (%edx),%edx 54d: 88 10 mov %dl,(%eax) { char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 54f: 8b 45 10 mov 0x10(%ebp),%eax 552: 8d 50 ff lea -0x1(%eax),%edx 555: 89 55 10 mov %edx,0x10(%ebp) 558: 85 c0 test %eax,%eax 55a: 7f dc jg 538 <memmove+0x14> *dst++ = *src++; return vdst; 55c: 8b 45 08 mov 0x8(%ebp),%eax } 55f: c9 leave 560: c3 ret 00000561 <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 561: b8 01 00 00 00 mov $0x1,%eax 566: cd 40 int $0x40 568: c3 ret 00000569 <exit>: SYSCALL(exit) 569: b8 02 00 00 00 mov $0x2,%eax 56e: cd 40 int $0x40 570: c3 ret 00000571 <wait>: SYSCALL(wait) 571: b8 03 00 00 00 mov $0x3,%eax 576: cd 40 int $0x40 578: c3 ret 00000579 <pipe>: SYSCALL(pipe) 579: b8 04 00 00 00 mov $0x4,%eax 57e: cd 40 int $0x40 580: c3 ret 00000581 <read>: SYSCALL(read) 581: b8 05 00 00 00 mov $0x5,%eax 586: cd 40 int $0x40 588: c3 ret 00000589 <write>: SYSCALL(write) 589: b8 10 00 00 00 mov $0x10,%eax 58e: cd 40 int $0x40 590: c3 ret 00000591 <close>: SYSCALL(close) 591: b8 15 00 00 00 mov $0x15,%eax 596: cd 40 int $0x40 598: c3 ret 00000599 <kill>: SYSCALL(kill) 599: b8 06 00 00 00 mov $0x6,%eax 59e: cd 40 int $0x40 5a0: c3 ret 000005a1 <exec>: SYSCALL(exec) 5a1: b8 07 00 00 00 mov $0x7,%eax 5a6: cd 40 int $0x40 5a8: c3 ret 000005a9 <open>: SYSCALL(open) 5a9: b8 0f 00 00 00 mov $0xf,%eax 5ae: cd 40 int $0x40 5b0: c3 ret 000005b1 <mknod>: SYSCALL(mknod) 5b1: b8 11 00 00 00 mov $0x11,%eax 5b6: cd 40 int $0x40 5b8: c3 ret 000005b9 <unlink>: SYSCALL(unlink) 5b9: b8 12 00 00 00 mov $0x12,%eax 5be: cd 40 int $0x40 5c0: c3 ret 000005c1 <fstat>: SYSCALL(fstat) 5c1: b8 08 00 00 00 mov $0x8,%eax 5c6: cd 40 int $0x40 5c8: c3 ret 000005c9 <link>: SYSCALL(link) 5c9: b8 13 00 00 00 mov $0x13,%eax 5ce: cd 40 int $0x40 5d0: c3 ret 000005d1 <mkdir>: SYSCALL(mkdir) 5d1: b8 14 00 00 00 mov $0x14,%eax 5d6: cd 40 int $0x40 5d8: c3 ret 000005d9 <chdir>: SYSCALL(chdir) 5d9: b8 09 00 00 00 mov $0x9,%eax 5de: cd 40 int $0x40 5e0: c3 ret 000005e1 <dup>: SYSCALL(dup) 5e1: b8 0a 00 00 00 mov $0xa,%eax 5e6: cd 40 int $0x40 5e8: c3 ret 000005e9 <getpid>: SYSCALL(getpid) 5e9: b8 0b 00 00 00 mov $0xb,%eax 5ee: cd 40 int $0x40 5f0: c3 ret 000005f1 <sbrk>: SYSCALL(sbrk) 5f1: b8 0c 00 00 00 mov $0xc,%eax 5f6: cd 40 int $0x40 5f8: c3 ret 000005f9 <sleep>: SYSCALL(sleep) 5f9: b8 0d 00 00 00 mov $0xd,%eax 5fe: cd 40 int $0x40 600: c3 ret 00000601 <uptime>: SYSCALL(uptime) 601: b8 0e 00 00 00 mov $0xe,%eax 606: cd 40 int $0x40 608: c3 ret 00000609 <halt>: SYSCALL(halt) 609: b8 16 00 00 00 mov $0x16,%eax 60e: cd 40 int $0x40 610: c3 ret 00000611 <thread_create>: SYSCALL(thread_create) 611: b8 17 00 00 00 mov $0x17,%eax 616: cd 40 int $0x40 618: c3 ret 00000619 <thread_exit>: SYSCALL(thread_exit) 619: b8 18 00 00 00 mov $0x18,%eax 61e: cd 40 int $0x40 620: c3 ret 00000621 <thread_join>: SYSCALL(thread_join) 621: b8 19 00 00 00 mov $0x19,%eax 626: cd 40 int $0x40 628: c3 ret 00000629 <gettid>: SYSCALL(gettid) 629: b8 1a 00 00 00 mov $0x1a,%eax 62e: cd 40 int $0x40 630: c3 ret 00000631 <clone>: SYSCALL(clone) 631: b8 1b 00 00 00 mov $0x1b,%eax 636: cd 40 int $0x40 638: c3 ret 00000639 <putc>: #include "stat.h" #include "user.h" static void putc(int fd, char c) { 639: 55 push %ebp 63a: 89 e5 mov %esp,%ebp 63c: 83 ec 18 sub $0x18,%esp 63f: 8b 45 0c mov 0xc(%ebp),%eax 642: 88 45 f4 mov %al,-0xc(%ebp) write(fd, &c, 1); 645: 83 ec 04 sub $0x4,%esp 648: 6a 01 push $0x1 64a: 8d 45 f4 lea -0xc(%ebp),%eax 64d: 50 push %eax 64e: ff 75 08 pushl 0x8(%ebp) 651: e8 33 ff ff ff call 589 <write> 656: 83 c4 10 add $0x10,%esp } 659: 90 nop 65a: c9 leave 65b: c3 ret 0000065c <printint>: static void printint(int fd, int xx, int base, int sgn) { 65c: 55 push %ebp 65d: 89 e5 mov %esp,%ebp 65f: 53 push %ebx 660: 83 ec 24 sub $0x24,%esp static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 663: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) if(sgn && xx < 0){ 66a: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 66e: 74 17 je 687 <printint+0x2b> 670: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 674: 79 11 jns 687 <printint+0x2b> neg = 1; 676: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) x = -xx; 67d: 8b 45 0c mov 0xc(%ebp),%eax 680: f7 d8 neg %eax 682: 89 45 ec mov %eax,-0x14(%ebp) 685: eb 06 jmp 68d <printint+0x31> } else { x = xx; 687: 8b 45 0c mov 0xc(%ebp),%eax 68a: 89 45 ec mov %eax,-0x14(%ebp) } i = 0; 68d: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) do{ buf[i++] = digits[x % base]; 694: 8b 4d f4 mov -0xc(%ebp),%ecx 697: 8d 41 01 lea 0x1(%ecx),%eax 69a: 89 45 f4 mov %eax,-0xc(%ebp) 69d: 8b 5d 10 mov 0x10(%ebp),%ebx 6a0: 8b 45 ec mov -0x14(%ebp),%eax 6a3: ba 00 00 00 00 mov $0x0,%edx 6a8: f7 f3 div %ebx 6aa: 89 d0 mov %edx,%eax 6ac: 0f b6 80 b0 0d 00 00 movzbl 0xdb0(%eax),%eax 6b3: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1) }while((x /= base) != 0); 6b7: 8b 5d 10 mov 0x10(%ebp),%ebx 6ba: 8b 45 ec mov -0x14(%ebp),%eax 6bd: ba 00 00 00 00 mov $0x0,%edx 6c2: f7 f3 div %ebx 6c4: 89 45 ec mov %eax,-0x14(%ebp) 6c7: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 6cb: 75 c7 jne 694 <printint+0x38> if(neg) 6cd: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 6d1: 74 2d je 700 <printint+0xa4> buf[i++] = '-'; 6d3: 8b 45 f4 mov -0xc(%ebp),%eax 6d6: 8d 50 01 lea 0x1(%eax),%edx 6d9: 89 55 f4 mov %edx,-0xc(%ebp) 6dc: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1) while(--i >= 0) 6e1: eb 1d jmp 700 <printint+0xa4> putc(fd, buf[i]); 6e3: 8d 55 dc lea -0x24(%ebp),%edx 6e6: 8b 45 f4 mov -0xc(%ebp),%eax 6e9: 01 d0 add %edx,%eax 6eb: 0f b6 00 movzbl (%eax),%eax 6ee: 0f be c0 movsbl %al,%eax 6f1: 83 ec 08 sub $0x8,%esp 6f4: 50 push %eax 6f5: ff 75 08 pushl 0x8(%ebp) 6f8: e8 3c ff ff ff call 639 <putc> 6fd: 83 c4 10 add $0x10,%esp buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 700: 83 6d f4 01 subl $0x1,-0xc(%ebp) 704: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 708: 79 d9 jns 6e3 <printint+0x87> putc(fd, buf[i]); } 70a: 90 nop 70b: 8b 5d fc mov -0x4(%ebp),%ebx 70e: c9 leave 70f: c3 ret 00000710 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 710: 55 push %ebp 711: 89 e5 mov %esp,%ebp 713: 83 ec 28 sub $0x28,%esp char *s; int c, i, state; uint *ap; state = 0; 716: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) ap = (uint*)(void*)&fmt + 1; 71d: 8d 45 0c lea 0xc(%ebp),%eax 720: 83 c0 04 add $0x4,%eax 723: 89 45 e8 mov %eax,-0x18(%ebp) for(i = 0; fmt[i]; i++){ 726: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 72d: e9 59 01 00 00 jmp 88b <printf+0x17b> c = fmt[i] & 0xff; 732: 8b 55 0c mov 0xc(%ebp),%edx 735: 8b 45 f0 mov -0x10(%ebp),%eax 738: 01 d0 add %edx,%eax 73a: 0f b6 00 movzbl (%eax),%eax 73d: 0f be c0 movsbl %al,%eax 740: 25 ff 00 00 00 and $0xff,%eax 745: 89 45 e4 mov %eax,-0x1c(%ebp) if(state == 0){ 748: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 74c: 75 2c jne 77a <printf+0x6a> if(c == '%'){ 74e: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 752: 75 0c jne 760 <printf+0x50> state = '%'; 754: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp) 75b: e9 27 01 00 00 jmp 887 <printf+0x177> } else { putc(fd, c); 760: 8b 45 e4 mov -0x1c(%ebp),%eax 763: 0f be c0 movsbl %al,%eax 766: 83 ec 08 sub $0x8,%esp 769: 50 push %eax 76a: ff 75 08 pushl 0x8(%ebp) 76d: e8 c7 fe ff ff call 639 <putc> 772: 83 c4 10 add $0x10,%esp 775: e9 0d 01 00 00 jmp 887 <printf+0x177> } } else if(state == '%'){ 77a: 83 7d ec 25 cmpl $0x25,-0x14(%ebp) 77e: 0f 85 03 01 00 00 jne 887 <printf+0x177> if(c == 'd'){ 784: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp) 788: 75 1e jne 7a8 <printf+0x98> printint(fd, *ap, 10, 1); 78a: 8b 45 e8 mov -0x18(%ebp),%eax 78d: 8b 00 mov (%eax),%eax 78f: 6a 01 push $0x1 791: 6a 0a push $0xa 793: 50 push %eax 794: ff 75 08 pushl 0x8(%ebp) 797: e8 c0 fe ff ff call 65c <printint> 79c: 83 c4 10 add $0x10,%esp ap++; 79f: 83 45 e8 04 addl $0x4,-0x18(%ebp) 7a3: e9 d8 00 00 00 jmp 880 <printf+0x170> } else if(c == 'x' || c == 'p'){ 7a8: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp) 7ac: 74 06 je 7b4 <printf+0xa4> 7ae: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp) 7b2: 75 1e jne 7d2 <printf+0xc2> printint(fd, *ap, 16, 0); 7b4: 8b 45 e8 mov -0x18(%ebp),%eax 7b7: 8b 00 mov (%eax),%eax 7b9: 6a 00 push $0x0 7bb: 6a 10 push $0x10 7bd: 50 push %eax 7be: ff 75 08 pushl 0x8(%ebp) 7c1: e8 96 fe ff ff call 65c <printint> 7c6: 83 c4 10 add $0x10,%esp ap++; 7c9: 83 45 e8 04 addl $0x4,-0x18(%ebp) 7cd: e9 ae 00 00 00 jmp 880 <printf+0x170> } else if(c == 's'){ 7d2: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp) 7d6: 75 43 jne 81b <printf+0x10b> s = (char*)*ap; 7d8: 8b 45 e8 mov -0x18(%ebp),%eax 7db: 8b 00 mov (%eax),%eax 7dd: 89 45 f4 mov %eax,-0xc(%ebp) ap++; 7e0: 83 45 e8 04 addl $0x4,-0x18(%ebp) if(s == 0) 7e4: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 7e8: 75 25 jne 80f <printf+0xff> s = "(null)"; 7ea: c7 45 f4 29 0b 00 00 movl $0xb29,-0xc(%ebp) while(*s != 0){ 7f1: eb 1c jmp 80f <printf+0xff> putc(fd, *s); 7f3: 8b 45 f4 mov -0xc(%ebp),%eax 7f6: 0f b6 00 movzbl (%eax),%eax 7f9: 0f be c0 movsbl %al,%eax 7fc: 83 ec 08 sub $0x8,%esp 7ff: 50 push %eax 800: ff 75 08 pushl 0x8(%ebp) 803: e8 31 fe ff ff call 639 <putc> 808: 83 c4 10 add $0x10,%esp s++; 80b: 83 45 f4 01 addl $0x1,-0xc(%ebp) } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 80f: 8b 45 f4 mov -0xc(%ebp),%eax 812: 0f b6 00 movzbl (%eax),%eax 815: 84 c0 test %al,%al 817: 75 da jne 7f3 <printf+0xe3> 819: eb 65 jmp 880 <printf+0x170> putc(fd, *s); s++; } } else if(c == 'c'){ 81b: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp) 81f: 75 1d jne 83e <printf+0x12e> putc(fd, *ap); 821: 8b 45 e8 mov -0x18(%ebp),%eax 824: 8b 00 mov (%eax),%eax 826: 0f be c0 movsbl %al,%eax 829: 83 ec 08 sub $0x8,%esp 82c: 50 push %eax 82d: ff 75 08 pushl 0x8(%ebp) 830: e8 04 fe ff ff call 639 <putc> 835: 83 c4 10 add $0x10,%esp ap++; 838: 83 45 e8 04 addl $0x4,-0x18(%ebp) 83c: eb 42 jmp 880 <printf+0x170> } else if(c == '%'){ 83e: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 842: 75 17 jne 85b <printf+0x14b> putc(fd, c); 844: 8b 45 e4 mov -0x1c(%ebp),%eax 847: 0f be c0 movsbl %al,%eax 84a: 83 ec 08 sub $0x8,%esp 84d: 50 push %eax 84e: ff 75 08 pushl 0x8(%ebp) 851: e8 e3 fd ff ff call 639 <putc> 856: 83 c4 10 add $0x10,%esp 859: eb 25 jmp 880 <printf+0x170> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 85b: 83 ec 08 sub $0x8,%esp 85e: 6a 25 push $0x25 860: ff 75 08 pushl 0x8(%ebp) 863: e8 d1 fd ff ff call 639 <putc> 868: 83 c4 10 add $0x10,%esp putc(fd, c); 86b: 8b 45 e4 mov -0x1c(%ebp),%eax 86e: 0f be c0 movsbl %al,%eax 871: 83 ec 08 sub $0x8,%esp 874: 50 push %eax 875: ff 75 08 pushl 0x8(%ebp) 878: e8 bc fd ff ff call 639 <putc> 87d: 83 c4 10 add $0x10,%esp } state = 0; 880: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 887: 83 45 f0 01 addl $0x1,-0x10(%ebp) 88b: 8b 55 0c mov 0xc(%ebp),%edx 88e: 8b 45 f0 mov -0x10(%ebp),%eax 891: 01 d0 add %edx,%eax 893: 0f b6 00 movzbl (%eax),%eax 896: 84 c0 test %al,%al 898: 0f 85 94 fe ff ff jne 732 <printf+0x22> putc(fd, c); } state = 0; } } } 89e: 90 nop 89f: c9 leave 8a0: c3 ret 000008a1 <free>: static Header base; static Header *freep; void free(void *ap) { 8a1: 55 push %ebp 8a2: 89 e5 mov %esp,%ebp 8a4: 83 ec 10 sub $0x10,%esp Header *bp, *p; bp = (Header*)ap - 1; 8a7: 8b 45 08 mov 0x8(%ebp),%eax 8aa: 83 e8 08 sub $0x8,%eax 8ad: 89 45 f8 mov %eax,-0x8(%ebp) for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 8b0: a1 e8 0d 00 00 mov 0xde8,%eax 8b5: 89 45 fc mov %eax,-0x4(%ebp) 8b8: eb 24 jmp 8de <free+0x3d> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 8ba: 8b 45 fc mov -0x4(%ebp),%eax 8bd: 8b 00 mov (%eax),%eax 8bf: 3b 45 fc cmp -0x4(%ebp),%eax 8c2: 77 12 ja 8d6 <free+0x35> 8c4: 8b 45 f8 mov -0x8(%ebp),%eax 8c7: 3b 45 fc cmp -0x4(%ebp),%eax 8ca: 77 24 ja 8f0 <free+0x4f> 8cc: 8b 45 fc mov -0x4(%ebp),%eax 8cf: 8b 00 mov (%eax),%eax 8d1: 3b 45 f8 cmp -0x8(%ebp),%eax 8d4: 77 1a ja 8f0 <free+0x4f> free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 8d6: 8b 45 fc mov -0x4(%ebp),%eax 8d9: 8b 00 mov (%eax),%eax 8db: 89 45 fc mov %eax,-0x4(%ebp) 8de: 8b 45 f8 mov -0x8(%ebp),%eax 8e1: 3b 45 fc cmp -0x4(%ebp),%eax 8e4: 76 d4 jbe 8ba <free+0x19> 8e6: 8b 45 fc mov -0x4(%ebp),%eax 8e9: 8b 00 mov (%eax),%eax 8eb: 3b 45 f8 cmp -0x8(%ebp),%eax 8ee: 76 ca jbe 8ba <free+0x19> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ 8f0: 8b 45 f8 mov -0x8(%ebp),%eax 8f3: 8b 40 04 mov 0x4(%eax),%eax 8f6: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 8fd: 8b 45 f8 mov -0x8(%ebp),%eax 900: 01 c2 add %eax,%edx 902: 8b 45 fc mov -0x4(%ebp),%eax 905: 8b 00 mov (%eax),%eax 907: 39 c2 cmp %eax,%edx 909: 75 24 jne 92f <free+0x8e> bp->s.size += p->s.ptr->s.size; 90b: 8b 45 f8 mov -0x8(%ebp),%eax 90e: 8b 50 04 mov 0x4(%eax),%edx 911: 8b 45 fc mov -0x4(%ebp),%eax 914: 8b 00 mov (%eax),%eax 916: 8b 40 04 mov 0x4(%eax),%eax 919: 01 c2 add %eax,%edx 91b: 8b 45 f8 mov -0x8(%ebp),%eax 91e: 89 50 04 mov %edx,0x4(%eax) bp->s.ptr = p->s.ptr->s.ptr; 921: 8b 45 fc mov -0x4(%ebp),%eax 924: 8b 00 mov (%eax),%eax 926: 8b 10 mov (%eax),%edx 928: 8b 45 f8 mov -0x8(%ebp),%eax 92b: 89 10 mov %edx,(%eax) 92d: eb 0a jmp 939 <free+0x98> } else bp->s.ptr = p->s.ptr; 92f: 8b 45 fc mov -0x4(%ebp),%eax 932: 8b 10 mov (%eax),%edx 934: 8b 45 f8 mov -0x8(%ebp),%eax 937: 89 10 mov %edx,(%eax) if(p + p->s.size == bp){ 939: 8b 45 fc mov -0x4(%ebp),%eax 93c: 8b 40 04 mov 0x4(%eax),%eax 93f: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 946: 8b 45 fc mov -0x4(%ebp),%eax 949: 01 d0 add %edx,%eax 94b: 3b 45 f8 cmp -0x8(%ebp),%eax 94e: 75 20 jne 970 <free+0xcf> p->s.size += bp->s.size; 950: 8b 45 fc mov -0x4(%ebp),%eax 953: 8b 50 04 mov 0x4(%eax),%edx 956: 8b 45 f8 mov -0x8(%ebp),%eax 959: 8b 40 04 mov 0x4(%eax),%eax 95c: 01 c2 add %eax,%edx 95e: 8b 45 fc mov -0x4(%ebp),%eax 961: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 964: 8b 45 f8 mov -0x8(%ebp),%eax 967: 8b 10 mov (%eax),%edx 969: 8b 45 fc mov -0x4(%ebp),%eax 96c: 89 10 mov %edx,(%eax) 96e: eb 08 jmp 978 <free+0xd7> } else p->s.ptr = bp; 970: 8b 45 fc mov -0x4(%ebp),%eax 973: 8b 55 f8 mov -0x8(%ebp),%edx 976: 89 10 mov %edx,(%eax) freep = p; 978: 8b 45 fc mov -0x4(%ebp),%eax 97b: a3 e8 0d 00 00 mov %eax,0xde8 } 980: 90 nop 981: c9 leave 982: c3 ret 00000983 <morecore>: static Header* morecore(uint nu) { 983: 55 push %ebp 984: 89 e5 mov %esp,%ebp 986: 83 ec 18 sub $0x18,%esp char *p; Header *hp; if(nu < 4096) 989: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp) 990: 77 07 ja 999 <morecore+0x16> nu = 4096; 992: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp) p = sbrk(nu * sizeof(Header)); 999: 8b 45 08 mov 0x8(%ebp),%eax 99c: c1 e0 03 shl $0x3,%eax 99f: 83 ec 0c sub $0xc,%esp 9a2: 50 push %eax 9a3: e8 49 fc ff ff call 5f1 <sbrk> 9a8: 83 c4 10 add $0x10,%esp 9ab: 89 45 f4 mov %eax,-0xc(%ebp) if(p == (char*)-1) 9ae: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp) 9b2: 75 07 jne 9bb <morecore+0x38> return 0; 9b4: b8 00 00 00 00 mov $0x0,%eax 9b9: eb 26 jmp 9e1 <morecore+0x5e> hp = (Header*)p; 9bb: 8b 45 f4 mov -0xc(%ebp),%eax 9be: 89 45 f0 mov %eax,-0x10(%ebp) hp->s.size = nu; 9c1: 8b 45 f0 mov -0x10(%ebp),%eax 9c4: 8b 55 08 mov 0x8(%ebp),%edx 9c7: 89 50 04 mov %edx,0x4(%eax) free((void*)(hp + 1)); 9ca: 8b 45 f0 mov -0x10(%ebp),%eax 9cd: 83 c0 08 add $0x8,%eax 9d0: 83 ec 0c sub $0xc,%esp 9d3: 50 push %eax 9d4: e8 c8 fe ff ff call 8a1 <free> 9d9: 83 c4 10 add $0x10,%esp return freep; 9dc: a1 e8 0d 00 00 mov 0xde8,%eax } 9e1: c9 leave 9e2: c3 ret 000009e3 <malloc>: void* malloc(uint nbytes) { 9e3: 55 push %ebp 9e4: 89 e5 mov %esp,%ebp 9e6: 83 ec 18 sub $0x18,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 9e9: 8b 45 08 mov 0x8(%ebp),%eax 9ec: 83 c0 07 add $0x7,%eax 9ef: c1 e8 03 shr $0x3,%eax 9f2: 83 c0 01 add $0x1,%eax 9f5: 89 45 ec mov %eax,-0x14(%ebp) if((prevp = freep) == 0){ 9f8: a1 e8 0d 00 00 mov 0xde8,%eax 9fd: 89 45 f0 mov %eax,-0x10(%ebp) a00: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) a04: 75 23 jne a29 <malloc+0x46> base.s.ptr = freep = prevp = &base; a06: c7 45 f0 e0 0d 00 00 movl $0xde0,-0x10(%ebp) a0d: 8b 45 f0 mov -0x10(%ebp),%eax a10: a3 e8 0d 00 00 mov %eax,0xde8 a15: a1 e8 0d 00 00 mov 0xde8,%eax a1a: a3 e0 0d 00 00 mov %eax,0xde0 base.s.size = 0; a1f: c7 05 e4 0d 00 00 00 movl $0x0,0xde4 a26: 00 00 00 } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ a29: 8b 45 f0 mov -0x10(%ebp),%eax a2c: 8b 00 mov (%eax),%eax a2e: 89 45 f4 mov %eax,-0xc(%ebp) if(p->s.size >= nunits){ a31: 8b 45 f4 mov -0xc(%ebp),%eax a34: 8b 40 04 mov 0x4(%eax),%eax a37: 3b 45 ec cmp -0x14(%ebp),%eax a3a: 72 4d jb a89 <malloc+0xa6> if(p->s.size == nunits) a3c: 8b 45 f4 mov -0xc(%ebp),%eax a3f: 8b 40 04 mov 0x4(%eax),%eax a42: 3b 45 ec cmp -0x14(%ebp),%eax a45: 75 0c jne a53 <malloc+0x70> prevp->s.ptr = p->s.ptr; a47: 8b 45 f4 mov -0xc(%ebp),%eax a4a: 8b 10 mov (%eax),%edx a4c: 8b 45 f0 mov -0x10(%ebp),%eax a4f: 89 10 mov %edx,(%eax) a51: eb 26 jmp a79 <malloc+0x96> else { p->s.size -= nunits; a53: 8b 45 f4 mov -0xc(%ebp),%eax a56: 8b 40 04 mov 0x4(%eax),%eax a59: 2b 45 ec sub -0x14(%ebp),%eax a5c: 89 c2 mov %eax,%edx a5e: 8b 45 f4 mov -0xc(%ebp),%eax a61: 89 50 04 mov %edx,0x4(%eax) p += p->s.size; a64: 8b 45 f4 mov -0xc(%ebp),%eax a67: 8b 40 04 mov 0x4(%eax),%eax a6a: c1 e0 03 shl $0x3,%eax a6d: 01 45 f4 add %eax,-0xc(%ebp) p->s.size = nunits; a70: 8b 45 f4 mov -0xc(%ebp),%eax a73: 8b 55 ec mov -0x14(%ebp),%edx a76: 89 50 04 mov %edx,0x4(%eax) } freep = prevp; a79: 8b 45 f0 mov -0x10(%ebp),%eax a7c: a3 e8 0d 00 00 mov %eax,0xde8 return (void*)(p + 1); a81: 8b 45 f4 mov -0xc(%ebp),%eax a84: 83 c0 08 add $0x8,%eax a87: eb 3b jmp ac4 <malloc+0xe1> } if(p == freep) a89: a1 e8 0d 00 00 mov 0xde8,%eax a8e: 39 45 f4 cmp %eax,-0xc(%ebp) a91: 75 1e jne ab1 <malloc+0xce> if((p = morecore(nunits)) == 0) a93: 83 ec 0c sub $0xc,%esp a96: ff 75 ec pushl -0x14(%ebp) a99: e8 e5 fe ff ff call 983 <morecore> a9e: 83 c4 10 add $0x10,%esp aa1: 89 45 f4 mov %eax,-0xc(%ebp) aa4: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) aa8: 75 07 jne ab1 <malloc+0xce> return 0; aaa: b8 00 00 00 00 mov $0x0,%eax aaf: eb 13 jmp ac4 <malloc+0xe1> nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ ab1: 8b 45 f4 mov -0xc(%ebp),%eax ab4: 89 45 f0 mov %eax,-0x10(%ebp) ab7: 8b 45 f4 mov -0xc(%ebp),%eax aba: 8b 00 mov (%eax),%eax abc: 89 45 f4 mov %eax,-0xc(%ebp) return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } abf: e9 6d ff ff ff jmp a31 <malloc+0x4e> } ac4: c9 leave ac5: c3 ret
gcc-gcc-7_3_0-release/gcc/ada/sem_ch5.ads
best08618/asylo
7
78
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S E M _ C H 5 -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2016, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Types; use Types; package Sem_Ch5 is procedure Analyze_Assignment (N : Node_Id); procedure Analyze_Block_Statement (N : Node_Id); procedure Analyze_Case_Statement (N : Node_Id); procedure Analyze_Compound_Statement (N : Node_Id); procedure Analyze_Exit_Statement (N : Node_Id); procedure Analyze_Goto_Statement (N : Node_Id); procedure Analyze_If_Statement (N : Node_Id); procedure Analyze_Implicit_Label_Declaration (N : Node_Id); procedure Analyze_Iterator_Specification (N : Node_Id); procedure Analyze_Iteration_Scheme (N : Node_Id); procedure Analyze_Label (N : Node_Id); procedure Analyze_Loop_Parameter_Specification (N : Node_Id); procedure Analyze_Loop_Statement (N : Node_Id); procedure Analyze_Null_Statement (N : Node_Id); procedure Analyze_Statements (L : List_Id); procedure Analyze_Target_Name (N : Node_Id); procedure Analyze_Label_Entity (E : Entity_Id); -- This procedure performs direct analysis of the label entity E. It -- is used when a label is created by the expander without bothering -- to insert an N_Implicit_Label_Declaration in the tree. It also takes -- care of setting Reachable, since labels defined by the expander can -- be assumed to be reachable. procedure Check_Unreachable_Code (N : Node_Id); -- This procedure is called with N being the node for a statement that is -- an unconditional transfer of control or an apparent infinite loop. It -- checks to see if the statement is followed by some other statement, and -- if so generates an appropriate warning for unreachable code. end Sem_Ch5;
programs/oeis/104/A104777.asm
karttu/loda
1
13443
; A104777: Integer squares congruent to 1 mod 6. ; 1,25,49,121,169,289,361,529,625,841,961,1225,1369,1681,1849,2209,2401,2809,3025,3481,3721,4225,4489,5041,5329,5929,6241,6889,7225,7921,8281,9025,9409,10201,10609,11449,11881,12769,13225,14161,14641,15625,16129,17161,17689,18769,19321,20449,21025,22201,22801,24025,24649,25921,26569,27889,28561,29929,30625,32041,32761,34225,34969,36481,37249,38809,39601,41209,42025,43681,44521,46225,47089,48841,49729,51529,52441,54289,55225,57121,58081,60025,61009,63001,64009,66049,67081,69169,70225,72361,73441,75625,76729,78961,80089,82369,83521,85849,87025,89401,90601,93025,94249,96721,97969,100489,101761,104329,105625,108241,109561,112225,113569,116281,117649,120409,121801,124609,126025,128881,130321,133225,134689,137641,139129,142129,143641,146689,148225,151321,152881,156025,157609,160801,162409,165649,167281,170569,172225,175561,177241,180625,182329,185761,187489,190969,192721,196249,198025,201601,203401,207025,208849,212521,214369,218089,219961,223729,225625,229441,231361,235225,237169,241081,243049,247009,249001,253009,255025,259081,261121,265225,267289,271441,273529,277729,279841,284089,286225,290521,292681,297025,299209,303601,305809,310249,312481,316969,319225,323761,326041,330625,332929,337561,339889,344569,346921,351649,354025,358801,361201,366025,368449,373321,375769,380689,383161,388129,390625,395641,398161,403225,405769,410881,413449,418609,421201,426409,429025,434281,436921,442225,444889,450241,452929,458329,461041,466489,469225,474721,477481,483025,485809,491401,494209,499849,502681,508369,511225,516961,519841,525625,528529,534361,537289,543169,546121,552049,555025,561001 mul $0,3 add $0,3 div $0,2 mov $1,$0 sub $1,1 add $1,$0 pow $1,2
oeis/038/A038731.asm
neoneye/loda-programs
11
2082
<gh_stars>10-100 ; A038731: Number of columns in all directed column-convex polyominoes of area n+1. ; 1,3,10,32,99,299,887,2595,7508,21526,61251,173173,486925,1362627,3797374,10543724,29180067,80521055,221610563,608468451,1667040776,4558234018,12441155715,33900136297,92230468249,250570010499,679844574322,1842280003640,4986579299043,13482893189651,36418822295951,98278304480163,264973561464380,713810060090542,1921402189020099,5168065537430749,13890855944442277,37311017828945475,100153682620372198,268677969733055876,720352560603471651,1930268774450502983,5169648615842792795,13838372569988997987 mov $2,$0 mul $0,2 mov $1,$0 add $1,3 lpb $2 sub $0,$2 add $0,2 add $0,$1 add $1,$0 sub $2,1 lpe mov $0,$1 div $0,5 add $0,1
src/data/palettes.asm
Xkeeper0/tcrf-birthday
10
105445
<reponame>Xkeeper0/tcrf-birthday ; ; Palettes used, stored here for... some reason. ; Probably. It made sense at the time. ; Palette_Main: ; PPU Addr Len .db $3F, $00, $20 .db $0F, $00, $10, $30 ; BG 0 .db $0F, $09, $19, $38 ; BG 1 ; .db $0F, $0F, $0F, $0F ; BG 1 .db $0F, $05, $15, $35 ; BG 2 .db $0F, $07, $17, $37 ; BG 3 .db $0F, $08, $29, $38 ; SP 0 ; .db $0F, $0F, $0F, $0F ; SP 0 .db $0F, $06, $26, $30 ; SP 1 .db $0F, $1a, $2a, $30 ; SP 2 .db $0F, $12, $22, $30 ; SP 3 .db $00 ; End Palette_Fade0: ; PPU Addr Len .db $3F, $05, $03, $0F, $0F, $0F ; BG 1 .db $3F, $11, $03, $0F, $0F, $0F ; SP 0 .db $00 ; End Palette_Fade1: ; PPU Addr Len .db $3F, $05, $03, $0F, $0F, $08 ; BG 1 .db $3F, $11, $03, $0F, $0F, $08 ; SP 0 .db $00 ; End Palette_Fade2: ; PPU Addr Len .db $3F, $05, $03, $0F, $0F, $18 ; BG 1 .db $3F, $11, $03, $0F, $09, $18 ; SP 0 .db $00 ; End Palette_Fade3: ; PPU Addr Len .db $3F, $05, $03, $0F, $09, $28 ; BG 1 .db $3F, $11, $03, $0F, $19, $28 ; SP 0 .db $00 ; End Palette_Fade4: ; PPU Addr Len .db $3F, $05, $03, $09, $19, $38 ; BG 1 .db $3F, $11, $03, $08, $29, $38 ; SP 0 .db $00 ; End Palette_TextFade0: ; PPU Addr Len .db $3F, $00, $4 .db $0F, $0F, $0F, $0F ; BG 0 .db $00 ; End Palette_TextFade1: ; PPU Addr Len .db $3F, $00, $4 .db $0F, $0F, $0F, $00 ; BG 0 .db $00 ; End Palette_TextFade2: ; PPU Addr Len .db $3F, $00, $4 .db $0F, $0F, $00, $10 ; BG 0 .db $00 ; End Palette_TextFade3: ; PPU Addr Len .db $3F, $00, $4 .db $0F, $00, $10, $30 ; BG 0 .db $00 ; End
Assembly/MIPS/36_E1_yff01.asm
yadferhad/okay-code
0
169669
.data bar: .asciiz " | " colon: .asciiz ":" newline: .asciiz "\n" letter: .asciiz "A" space: .asciiz " " .text li $t0,65 li $s6,91 li $s7,97 li $t1,122 loop: add $a0,$zero,$t0 li $v0,1 syscall addi $t0,$t0,1 la $a0,colon li $v0,4 syscall la $a0,letter li $v0,4 syscall lb $t2,($a0) addi $t2,$t2,32 sb $t2,letter la $a0,space syscall la $a0,bar syscall la $a0,space syscall add $a0,$zero,$s7 li $v0,1 syscall addi $s7,$s7,1 la $a0,colon li $v0,4 syscall la $a0,letter li $v0,4 syscall lb $t2,($a0) subi $t2,$t2,31 sb $t2,letter la $a0,newline li $v0,4 syscall blt $t0,$s6,loop
test/asset/agda-stdlib-1.0/Data/List/Relation/Binary/Sublist/DecSetoid/Solver.agda
omega12345/agda-mode
5
15981
<reponame>omega12345/agda-mode ------------------------------------------------------------------------ -- The Agda standard library -- -- A solver for proving that one list is a sublist of the other. ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} open import Relation.Binary using (DecSetoid) module Data.List.Relation.Binary.Sublist.DecSetoid.Solver {c ℓ} (S : DecSetoid c ℓ) where open DecSetoid S open import Data.List.Relation.Binary.Sublist.Heterogeneous.Solver _≈_ refl _≟_ using (Item; module Item; TList; module TList; prove) public
sample1/hoge_asm.asm
matanki-saito/vs2019AsmSample
0
22369
<reponame>matanki-saito/vs2019AsmSample<filename>sample1/hoge_asm.asm SECTION .data msg: db "Hello world", 0 ; C string needs 0 fmt: db "%s", 10, 0 ; The printf format, "\n",'0' SECTION .text GLOBAL geso ; the standard gcc entry point geso: push rbp; ; set up stack frame, must be aligned nop; nop; pop rbp; mov rax,5; ret;
FormalAnalyzer/models/apps/GaragecheckopencloseApp.als
Mohannadcse/IoTCOM_BehavioralRuleExtractor
0
468
module app_GaragecheckopencloseApp open IoTBottomUp as base open cap_runIn open cap_now open cap_switch open cap_switch open cap_switch open cap_switch open cap_contactSensor open cap_switch one sig app_GaragecheckopencloseApp extends IoTApp { triggerC : one cap_switch, triggerO : one cap_switch, checkC : one cap_switch, checkO : one cap_switch, door : one cap_contactSensor, outlet : one cap_switch, state : one cap_state, } { rules = r //capabilities = triggerC + triggerO + checkC + checkO + door + outlet + state } one sig cap_state extends cap_runIn {} { attributes = cap_state_attr + cap_runIn_attr } abstract sig cap_state_attr extends Attribute {} abstract sig r extends Rule {} one sig r0 extends r {}{ triggers = r0_trig conditions = r0_cond commands = r0_comm } abstract sig r0_trig extends Trigger {} one sig r0_trig0 extends r0_trig {} { capabilities = app_GaragecheckopencloseApp.triggerC attribute = cap_switch_attr_switch value = cap_switch_attr_switch_val_on } abstract sig r0_cond extends Condition {} one sig r0_cond0 extends r0_cond {} { capabilities = app_GaragecheckopencloseApp.door attribute = cap_contactSensor_attr_contact value = cap_contactSensor_attr_contact_val_closed } abstract sig r0_comm extends Command {} one sig r0_comm0 extends r0_comm {} { capability = app_GaragecheckopencloseApp.state attribute = cap_runIn_attr_runIn value = cap_runIn_attr_runIn_val_on } one sig r1 extends r {}{ triggers = r1_trig conditions = r1_cond commands = r1_comm } abstract sig r1_trig extends Trigger {} one sig r1_trig0 extends r1_trig {} { capabilities = app_GaragecheckopencloseApp.triggerO attribute = cap_switch_attr_switch value = cap_switch_attr_switch_val_on } abstract sig r1_cond extends Condition {} one sig r1_cond0 extends r1_cond {} { capabilities = app_GaragecheckopencloseApp.door attribute = cap_contactSensor_attr_contact value = cap_contactSensor_attr_contact_val - cap_contactSensor_attr_contact_val_open } abstract sig r1_comm extends Command {} one sig r1_comm0 extends r1_comm {} { capability = app_GaragecheckopencloseApp.outlet attribute = cap_switch_attr_switch value = cap_switch_attr_switch_val_on } one sig r2 extends r {}{ triggers = r2_trig conditions = r2_cond commands = r2_comm } abstract sig r2_trig extends Trigger {} one sig r2_trig0 extends r2_trig {} { capabilities = app_GaragecheckopencloseApp.triggerC attribute = cap_switch_attr_switch value = cap_switch_attr_switch_val_on } abstract sig r2_cond extends Condition {} one sig r2_cond0 extends r2_cond {} { capabilities = app_GaragecheckopencloseApp.door attribute = cap_contactSensor_attr_contact value = cap_contactSensor_attr_contact_val_closed } abstract sig r2_comm extends Command {} one sig r2_comm0 extends r2_comm {} { capability = app_GaragecheckopencloseApp.checkC attribute = cap_switch_attr_switch value = cap_switch_attr_switch_val_on } one sig r3 extends r {}{ triggers = r3_trig conditions = r3_cond commands = r3_comm } abstract sig r3_trig extends Trigger {} one sig r3_trig0 extends r3_trig {} { capabilities = app_GaragecheckopencloseApp.triggerC attribute = cap_switch_attr_switch value = cap_switch_attr_switch_val_on } abstract sig r3_cond extends Condition {} one sig r3_cond0 extends r3_cond {} { capabilities = app_GaragecheckopencloseApp.door attribute = cap_contactSensor_attr_contact value = cap_contactSensor_attr_contact_val - cap_contactSensor_attr_contact_val_closed } abstract sig r3_comm extends Command {} one sig r3_comm0 extends r3_comm {} { capability = app_GaragecheckopencloseApp.outlet attribute = cap_switch_attr_switch value = cap_switch_attr_switch_val_on } one sig r4 extends r {}{ triggers = r4_trig conditions = r4_cond commands = r4_comm } abstract sig r4_trig extends Trigger {} one sig r4_trig0 extends r4_trig {} { capabilities = app_GaragecheckopencloseApp.triggerO attribute = cap_switch_attr_switch value = cap_switch_attr_switch_val_on } abstract sig r4_cond extends Condition {} one sig r4_cond0 extends r4_cond {} { capabilities = app_GaragecheckopencloseApp.door attribute = cap_contactSensor_attr_contact value = cap_contactSensor_attr_contact_val_open } abstract sig r4_comm extends Command {} one sig r4_comm0 extends r4_comm {} { capability = app_GaragecheckopencloseApp.state attribute = cap_runIn_attr_runIn value = cap_runIn_attr_runIn_val_on } one sig r5 extends r {}{ no triggers conditions = r5_cond commands = r5_comm } abstract sig r5_cond extends Condition {} one sig r5_cond0 extends r5_cond {} { capabilities = app_GaragecheckopencloseApp.state attribute = cap_runIn_attr_runIn value = cap_runIn_attr_runIn_val_on } abstract sig r5_comm extends Command {} one sig r5_comm0 extends r5_comm {} { capability = app_GaragecheckopencloseApp.triggerC attribute = cap_switch_attr_switch value = cap_switch_attr_switch_val_off } one sig r5_comm1 extends r5_comm {} { capability = app_GaragecheckopencloseApp.triggerO attribute = cap_switch_attr_switch value = cap_switch_attr_switch_val_off } one sig r5_comm2 extends r5_comm {} { capability = app_GaragecheckopencloseApp.checkC attribute = cap_switch_attr_switch value = cap_switch_attr_switch_val_off } one sig r5_comm3 extends r5_comm {} { capability = app_GaragecheckopencloseApp.checkO attribute = cap_switch_attr_switch value = cap_switch_attr_switch_val_off } one sig r6 extends r {}{ triggers = r6_trig conditions = r6_cond commands = r6_comm } abstract sig r6_trig extends Trigger {} one sig r6_trig0 extends r6_trig {} { capabilities = app_GaragecheckopencloseApp.triggerO attribute = cap_switch_attr_switch value = cap_switch_attr_switch_val_on } abstract sig r6_cond extends Condition {} one sig r6_cond0 extends r6_cond {} { capabilities = app_GaragecheckopencloseApp.door attribute = cap_contactSensor_attr_contact value = cap_contactSensor_attr_contact_val_open } abstract sig r6_comm extends Command {} one sig r6_comm0 extends r6_comm {} { capability = app_GaragecheckopencloseApp.checkO attribute = cap_switch_attr_switch value = cap_switch_attr_switch_val_on }
programs/oeis/033/A033117.asm
karttu/loda
1
243288
; A033117: Base 7 digits are, in order, the first n terms of the periodic sequence with initial period 1,0. ; 1,7,50,350,2451,17157,120100,840700,5884901,41194307,288360150,2018521050,14129647351,98907531457,692352720200,4846469041400,33925283289801,237476983028607,1662338881200250,11636372168401750,81454605178812251 add $0,2 mov $1,7 pow $1,$0 div $1,48
src/Categories/Diagram/End.agda
Trebor-Huang/agda-categories
279
15857
<reponame>Trebor-Huang/agda-categories {-# OPTIONS --without-K --safe #-} open import Categories.Category open import Categories.Functor.Bifunctor module Categories.Diagram.End {o ℓ e o′ ℓ′ e′} {C : Category o ℓ e} {D : Category o′ ℓ′ e′} (F : Bifunctor (Category.op C) C D) where private module D = Category D open D open HomReasoning open Equiv variable A B : Obj f g : A ⇒ B open import Level open import Categories.Diagram.Wedge F open import Categories.NaturalTransformation.Dinatural record End : Set (levelOfTerm F) where field wedge : Wedge module wedge = Wedge wedge open wedge public open Wedge field factor : (W : Wedge) → E W ⇒ wedge.E universal : ∀ {W : Wedge} {A} → wedge.dinatural.α A ∘ factor W ≈ dinatural.α W A unique : ∀ {W : Wedge} {g : E W ⇒ wedge.E} → (∀ {A} → wedge.dinatural.α A ∘ g ≈ dinatural.α W A) → factor W ≈ g η-id : factor wedge ≈ D.id η-id = unique identityʳ unique′ :(∀ {A} → wedge.dinatural.α A ∘ f ≈ wedge.dinatural.α A ∘ g) → f ≈ g unique′ {f = f} {g = g} eq = ⟺ (unique {W = Wedge-∘ wedge f} refl) ○ unique (⟺ eq)
Library/Spreadsheet/Spreadsheet/spreadsheetManager.asm
steakknife/pcgeos
504
102182
<reponame>steakknife/pcgeos<gh_stars>100-1000 COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1991 -- All Rights Reserved PROJECT: PC GEOS MODULE: GeoCalc FILE: spreadsheetManager.asm AUTHOR: <NAME>, Feb 27, 1991 REVISION HISTORY: Name Date Description ---- ---- ----------- Gene 2/27/91 Initial revision DESCRIPTION: $Id: spreadsheetManager.asm,v 1.1 97/04/07 11:13:44 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ include spreadsheetGeode.def ;------------------------------------------------------------------------------ ; Resources ;------------------------------------------------------------------------------ SpreadsheetClassStructures segment resource SpreadsheetClass ;declare the class record SpreadsheetClassStructures ends ;------------------------------------------------------------------------------ ; Code ;------------------------------------------------------------------------------ include spreadsheetStyleToken.def include spreadsheetRowArray.def include spreadsheetFileConstant.def include spreadsheetMacro.def include spreadsheetConstant.def include spreadsheetVariable.asm include graphicsText.asm include spreadsheetInit.asm include spreadsheetDraw.asm include spreadsheetDrawUtils.asm include spreadsheetUtils.asm include spreadsheetEditBar.asm include spreadsheetKeyboard.asm include spreadsheetStyleToken.asm include spreadsheetRowArray.asm include spreadsheetCell.asm include spreadsheetRange.asm include spreadsheetMethodStyle.asm include spreadsheetNotify.asm include spreadsheetMethodMove.asm include spreadsheetMethodSelect.asm include spreadsheetMethodMouse.asm include spreadsheetGeometry.asm include spreadsheetScroll.asm include spreadsheetErrorCheck.asm include spreadsheetNameUtils.asm include spreadsheetNameList.asm include spreadsheetNameMethods.asm include spreadsheetNameCtrlInterface.asm include spreadsheetParse.asm include spreadsheetRecalc.asm include spreadsheetFormulaCell.asm include spreadsheetExprMethods.asm include spreadsheetCellEdit.asm include spreadsheetNotes.asm include spreadsheetSpace.asm include spreadsheetPrint.asm include spreadsheetFormatInit.asm include spreadsheetFormat.asm include spreadsheetHeaderFooter.asm include spreadsheetExtent.asm include spreadsheetCutCopyConstant.def include spreadsheetCutCopy.asm ;include spreadsheetCutCopyDataChain.asm include spreadsheetCutCopyUtils.asm include spreadsheetPaste.asm include spreadsheetPasteTransTbl.asm include spreadsheetPasteName.asm include spreadsheetQuickMoveCopy.asm include spreadsheetTextScrap.asm include spreadsheetSearch.asm include spreadsheetSort.asm include spreadsheetFunctions.asm include spreadsheetMethodFocus.asm include spreadsheetPointer.asm include spreadsheetChart.asm include spreadsheetFill.asm include spreadsheetRowColumn.asm include spreadsheetOverlap.asm include spreadsheetC.asm global SpreadsheetEntry:far InitCode segment resource SpreadsheetEntry proc far clc ret SpreadsheetEntry endp InitCode ends
tools-src/gnu/gcc/gcc/ada/xsnames.adb
enfoTek/tomato.linksys.e2000.nvram-mod
80
30280
<gh_stars>10-100 ------------------------------------------------------------------------------ -- -- -- GNAT SYSTEM UTILITIES -- -- -- -- X S N A M E S -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1992-2001 Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This utility is used to make a new version of the Snames package when -- new names are added to the spec, the existing versions of snames.ads and -- snames.adb are read, and updated to match the set of names in snames.ads. -- The updated versions are written to snames.ns and snames.nb (new spec/body) with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Strings.Unbounded.Text_IO; use Ada.Strings.Unbounded.Text_IO; with Ada.Strings.Maps; use Ada.Strings.Maps; with Ada.Strings.Maps.Constants; use Ada.Strings.Maps.Constants; with Ada.Text_IO; use Ada.Text_IO; with GNAT.Spitbol; use GNAT.Spitbol; with GNAT.Spitbol.Patterns; use GNAT.Spitbol.Patterns; procedure XSnames is InB : File_Type; InS : File_Type; OutS : File_Type; OutB : File_Type; A, B : VString := Nul; Line : VString := Nul; Name : VString := Nul; Name1 : VString := Nul; Oldrev : VString := Nul; Oname : VString := Nul; Oval : VString := Nul; Restl : VString := Nul; Specrev : VString := Nul; Tdigs : Pattern := Any (Decimal_Digit_Set) & Any (Decimal_Digit_Set) & Any (Decimal_Digit_Set); Get_Srev : Pattern := BreakX ('$') & "$Rev" & "ision: " & Break (' ') * Specrev; Get_Orev : Pattern := (BreakX ('$') & "$Rev" & "ision: " & Break ('.') & '.') * A & Break (' ') * Oldrev & ' '; Name_Ref : Pattern := Span (' ') * A & Break (' ') * Name & Span (' ') * B & ": constant Name_Id := N + " & Tdigs & ';' & Rest * Restl; Get_Name : Pattern := "Name_" & Rest * Name1; Chk_Low : Pattern := Pos (0) & Any (Lower_Set) & Rest & Pos (1); Findu : Pattern := Span ('u') * A; Val : Natural; Xlate_U_Und : Character_Mapping := To_Mapping ("u", "_"); M : Match_Result; begin Open (InB, In_File, "snames.adb"); Open (InS, In_File, "snames.ads"); Create (OutS, Out_File, "snames.ns"); Create (OutB, Out_File, "snames.nb"); Anchored_Mode := True; Oname := Nul; Val := 0; loop Line := Get_Line (InS); Put_Line (OutS, Line); exit when not Match (Line, Get_Srev); end loop; loop Line := Get_Line (InB); exit when Match (Line, Get_Orev); Put_Line (OutB, Line); end loop; Line := A & (Natural'Value (S (Oldrev)) + 1) & " $"; Line := Rpad (Line, 76) & "--"; Put_Line (OutB, Line); loop Line := Get_Line (InB); exit when Match (Line, " Preset_Names"); Put_Line (OutB, Line); end loop; Put_Line (OutB, Line); LoopN : while not End_Of_File (InS) loop Line := Get_Line (InS); if not Match (Line, Name_Ref) then Put_Line (OutS, Line); else Oval := Lpad (V (Val), 3, '0'); if Match (Name, "Last_") then Oval := Lpad (V (Val - 1), 3, '0'); end if; Put_Line (OutS, A & Name & B & ": constant Name_Id := N + " & Oval & ';' & Restl); if Match (Name, Get_Name) then Name := Name1; Val := Val + 1; if Match (Name, Findu, M) then Replace (M, Translate (A, Xlate_U_Und)); Translate (Name, Lower_Case_Map); elsif not Match (Name, "Op_", "") then Translate (Name, Lower_Case_Map); else Name := 'O' & Translate (Name, Lower_Case_Map); end if; if Name = "error" then Name := V ("<error>"); end if; if not Match (Name, Chk_Low) then Put_Line (OutB, " """ & Name & "#"" &"); end if; end if; end if; end loop LoopN; loop Line := Get_Line (InB); exit when Match (Line, " ""#"";"); end loop; Put_Line (OutB, Line); while not End_Of_File (InB) loop Put_Line (OutB, Get_Line (InB)); end loop; Put_Line (OutB, "-- Updated to match snames.ads revision " & Specrev); end XSnames;
day04/Hello.g4
zjsyj/awesomecompiler
0
4285
lexer grammar Hello; If : 'if'; Int : 'int'; IntLiteral : [0-9]+; StringLiteral : '"' .*? '"'; AssignmentOP : '='; RelationalOP : '>'|'>='|'<'|'<='; Star : '*'; Plus : '+'; Sharp : '#'; SemiColon : ';'; Dot : '.'; Comm : ','; LeftBracket : '['; RightBracket : ']'; LeftBrace : '{'; RightBrace : '}'; LeftParen : '('; RightParen : ')'; Id : [a-zA-Z_] ([a-zA-Z_] | [0-9])*; Whitespace : [ \t]+ -> skip; Newline : ( '\r' '\n'?|'\n')-> skip;
programs/oeis/088/A088741.asm
neoneye/loda
22
161
; A088741: Number of connected strongly regular simple graphs on n nodes. ; 1,1,1,2,2,3,1,3,3,5 sub $0,1 mov $2,$0 div $0,2 sub $2,4 lpb $2 sub $0,2 mul $0,2 trn $2,8 lpe add $0,1
examples/AIM4/bag/Nat.agda
cruhland/agda
1,989
14389
<filename>examples/AIM4/bag/Nat.agda module Nat where import Prelude import Equiv import Datoid open Prelude open Equiv open Datoid data Nat : Set where zero : Nat suc : Nat -> Nat one : Nat one = suc zero _+_ : Nat -> Nat -> Nat zero + n = n suc m + n = suc (m + n) private eqNat : Nat -> Nat -> Bool eqNat zero zero = True eqNat (suc m) (suc n) = eqNat m n eqNat _ _ = False refl' : (x : Nat) -> T (eqNat x x) refl' zero = unit refl' (suc n) = refl' n sym' : (x y : Nat) -> T (eqNat x y) -> T (eqNat y x) sym' zero zero _ = unit sym' (suc n1) (suc n2) eq = sym' n1 n2 eq sym' (suc _) zero wrong = wrong sym' zero (suc _) wrong = wrong trans' : (x y z : Nat) -> T (eqNat x y) -> T (eqNat y z) -> T (eqNat x z) trans' zero _ zero _ _ = unit trans' (suc n1) (suc n2) (suc n3) eq12 eq23 = trans' n1 n2 n3 eq12 eq23 trans' zero (suc _) _ wrong _ = absurdElim wrong trans' _ zero (suc _) _ wrong = absurdElim wrong trans' (suc _) zero _ wrong _ = absurdElim wrong trans' _ (suc _) zero _ wrong = absurdElim wrong decidableEquiv : DecidableEquiv Nat decidableEquiv = decEquiv (equiv (T' eqNat) refl' sym' trans') (boolFunctionsDecidable eqNat) natDatoid : Datoid natDatoid = datoid Nat decidableEquiv
base/mvdm/dos/v86/inc/_parse.asm
npocmaka/Windows-Server-2003
17
176258
<filename>base/mvdm/dos/v86/inc/_parse.asm<gh_stars>10-100 page 60,132 name _parse title C to PARSER interface ;------------------------------------------------------------------- ; ; MODULE: _parse ; ; PURPOSE: Supplies an interface between C programs and ; the DOS 3.30 parser ; ; CALLING FORMAT: ; parse(&inregs,&outregs); ; ; DATE: 5-21-87 ; ;------------------------------------------------------------------- ; extrn sysparse:far public _parse ;------------------------------------------------------------------- ; SET FOR SUBST ; ------------- FarSW equ 0 ; make sysparse be a NEAR proc TimeSW equ 0 ; Check time format FileSW equ 1 ; Check file specification CAPSW equ 1 ; Perform CAPS if specified CmpxSW equ 0 ; Check complex list NumSW equ 0 ; Check numeric value KeySW equ 0 ; Support keywords SwSW equ 1 ; Support switches Val1SW equ 0 ; Support value definition 1 Val2SW equ 0 ; Support value definition 2 Val3SW equ 0 ; Support value definition 3 DrvSW equ 1 ; Support drive only format QusSW equ 0 ; Support quoted string format ;------------------------------------------------------------------- _DATA segment byte public 'DATA' _DATA ends _TEXT segment byte public 'CODE' ASSUME CS: _TEXT ASSUME DS: _DATA ;------------------------------------------------------------------- include parse.asm ; include the parser ;------------------------------------------------------------------- _parse proc near push bp ; save user's base pointer mov bp,sp ; set bp to current sp push di ; save some registers push si ; copy C inregs into proper registers mov di,[bp+4] ; fix di (arg 0) ;------------------------------------------------------------------- mov ax,[di+0ah] ; load di push ax ; the di value from inregs is now on stack mov ax,[di+00] ; get inregs.x.ax mov bx,[di+02] ; get inregs.x.bx mov cx,[di+04] ; get inregs.x.cx mov dx,[di+06] ; get inregs.x.dx mov si,[di+08] ; get inregs.x.si pop di ; get inregs.x.di from stack push bp ; save base pointer ; int 3 ; debugger ;------------------------------------------------------------------- call sysparse ; call the parser ;------------------------------------------------------------------- ; int 3 ; debugger pop bp ; restore base pointer push di ; the di value from call is now on stack mov di,[bp+6] ; fix di (arg 1) mov [di+00],ax ; load outregs.x.ax mov [di+02],bx ; load outregs.x.bx mov [di+04],cx ; load outregs.x.cx mov [di+06],dx ; load outregs.x.dx mov [di+08],si ; load outregs.x.si xor ax,ax ; clear ax lahf ; get flags into ax mov [di+0ch],ax ; load outregs.x.cflag pop ax ; get di from stack mov [di+0ah],ax ; load outregs.x.di ;------------------------------------------------------------------- pop si ; restore registers pop di mov sp,bp ; restore sp pop bp ; restore user's bp ret _parse endp _TEXT ends ; end code segment end 
test/Succeed/WErrorOverride.agda
cruhland/agda
1,989
7010
<filename>test/Succeed/WErrorOverride.agda module WErrorOverride where postulate IO : Set → Set {-# COMPILE GHC IO = type IO #-} {-# BUILTIN IO IO #-} infixl 1 _>>=_ postulate return : {A : Set} → A → IO A _>>=_ : {A : Set} {B : Set} → IO A → (A → IO B) → IO B {-# COMPILE GHC return = \_ -> return #-} {-# COMPILE GHC _>>=_ = \_ _ -> (>>=) #-} ------------------------------------------------------------------------ -- An error should be raised if one tries to do something like this: data PartialBool : Set where true : PartialBool {-# COMPILE GHC PartialBool = data Bool (True) #-} -- However one can override such behaviour by passing the flag -- --ghc-flag=-Wwarn to Agda upon compilation. main = return true
src/isa/avx2/masm/vrda_exp_fma3.asm
jepler/aocl-libm-ose
66
3843
<reponame>jepler/aocl-libm-ose<filename>src/isa/avx2/masm/vrda_exp_fma3.asm<gh_stars>10-100 ; ; Copyright (C) 2008-2020 Advanced Micro Devices, Inc. All rights reserved. ; ; Redistribution and use in source and binary forms, with or without modification, ; are permitted provided that the following conditions are met: ; 1. Redistributions of source code must retain the above copyright notice, ; this list of conditions and the following disclaimer. ; 2. Redistributions in binary form must reproduce the above copyright notice, ; this list of conditions and the following disclaimer in the documentation ; and/or other materials provided with the distribution. ; 3. 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. ; include exp_tables.inc include fm.inc FN_PROTOTYPE_FMA3 vrda_exp stack_size EQU 88h save_rdi equ 20h save_rsi equ 30h save_xmm10 equ 40h save_xmm9 equ 60h text SEGMENT EXECUTE PUBLIC fname fname PROC FRAME StackAllocate stack_size SaveReg rdi,save_rdi SaveReg rsi,save_rsi SaveXmm xmm10,save_xmm10 SaveXmm xmm9,save_xmm9 .ENDPROLOG mov rdi,rcx mov rsi, rdx mov rdx, r8 cmp edi,00h jle L__return cmp rsi,00h je L__return cmp rdx,00h je L__return ALIGN 16 L__process_next2: sub rdi,02h cmp rdi,-1 jle L__process_first1 movdqu xmm0,[rsi + rdi * 8] jmp L__start ALIGN 16 L__process_first1: jl L__return ;even all,elements are processed rdi == -2 mov rcx,00h movsd xmm0,QWORD PTR[rsi + rcx * 8] ALIGN 16 L__start: vmovdqa xmm10,xmm0 ; save for later use ; x * (64/ln(2)) vmulpd xmm3,xmm0,L__real_64_by_log2 ; n = int( x * (64/ln(2)) ) vcvttpd2dq xmm4,xmm3 ;xmm4 = 0,0,(int)n1,(int)n0 vcvtdq2pd xmm3,xmm4 ;xmm3 = (double)n1,n0 vmovq rcx,xmm4 ;rcx = (int)n1,n0 ; r1 = x - n * ln(2)/64 head ; r2 = - n * ln(2)/64 tail ; r = r1+r2 vmovdqa xmm2, xmm3 vfmadd132pd xmm2,xmm0,L__log2_by_64_mhead vfmadd231pd xmm2,xmm3,L__log2_by_64_mtail ;xmm2 = r r_0,_1 ;j = n & 03fh mov rax,00000003f0000003fh and rax,rcx ;rax = j1,j0 mov ecx,eax ;rcx = j0 shr rax,32 ;rax = j1 ; m = (n - j) / 64 vpsrad xmm5,xmm4,6 ;xmm5 = 0,0,m m0,1 ; q = r + r^2*1/2 + r^3*1/6 + r^4 *1/24 + r^5*1/120 + r^6*1/720 ; q = r + r*r*(1/2 + r*(1/6+ r*(1/24 + r*(1/120 + r*(1/720))))) vmovapd xmm3,L__real_1_by_720 vfmadd213pd xmm3 ,xmm2,L__real_1_by_120 vfmadd213pd xmm3 ,xmm2,L__real_1_by_24 vfmadd213pd xmm3 ,xmm2,L__real_1_by_6 vfmadd213pd xmm3 ,xmm2,L__real_1_by_2 vmulpd xmm0,xmm2,xmm2 vfmadd213pd xmm0,xmm3,xmm2 ; (f)*(q) + f2 + f1 lea r9,L__two_to_jby64_table lea r11,L__two_to_jby64_tail_table lea r10,L__two_to_jby64_head_table vmovsd xmm2,QWORD PTR[r9 + rcx * 8] vmovhpd xmm1,xmm2,QWORD PTR[r9 + rax * 8] ;xmm1 = f f_0,_1 vmovsd xmm2,QWORD PTR[r11 + rcx * 8] vmovhpd xmm3,xmm2,QWORD PTR[r11 + rax * 8] ;xmm3 = f2 f2_0,_1 vmovsd xmm4,QWORD PTR[r10 + rcx * 8] vmovhpd xmm2,xmm4,QWORD PTR[r10 + rax * 8] ;xmm2 = f1 f1_0,_1 vfmadd231pd xmm3,xmm0,xmm1 ;xmm4 = f*q + f2 vaddpd xmm0,xmm2,xmm3 ; normal results vpmovsxdq xmm4,xmm5 ;xmm4 = m1,m0 vpsllq xmm5,xmm4,52 ;xmm5 = 2^m 2,1^m0 vpaddq xmm1,xmm0,xmm5 ;xmm1 = normal results ;check and process denormals vcmppd xmm3 ,xmm0,L__real_one,1 ;check e^r < 1 vpcmpeqq xmm2,xmm5,XMMWORD PTR L__m1022 ;check m == -1022 vpand xmm3,xmm3,xmm2 ;xmm3 = ( e^r < 1 and m = -1022 ) vmovdqa xmm2, XMMWORD PTR L__m1022 vpcmpgtq xmm2,xmm2,xmm5 ;check m < -1022 vpor xmm2,xmm2,xmm3 ;xmm2 = mask for inputs requiring denormal processing vpmovmskb eax,xmm2 cmp eax,0 je L__check_min ;jmp to avoid any accidental intermediate denormal results vpaddq xmm3,xmm4,L__ulong_1074 ;xmm3 = 1074 + m vunpckhpd xmm9,xmm3,xmm3 ;store high to xmm9 vmovdqa xmm5,XMMWORD PTR L__ulong_1 vpsllq xmm4,xmm5,xmm3 vpsllq xmm9,xmm5,xmm9 vunpcklpd xmm4,xmm4,xmm9 vmulpd xmm3,xmm0,xmm4 ;xmm3 = results for denormal numbers ;vpcmov xmm1 ,xmm3,xmm1,xmm2 VANDNPD xmm9 , xmm2, xmm1 VANDPD xmm1 , xmm3, xmm2 VORPD xmm1 , xmm1, xmm9 L__check_min: ;;special case for any x < min remove,_exp_arg this code if the above code takes care of this vcmppd xmm2 ,xmm10,L__min_exp_arg,2 ;cmp x<= min_exp_arg vpxor xmm4,xmm3,xmm3 ;make zeros to put in place of x<= min_exp_arg ;vpcmov xmm1 ,xmm4,xmm1,xmm2 ;put zeros in place of any x <= min_exp_arg VANDNPD xmm9 , xmm2, xmm1 VANDPD xmm1 , xmm4, xmm2 VORPD xmm1 , xmm1, xmm9 vcmppd xmm3 ,xmm10,L__denormal_tiny_threshold,2 vpandn xmm4,xmm2,xmm3 vmovdqa xmm2,XMMWORD PTR L__real_smallest_denormal ;vpcmov xmm1 ,xmm2,xmm1,xmm4 ;xmm1 = normal results VANDNPD xmm9, xmm4, xmm1 VANDPD xmm1, xmm2, xmm4 VORPD xmm1, xmm1, xmm9 ;;special case for any x > max remove,_exp_arg this code if the above code takes care of this vcmppd xmm2 ,xmm10,L__max_exp_arg,1 ;cmp x < max_exp_arg vmovdqa xmm3,XMMWORD PTR L__real_inf ;inf to put in place of any x >= max_exp_arg ;vpcmov xmm1 ,xmm1,xmm3,xmm2 ;xmm1 = normal results VANDNPD xmm9 , xmm2, xmm3 VANDPD xmm1 , xmm1, xmm2 VORPD xmm1 , xmm1, xmm9 ;;special case for any x = na remove,n this code if the above code takes care of this vcmppd xmm2 ,xmm10,xmm10,00h vaddpd xmm3,xmm10,xmm10 ;make qnan to put in place of any x =nan ;vpcmov xmm0 ,xmm1,xmm3,xmm2 ;xmm0 = normal results VANDNPD xmm9, xmm2, xmm3 VANDPD xmm0, xmm1, xmm2 VORPD xmm0, xmm0, xmm9 cmp rdi,-1 je L__store1 movdqu [rdx + rdi * 8],xmm0 jmp L__process_next2 ALIGN 16 L__store1: inc rdi movsd QWORD PTR[rdx + rdi * 8],xmm0 L__return: RestoreXmm xmm9, save_xmm9 RestoreXmm xmm10, save_xmm10 RestoreReg rsi,save_rsi RestoreReg rdi,save_rdi StackDeallocate stack_size ret fname endp TEXT ENDS data SEGMENT READ PAGE ALIGN 16 L__max_exp_arg DQ 040862e42fefa39f0h, 040862e42fefa39f0h ;40862e42fefa39ef40862e42fefa39ef L__denormal_tiny_threshold DQ 0c0874046dfefd9d0h, 0c0874046dfefd9d0h L__min_exp_arg DQ 0c0874910d52d3051h, 0c0874910d52d3051h L__real_64_by_log2 DQ 040571547652b82feh, 040571547652b82feh ; 64/ln(2) L__log2_by_64_mhead DQ 0bf862e42fefa0000h, 0bf862e42fefa0000h L__log2_by_64_mtail DQ 0bd1cf79abc9e3b39h, 0bd1cf79abc9e3b39h L__real_one DQ 03ff0000000000000h, 03ff0000000000000h L__real_smallest_denormal DQ 00000000000000001h, 00000000000000001h L__real_inf DQ 07ff0000000000000h, 07ff0000000000000h L__m1022 DQ 0c020000000000000h, 0c020000000000000h L__ulong_1074 DQ 00000000000000432h, 00000000000000432h L__ulong_1 DQ 00000000000000001h, 00000000000000001h data ENDS END
src/natools-web-filters-text_blocks.adb
faelys/natools-web
1
2541
------------------------------------------------------------------------------ -- Copyright (c) 2015, <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. -- ------------------------------------------------------------------------------ with Natools.Web.Escapes; package body Natools.Web.Filters.Text_Blocks is Begin_Paragraph : constant Ada.Streams.Stream_Element_Array := (1 => Character'Pos ('<'), 2 => Character'Pos ('p'), 3 => Character'Pos ('>')); End_Paragraph : constant Ada.Streams.Stream_Element_Array := (1 => Character'Pos ('<'), 2 => Character'Pos ('/'), 3 => Character'Pos ('p'), 4 => Character'Pos ('>')); function Newline (Encoding : Newline_Encoding) return Ada.Streams.Stream_Element_Array; -- Return the newline representation assicated with Encoding ------------------------------ -- Local Helper Subprograms -- ------------------------------ function Newline (Encoding : Newline_Encoding) return Ada.Streams.Stream_Element_Array is begin case Encoding is when CR => return (1 => 13); when LF => return (1 => 10); when CR_LF => return (1 => 13, 2 => 10); end case; end Newline; ---------------------- -- Public Interface -- ---------------------- overriding procedure Apply (Object : in Filter; Output : in out Ada.Streams.Root_Stream_Type'Class; Data : in Ada.Streams.Stream_Element_Array) is use type Ada.Streams.Stream_Element_Offset; type Automaton_State is (CR_Read, LF_Read, Newline_Read, Between_Paragraphs, In_Text); State : Automaton_State := Between_Paragraphs; Index : Ada.Streams.Stream_Element_Offset := Data'First; begin while Index in Data'Range loop case Data (Index) is when 13 => case State is when CR_Read | Newline_Read => Output.Write (End_Paragraph); Output.Write (Newline (Object.Encoding)); State := Between_Paragraphs; when LF_Read => State := Newline_Read; when Between_Paragraphs => null; when In_Text => State := CR_Read; end case; Index := Index + 1; when 10 => case State is when LF_Read | Newline_Read => Output.Write (End_Paragraph); State := Between_Paragraphs; when CR_Read => State := Newline_Read; when Between_Paragraphs => null; when In_Text => State := LF_Read; end case; Index := Index + 1; when others => case State is when CR_Read | LF_Read | Newline_Read => Output.Write (Newline (Object.Encoding)); when Between_Paragraphs => Output.Write (Begin_Paragraph); when In_Text => null; end case; State := In_Text; declare Next : Ada.Streams.Stream_Element_Offset := Index + 1; begin while Next in Data'Range and then Data (Next) not in 10 | 13 loop Next := Next + 1; end loop; Escapes.Write (Output, Data (Index .. Next - 1), Escapes.HTML_Body); Index := Next; end; end case; end loop; case State is when Between_Paragraphs => null; when CR_Read | LF_Read | Newline_Read | In_Text => Output.Write (End_Paragraph); Output.Write (Newline (Object.Encoding)); end case; end Apply; function Create (Arguments : in out S_Expressions.Lockable.Descriptor'Class) return Filters.Filter'Class is use type S_Expressions.Events.Event; Result : Filter; begin if Arguments.Current_Event = S_Expressions.Events.Add_Atom then begin Result.Encoding := Newline_Encoding'Value (S_Expressions.To_String (Arguments.Current_Atom)); exception when Constraint_Error => null; end; end if; return Result; end Create; not overriding procedure Set_Newline_Encoding (Object : in out Filter; Encoding : in Newline_Encoding) is begin Object.Encoding := Encoding; end Set_Newline_Encoding; end Natools.Web.Filters.Text_Blocks;
Src/Ant8/Tests/Ant8/basic/02_add_r0.asm
geoffthorpe/ant-architecture
0
10496
<reponame>geoffthorpe/ant-architecture # $Id: 02_add_r0.asm,v 1.2 2001/03/22 00:39:03 ellard Exp $ # # Copyright 1999-2000 by the President and Fellows of Harvard College. # See LICENSE.txt for license information. # #@ tests add for r0 # OK lc r2, 1 add r0, r2, r2 hlt
src/asf-applications-views.ads
jquorning/ada-asf
12
10515
----------------------------------------------------------------------- -- applications.views -- Ada Web Application -- Copyright (C) 2009, 2010, 2011, 2012, 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 Util.Locales; with ASF.Components.Root; with ASF.Contexts.Faces; with ASF.Views.Facelets; with ASF.Factory; with Ada.Strings.Unbounded; package ASF.Applications.Views is No_View : exception; type Local_Array_Access is access Util.Locales.Locale_Array; -- ------------------------------ -- View Handler -- ------------------------------ -- The view handler manages the component tree, the request processing -- life cycle and rendering the result view. type View_Handler is tagged limited private; type View_Handler_Access is access all View_Handler'Class; -- Initialize the view handler. procedure Initialize (Handler : out View_Handler; Components : access ASF.Factory.Component_Factory; Conf : in Config); -- Restore the view identified by the given name in the faces context -- and create the component tree representing that view. procedure Restore_View (Handler : in out View_Handler; Name : in String; Context : in out ASF.Contexts.Faces.Faces_Context'Class; View : out ASF.Components.Root.UIViewRoot; Ignore : in Boolean := False); -- Create a new UIViewRoot instance initialized from the context and with -- the view identifier. If the view is a valid view, create the component tree -- representing that view. procedure Create_View (Handler : in out View_Handler; Name : in String; Context : in out ASF.Contexts.Faces.Faces_Context'Class; View : out ASF.Components.Root.UIViewRoot; Ignore : in Boolean := False); -- Render the view represented by the component tree. The view is -- rendered using the context. procedure Render_View (Handler : in out View_Handler; Context : in out ASF.Contexts.Faces.Faces_Context'Class; View : in ASF.Components.Root.UIViewRoot); -- Compute the locale that must be used according to the <b>Accept-Language</b> request -- header and the application supported locales. function Calculate_Locale (Handler : in View_Handler; Context : in ASF.Contexts.Faces.Faces_Context'Class) return Util.Locales.Locale; -- Get the URL suitable for encoding and rendering the view specified by the <b>View</b> -- identifier. function Get_Action_URL (Handler : in View_Handler; Context : in ASF.Contexts.Faces.Faces_Context'Class; View : in String) return String; -- Get the URL for redirecting the user to the specified view. function Get_Redirect_URL (Handler : in View_Handler; Context : in ASF.Contexts.Faces.Faces_Context'Class; View : in String) return String; -- Closes the view handler procedure Close (Handler : in out View_Handler); -- Set the extension mapping rule to find the facelet file from -- the name. procedure Set_Extension_Mapping (Handler : in out View_Handler; From : in String; Into : in String); -- Get the facelet name from the view name. function Get_Facelet_Name (Handler : in View_Handler; Name : in String) return String; -- Register a module -- procedure Register_Module (Handler : in out View_Handler; -- Module : in ASF.Modules.Module_Access); private type View_Handler is tagged limited record Facelets : aliased ASF.Views.Facelets.Facelet_Factory; Paths : Ada.Strings.Unbounded.Unbounded_String; View_Ext : Ada.Strings.Unbounded.Unbounded_String; File_Ext : Ada.Strings.Unbounded.Unbounded_String; Locales : Local_Array_Access := null; end record; end ASF.Applications.Views;
libsrc/_DEVELOPMENT/adt/p_list/z80/asm_p_list_back.asm
meesokim/z88dk
0
103614
; =============================================================== ; Jan 2014 ; =============================================================== ; ; void *p_list_back(p_list_t *list) ; ; Return item at back of list without removing it from the list. ; ; =============================================================== SECTION code_adt_p_list PUBLIC asm_p_list_back EXTERN asm_p_forward_list_front asm_p_list_back: inc hl inc hl jp asm_p_forward_list_front ; enter : hl = p_list_t *list ; ; exit : success ; ; hl = void *item (item at front) ; nz flag set ; ; fail if list is empty ; ; hl = 0 ; z flag set ; ; uses : af, hl
oeis/105/A105038.asm
neoneye/loda-programs
11
2024
; A105038: Nonnegative n such that 6*n^2 + 6*n + 1 is a square. ; Submitted by <NAME>(s1) ; 0,4,44,440,4360,43164,427284,4229680,41869520,414465524,4102785724,40613391720,402031131480,3979697923084,39394948099364,389969783070560,3860302882606240,38213059042991844,378270287547312204,3744489816430130200,37066627876753989800,366921788951109767804,3632151261634343688244,35954590827392327114640,355913757012288927458160,3523182979295496947466964,34875916035942680547211484,345235977380131308524647880,3417483857765370404699267320,33829602600273572738468025324,334878542144970356979980985924 lpb $0 sub $0,1 mov $1,$3 mul $1,8 add $2,1 add $2,$1 add $3,$2 lpe mov $0,$3 mul $0,4
applet/aide/source/editors/aide-editor-of_enumeration_literal.ads
charlie5/aIDE
3
11584
<reponame>charlie5/aIDE<filename>applet/aide/source/editors/aide-editor-of_enumeration_literal.ads with AdaM.a_Type.enumeration_literal, gtk.Widget; private with gtk.gEntry, gtk.Box, gtk.Button; limited with adam.a_Type.enumeration_type; package aIDE.Editor.of_enumeration_literal is type Item is new Editor.item with private; type View is access all Item'Class; type enumeration_type_view is access all AdaM.a_Type.enumeration_type.item'Class; package Forge is function to_Editor (the_Target : in AdaM.a_Type.enumeration_literal.view; targets_Parent : in enumeration_type_view) return View; end Forge; overriding function top_Widget (Self : in Item) return gtk.Widget.Gtk_Widget; private use gtk.Button, gtk.gEntry, gtk.Box; type Item is new Editor.item with record Target : AdaM.a_Type.enumeration_literal.view; Targets_Parent : enumeration_type_view; top_Box : gtk_Box; name_Entry : Gtk_Entry; rid_Button : gtk_Button; end record; end aIDE.Editor.of_enumeration_literal;
oeis/001/A001169.asm
neoneye/loda-programs
11
99902
<filename>oeis/001/A001169.asm ; A001169: Number of board-pile polyominoes with n cells. ; Submitted by <NAME> ; 1,2,6,19,61,196,629,2017,6466,20727,66441,212980,682721,2188509,7015418,22488411,72088165,231083620,740754589,2374540265,7611753682,24400004911,78215909841,250726529556,803721298537,2576384425157,8258779154250,26474089989299,84864533567373,272039154528772,872040397629445,2795386040715313,8960804038285538,28724479496938279,92078313379553881,295163426572343604,946166857192593969,3033003553474780141,9722503473315117338,31166159921022501579,99905289505805807093,320253341975131993764 mov $10,$0 mov $12,2 lpb $12 mov $0,$10 mov $7,0 sub $12,1 add $0,$12 sub $0,1 mov $6,$0 mov $8,2 lpb $8 mov $0,$6 mov $5,0 sub $8,1 add $0,$8 sub $0,1 mov $1,2 mov $2,1 mov $3,$0 lpb $3 add $1,$5 add $5,$2 mul $2,2 add $2,$1 mul $1,2 sub $3,1 lpe mov $0,$2 mov $9,$8 mul $9,$2 add $7,$9 lpe min $6,1 mul $6,$0 mov $0,$7 sub $0,$6 mov $4,$12 mul $4,$0 add $11,$4 lpe min $10,1 mul $10,$0 mov $0,$11 sub $0,$10
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_66_436.asm
ljhsiun2/medusa
9
5562
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_normal_ht+0xd396, %rsi lea addresses_WT_ht+0xf1d6, %rdi nop sub $32669, %rbx mov $77, %rcx rep movsw nop nop nop nop and $35182, %rbp lea addresses_normal_ht+0x14866, %rdi nop add %rbx, %rbx movl $0x61626364, (%rdi) nop nop cmp $56074, %rsi pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r8 push %rbp push %rdx push %rsi // Store lea addresses_UC+0x10536, %r13 nop nop nop nop nop and %rsi, %rsi movb $0x51, (%r13) nop nop nop nop cmp $8495, %rsi // Faulty Load lea addresses_D+0x173d6, %r8 nop nop nop nop nop dec %rdx vmovups (%r8), %ymm3 vextracti128 $0, %ymm3, %xmm3 vpextrq $1, %xmm3, %r13 lea oracles, %rbp and $0xff, %r13 shlq $12, %r13 mov (%rbp,%r13,1), %r13 pop %rsi pop %rdx pop %rbp pop %r8 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': True, 'congruent': 4}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_D', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 5}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 9}} {'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': True, 'congruent': 2}} {'36': 66} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
itunes/get-itunes-info.applescript
pahoughton/pah-misc-applescript
0
2974
#!/usr/bin/osascript set aFn to (path to desktop as text) & "mac_book_ittracs01.txt" tell application "iTunes" set myOut to open for access aFn with write permission repeat with curTrack in tracks tell curTrack set t_did to database id set t_id to id set t_art to artist set t_nm to name write "d:" & t_did & "\t" & t_id & "\t" & location to myOut write "\t" & played count & "\t" & played date to myOut write "\n" to myOut end tell -- set cnt to cnt + finish of curTrack end repeat close access myOut end tell
source/unary/str.asm
paulscottrobson/Basic65816
0
179404
; ******************************************************************************************* ; ******************************************************************************************* ; ; Name : str.asm ; Purpose : Integer to String. ; Date : 11th July 2019 ; Author : <EMAIL> ; ; ******************************************************************************************* ; ******************************************************************************************* ; ******************************************************************************************* ; ; str$(number,base) ; ; ******************************************************************************************* Function_Str: ;; str$( jsr ResetTypeString ; returns a string. jsr EvaluateNextInteger ; get the value you are absoluting pha ; save YA on the stack phy jsr VALGetBase ; process , base (shared with STR$()) sta DSignCount ply ; YA is the number pla phx ldx DSignCount ; X is the base. jsr ConvertToString ; convert it to a string. plx ; restore X sta EXSValueL+0,x ; save the result stz EXSValueH+0,x rts ; ******************************************************************************************* ; ; Convert YA to string in base X, returns a string in temporary memory. ; ; ******************************************************************************************* ConvertToString: pha lda #34 ; enough space for Base 2. jsr StringTempAllocate ; allocate space for return string. pla ConvertToStringAlreadyAllocated: phx ; save X (base) sta DTemp3 ; save number in DTemp3 sty DTemp3+2 stx DSignCount ; save base in DSignCount. lda DTemp3+2 ; is number -ve. bpl _CTSNotNegative lda #"-" ; output a minus character to the new string jsr CTSOutputA sec ; negate DTemp3 which is the number lda #0 sbc DTemp3 sta DTemp3 lda #0 sbc DTemp3+2 sta DTemp3+2 _CTSNotNegative: lda #1 ; push 32-bit 1 on stack, which is the first subtractor. pha lda #0 pha lda DSignCount ; reset DTemp1, the subtractor to the base value sta DTemp1 stz DTemp1+2 ; ; Scale up subtractor (DTemp1), so it is more than the number (DTemp3) ; _CTSMultiplySubtractor: sec ; check number vs subtractor lda DTemp3 sbc DTemp1 lda DTemp3+2 sbc DTemp1+2 bcc _CTSScaledUp ; if >= then scaled up. ; lda DTemp1 ; push subtractor on the stack pha lda DTemp1+2 pha ; lda DSignCount ; multiply subtractor by base jsr MultiplyTemp1ByA bcs _CTSScaledUp ; if overflow, start subtracting. bra _CTSMultiplySubtractor ; otherwise try the next x base. ; ; Subtractor now >= number. Top of the pop-and-subtract loop. ; _CTSScaledUp: ply ; YA contains the previous divider. pla cpy #0 ; has that divider reached one yet ? bne _CTSHasDigit cmp #1 ; if so, then we've just got that digit left. beq _CTSExit _CTSHasDigit: sta DTemp2 ; save in DTemp2 sty DTemp2+2 ldx #0 ; this is the count. _CTSSubLoop: sec ; subtract subtractor from number lda DTemp3 sbc DTemp2 tay ; intermediate in Y lda DTemp3+2 sbc DTemp2+2 bcc _CTSFinishedSubtracting ; if number < subtractor then completed this one. sta DTemp3+2 ; output the number to DTemp3. sty DTemp3 inx ; one more subtraction bra _CTSSubLoop ; try it again. ; _CTSFinishedSubtracting: txa ; convert to ASCII. jsr CTSOutputHexDigit ; write that out. bra _CTSScaledUp ; go pop the next subtactor and do that. ; _CTSExit: lda DTemp3 ; output last digit jsr CTSOutputHexDigit lda DStartTempString ; return string address. plx ; restore X. rts ; ; Output one digit to the string. ; CTSOutputHexDigit: cmp #10 ; 0-9 are 48-56 bcc _CTSNotLetter clc adc #65-58+32 ; shift for bases > 10 _CTSNotLetter: clc adc #48 CTSOutputA: phy ; save Y, set Y to current pointer ldy DCurrentTempString sta $0000,y ; write out, with a following zero. sep #$20 ; save in 8 bit mode. lda (DStartTempString) ; increment character count. inc a sta (DStartTempString) rep #$20 inc DCurrentTempString ; advance the pointer. ply ; restore Y and exit. rts
programs/oeis/047/A047293.asm
karttu/loda
1
18220
<reponame>karttu/loda ; A047293: Numbers that are congruent to {0, 2, 4, 6} mod 7. ; 0,2,4,6,7,9,11,13,14,16,18,20,21,23,25,27,28,30,32,34,35,37,39,41,42,44,46,48,49,51,53,55,56,58,60,62,63,65,67,69,70,72,74,76,77,79,81,83,84,86,88,90,91,93,95,97,98,100,102,104,105,107,109,111,112,114,116,118,119,121,123,125,126,128,130,132,133,135,137,139,140,142,144,146,147,149,151,153,154,156,158,160,161,163,165,167,168,170,172,174,175,177,179,181,182,184,186,188,189,191,193,195,196,198,200,202,203,205,207,209,210,212,214,216,217,219,221,223,224,226,228,230,231,233,235,237,238,240,242,244,245,247,249,251,252,254,256,258,259,261,263,265,266,268,270,272,273,275,277,279,280,282,284,286,287,289,291,293,294,296,298,300,301,303,305,307,308,310,312,314,315,317,319,321,322,324,326,328,329,331,333,335,336,338,340,342,343,345,347,349,350,352,354,356,357,359,361,363,364,366,368,370,371,373,375,377,378,380,382,384,385,387,389,391,392,394,396,398,399,401,403,405,406,408,410,412,413,415,417,419,420,422,424,426,427,429,431,433,434,436 mov $1,$0 mul $1,7 add $1,3 div $1,4
src/ewok-perm.adb
PThierry/ewok-kernel
0
11141
<gh_stars>0 -- -- Copyright 2018 The wookey project team <<EMAIL>> -- - <NAME> -- - Arnauld Michelizza -- - <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. -- -- #if CONFIG_KERNEL_DOMAIN with ewok.tasks; #end if; package body ewok.perm with spark_mode => on is function dmashm_is_granted (from : in t_real_task_id; to : in t_real_task_id) return boolean is begin return ewok.perm_auto.com_dmashm_perm (from, to); end dmashm_is_granted; function ipc_is_granted (from : in t_real_task_id; to : in t_real_task_id) return boolean is begin return ewok.perm_auto.com_ipc_perm (from, to); end ipc_is_granted; #if CONFIG_KERNEL_DOMAIN function is_same_domain (from : in t_real_task_id; to : in t_real_task_id) return boolean with spark_mode => off -- implies tasks.get_domain() to be SPARK compatible is begin return ewok.tasks.get_domain (from) = ewok.tasks.get_domain (to); end is_same_domain; #end if; function ressource_is_granted (perm_name : in t_perm_name; task_id : in applications.t_real_task_id) return boolean is begin -- is there some assertion checking that some ressources tuples are -- forbidden case perm_name is when PERM_RES_DEV_DMA => return ewok.perm_auto.ressource_perm_register_tab(task_id).DEV_DMA = 1; when PERM_RES_DEV_CRYPTO_USR => return ewok.perm_auto.ressource_perm_register_tab(task_id).DEV_CRYPTO = 1 or ewok.perm_auto.ressource_perm_register_tab(task_id).DEV_CRYPTO = 3; when PERM_RES_DEV_CRYPTO_CFG => return ewok.perm_auto.ressource_perm_register_tab(task_id).DEV_CRYPTO = 2 or ewok.perm_auto.ressource_perm_register_tab(task_id).DEV_CRYPTO = 3; when PERM_RES_DEV_CRYPTO_FULL => return ewok.perm_auto.ressource_perm_register_tab(task_id).DEV_CRYPTO = 3; when PERM_RES_DEV_BUSES => return ewok.perm_auto.ressource_perm_register_tab(task_id).DEV_BUS = 1; when PERM_RES_DEV_EXTI => return ewok.perm_auto.ressource_perm_register_tab(task_id).DEV_EXTI = 1; when PERM_RES_DEV_TIM => return ewok.perm_auto.ressource_perm_register_tab(task_id).DEV_TIM = 1; when PERM_RES_TIM_GETMILLI => return ewok.perm_auto.ressource_perm_register_tab(task_id).TIM_TIME > 0; when PERM_RES_TIM_GETMICRO => return ewok.perm_auto.ressource_perm_register_tab(task_id).TIM_TIME > 1; when PERM_RES_TIM_GETCYCLE => return ewok.perm_auto.ressource_perm_register_tab(task_id).TIM_TIME > 2; when PERM_RES_TSK_FISR => return ewok.perm_auto.ressource_perm_register_tab(task_id).TSK_FISR = 1; when PERM_RES_TSK_FIPC => return ewok.perm_auto.ressource_perm_register_tab(task_id).TSK_FIPC = 1; when PERM_RES_TSK_RESET => return ewok.perm_auto.ressource_perm_register_tab(task_id).TSK_RESET = 1; when PERM_RES_TSK_UPGRADE => return ewok.perm_auto.ressource_perm_register_tab(task_id).TSK_UPGRADE = 1; when PERM_RES_TSK_RNG => return ewok.perm_auto.ressource_perm_register_tab(task_id).TSK_RNG = 1; when PERM_RES_MEM_DYNAMIC_MAP => return ewok.perm_auto.ressource_perm_register_tab(task_id).MEM_DYNAMIC_MAP = 1; end case; end ressource_is_granted; end ewok.perm;
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_1126.asm
ljhsiun2/medusa
9
29027
<filename>Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_1126.asm<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r13 push %r14 push %r15 push %rax push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0xd267, %r15 add $3552, %rsi mov $0x6162636465666768, %rdx movq %rdx, %xmm0 vmovups %ymm0, (%r15) nop nop xor $64472, %rax lea addresses_WC_ht+0x7, %r14 nop nop nop nop xor $59981, %r15 mov $0x6162636465666768, %r13 movq %r13, %xmm0 movups %xmm0, (%r14) nop nop nop nop cmp %rax, %rax lea addresses_D_ht+0x1b467, %rsi lea addresses_WT_ht+0xa267, %rdi nop nop add $60829, %r13 mov $79, %rcx rep movsw nop nop and $48299, %rsi lea addresses_D_ht+0x17a27, %rdi clflush (%rdi) nop nop nop sub %rax, %rax mov $0x6162636465666768, %rdx movq %rdx, %xmm3 vmovups %ymm3, (%rdi) nop nop nop nop nop and %rdi, %rdi lea addresses_A_ht+0x11a27, %rcx nop nop nop nop nop cmp $9041, %rsi mov $0x6162636465666768, %rdx movq %rdx, (%rcx) add %rax, %rax lea addresses_UC_ht+0x1267, %rdi nop nop nop nop and $63694, %r15 mov $0x6162636465666768, %rsi movq %rsi, %xmm3 movups %xmm3, (%rdi) nop inc %rsi lea addresses_A_ht+0x19267, %rsi lea addresses_UC_ht+0xf59d, %rdi nop nop nop nop cmp %rax, %rax mov $74, %rcx rep movsb nop nop sub $2624, %rax lea addresses_A_ht+0x1a67, %rdi nop add $65209, %rax movb $0x61, (%rdi) add %r13, %r13 pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r15 pop %r14 pop %r13 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r14 push %rax push %rcx push %rsi // Store lea addresses_WT+0x1d11d, %r10 sub %rax, %rax mov $0x5152535455565758, %r14 movq %r14, (%r10) nop nop nop sub $4619, %rax // Store lea addresses_A+0x15c67, %r11 nop nop nop nop nop xor %rsi, %rsi mov $0x5152535455565758, %r14 movq %r14, %xmm4 movups %xmm4, (%r11) nop nop add $39122, %rcx // Faulty Load lea addresses_RW+0xb267, %r11 nop sub $8106, %rsi movups (%r11), %xmm0 vpextrq $1, %xmm0, %r14 lea oracles, %r11 and $0xff, %r14 shlq $12, %r14 mov (%r11,%r14,1), %r14 pop %rsi pop %rcx pop %rax pop %r14 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 1, 'same': False, 'type': 'addresses_WT'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 8, 'same': False, 'type': 'addresses_A'}, 'OP': 'STOR'} [Faulty Load] {'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': True, 'type': 'addresses_RW'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 8, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 5, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'} {'src': {'congruent': 9, 'same': False, 'type': 'addresses_D_ht'}, 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 4, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 6, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 10, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'} {'src': {'congruent': 11, 'same': True, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'} {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 11, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
include/sf-graphics-text.ads
Fabien-Chouteau/ASFML
0
828
<reponame>Fabien-Chouteau/ASFML --////////////////////////////////////////////////////////// -- SFML - Simple and Fast Multimedia Library -- Copyright (C) 2007-2018 <NAME> (<EMAIL>) -- This software is provided 'as-is', without any express or implied warranty. -- In no event will the authors be held liable for any damages arising from the use of this software. -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it freely, -- subject to the following restrictions: -- 1. The origin of this software must not be misrepresented; -- you must not claim that you wrote the original software. -- If you use this software in a product, an acknowledgment -- in the product documentation would be appreciated but is not required. -- 2. Altered source versions must be plainly marked as such, -- and must not be misrepresented as being the original software. -- 3. This notice may not be removed or altered from any source distribution. --////////////////////////////////////////////////////////// with Sf.System.Vector2; with Sf.Graphics.Transform; with Sf.Graphics.Color; with Sf.Graphics.Rect; package Sf.Graphics.Text is --////////////////////////////////////////////////////////// --/ sfText styles --////////////////////////////////////////////////////////// --/< Regular characters, no style --/< Bold characters --/< Italic characters --/< Underlined characters --/< Strike through characters subtype sfTextStyle is sfUint32; sfTextRegular : constant sfTextStyle := 0; sfTextBold : constant sfTextStyle := 1; sfTextItalic : constant sfTextStyle := 2; sfTextUnderlined : constant sfTextStyle := 4; sfTextStrikeThrough : constant sfTextStyle := 8; --////////////////////////////////////////////////////////// --/ @brief Create a new text --/ --/ @return A new sfText object, or NULL if it failed --/ --////////////////////////////////////////////////////////// function create return sfText_Ptr; --////////////////////////////////////////////////////////// --/ @brief Copy an existing text --/ --/ @param text Text to copy --/ --/ @return Copied object --/ --////////////////////////////////////////////////////////// function copy (text : sfText_Ptr) return sfText_Ptr; --////////////////////////////////////////////////////////// --/ @brief Destroy an existing text --/ --/ @param text Text to delete --/ --////////////////////////////////////////////////////////// procedure destroy (text : sfText_Ptr); --////////////////////////////////////////////////////////// --/ @brief Set the position of a text --/ --/ This function completely overwrites the previous position. --/ See sfText_move to apply an offset based on the previous position instead. --/ The default position of a text Text object is (0, 0). --/ --/ @param text Text object --/ @param position New position --/ --////////////////////////////////////////////////////////// procedure setPosition (text : sfText_Ptr; position : Sf.System.Vector2.sfVector2f); --////////////////////////////////////////////////////////// --/ @brief Set the orientation of a text --/ --/ This function completely overwrites the previous rotation. --/ See sfText_rotate to add an angle based on the previous rotation instead. --/ The default rotation of a text Text object is 0. --/ --/ @param text Text object --/ @param angle New rotation, in degrees --/ --////////////////////////////////////////////////////////// procedure setRotation (text : sfText_Ptr; angle : float); --////////////////////////////////////////////////////////// --/ @brief Set the scale factors of a text --/ --/ This function completely overwrites the previous scale. --/ See sfText_scale to add a factor based on the previous scale instead. --/ The default scale of a text Text object is (1, 1). --/ --/ @param text Text object --/ @param scale New scale factors --/ --////////////////////////////////////////////////////////// procedure setScale (text : sfText_Ptr; scale : Sf.System.Vector2.sfVector2f); --////////////////////////////////////////////////////////// --/ @brief Set the local origin of a text --/ --/ The origin of an object defines the center point for --/ all transformations (position, scale, rotation). --/ The coordinates of this point must be relative to the --/ top-left corner of the object, and ignore all --/ transformations (position, scale, rotation). --/ The default origin of a text object is (0, 0). --/ --/ @param text Text object --/ @param origin New origin --/ --////////////////////////////////////////////////////////// procedure setOrigin (text : sfText_Ptr; origin : Sf.System.Vector2.sfVector2f); --////////////////////////////////////////////////////////// --/ @brief Get the position of a text --/ --/ @param text Text object --/ --/ @return Current position --/ --////////////////////////////////////////////////////////// function getPosition (text : sfText_Ptr) return Sf.System.Vector2.sfVector2f; --////////////////////////////////////////////////////////// --/ @brief Get the orientation of a text --/ --/ The rotation is always in the range [0, 360]. --/ --/ @param text Text object --/ --/ @return Current rotation, in degrees --/ --////////////////////////////////////////////////////////// function getRotation (text : sfText_Ptr) return float; --////////////////////////////////////////////////////////// --/ @brief Get the current scale of a text --/ --/ @param text Text object --/ --/ @return Current scale factors --/ --////////////////////////////////////////////////////////// function getScale (text : sfText_Ptr) return Sf.System.Vector2.sfVector2f; --////////////////////////////////////////////////////////// --/ @brief Get the local origin of a text --/ --/ @param text Text object --/ --/ @return Current origin --/ --////////////////////////////////////////////////////////// function getOrigin (text : sfText_Ptr) return Sf.System.Vector2.sfVector2f; --////////////////////////////////////////////////////////// --/ @brief Move a text by a given offset --/ --/ This function adds to the current position of the object, --/ unlike sfText_setPosition which overwrites it. --/ --/ @param text Text object --/ @param offset Offset --/ --////////////////////////////////////////////////////////// procedure move (text : sfText_Ptr; offset : Sf.System.Vector2.sfVector2f); --////////////////////////////////////////////////////////// --/ @brief Rotate a text --/ --/ This function adds to the current rotation of the object, --/ unlike sfText_setRotation which overwrites it. --/ --/ @param text Text object --/ @param angle Angle of rotation, in degrees --/ --////////////////////////////////////////////////////////// procedure rotate (text : sfText_Ptr; angle : float); --////////////////////////////////////////////////////////// --/ @brief Scale a text --/ --/ This function multiplies the current scale of the object, --/ unlike sfText_setScale which overwrites it. --/ --/ @param text Text object --/ @param factors Scale factors --/ --////////////////////////////////////////////////////////// procedure scale (text : sfText_Ptr; factors : Sf.System.Vector2.sfVector2f); --////////////////////////////////////////////////////////// --/ @brief Get the combined transform of a text --/ --/ @param text Text object --/ --/ @return Transform combining the position/rotation/scale/origin of the object --/ --////////////////////////////////////////////////////////// function getTransform (text : sfText_Ptr) return Sf.Graphics.Transform.sfTransform; --////////////////////////////////////////////////////////// --/ @brief Get the inverse of the combined transform of a text --/ --/ @param text Text object --/ --/ @return Inverse of the combined transformations applied to the object --/ --////////////////////////////////////////////////////////// function getInverseTransform (text : sfText_Ptr) return Sf.Graphics.Transform.sfTransform; --////////////////////////////////////////////////////////// --/ @brief Set the string of a text (from an ANSI string) --/ --/ A text's string is empty by default. --/ --/ @param text Text object --/ @param str New string --/ --////////////////////////////////////////////////////////// procedure setString (text : sfText_Ptr; str : String); --////////////////////////////////////////////////////////// --/ @brief Set the string of a text (from a unicode string) --/ --/ @param text Text object --/ @param str New string --/ --////////////////////////////////////////////////////////// procedure setUnicodeString (text : sfText_Ptr; str : access sfUint32); --////////////////////////////////////////////////////////// --/ @brief Set the font of a text --/ --/ The @a font argument refers to a texture that must --/ exist as long as the text uses it. Indeed, the text --/ doesn't store its own copy of the font, but rather keeps --/ a pointer to the one that you passed to this function. --/ If the font is destroyed and the text tries to --/ use it, the behaviour is undefined. --/ --/ @param text Text object --/ @param font New font --/ --////////////////////////////////////////////////////////// procedure setFont (text : sfText_Ptr; font : sfFont_Ptr); --////////////////////////////////////////////////////////// --/ @brief Set the character size of a text --/ --/ The default size is 30. --/ --/ @param text Text object --/ @param size New character size, in pixels --/ --////////////////////////////////////////////////////////// procedure setCharacterSize (text : sfText_Ptr; size : sfUint32); --////////////////////////////////////////////////////////// --/ @brief Set the line spacing factor --/ --/ The default spacing between lines is defined by the font. --/ This method enables you to set a factor for the spacing --/ between lines. By default the line spacing factor is 1. --/ --/ @param text Text object --/ @param spacingFactor New line spacing factor --/ --/ @see sfText_getLineSpacing --/ --////////////////////////////////////////////////////////// procedure setLineSpacing (text : sfText_Ptr; spacingFactor : float); --////////////////////////////////////////////////////////// --/ @brief Set the letter spacing factor --/ --/ The default spacing between letters is defined by the font. --/ This factor doesn't directly apply to the existing --/ spacing between each character, it rather adds a fixed --/ space between them which is calculated from the font --/ metrics and the character size. --/ Note that factors below 1 (including negative numbers) bring --/ characters closer to each other. --/ By default the letter spacing factor is 1. --/ --/ @param text Text object --/ @param spacingFactor New letter spacing factor --/ --/ @see sfText_getLetterSpacing --/ --////////////////////////////////////////////////////////// procedure setLetterSpacing (text : sfText_Ptr; spacingFactor : float); --////////////////////////////////////////////////////////// --/ @brief Set the style of a text --/ --/ You can pass a combination of one or more styles, for --/ example sfTextBold | sfTextItalic. --/ The default style is sfTextRegular. --/ --/ @param text Text object --/ @param style New style --/ --////////////////////////////////////////////////////////// procedure setStyle (text : sfText_Ptr; style : sfTextStyle); --////////////////////////////////////////////////////////// --/ @brief Set the fill color of a text --/ --/ By default, the text's fill color is opaque white. --/ Setting the fill color to a transparent color with an outline --/ will cause the outline to be displayed in the fill area of the text. --/ --/ @param text Text object --/ @param color New fill color of the text --/ --/ @deprecated This function is deprecated and may be removed in future releases. --/ Use sfText_setFillColor instead. --/ --////////////////////////////////////////////////////////// procedure setColor (text : sfText_Ptr; color : Sf.Graphics.Color.sfColor); --////////////////////////////////////////////////////////// --/ @brief Set the fill color of a text --/ --/ By default, the text's fill color is opaque white. --/ Setting the fill color to a transparent color with an outline --/ will cause the outline to be displayed in the fill area of the text. --/ --/ @param text Text object --/ @param color New fill color of the text --/ --////////////////////////////////////////////////////////// procedure setFillColor (text : sfText_Ptr; color : Sf.Graphics.Color.sfColor); --////////////////////////////////////////////////////////// --/ @brief Set the outline color of the text --/ --/ By default, the text's outline color is opaque black. --/ --/ @param text Text object --/ @param color New outline color of the text --/ --////////////////////////////////////////////////////////// procedure setOutlineColor (text : sfText_Ptr; color : Sf.Graphics.Color.sfColor); --////////////////////////////////////////////////////////// --/ @brief Set the thickness of the text's outline --/ --/ By default, the outline thickness is 0. --/ --/ Be aware that using a negative value for the outline --/ thickness will cause distorted rendering. --/ --/ @param thickness New outline thickness, in pixels --/ --/ @see getOutlineThickness --/ --////////////////////////////////////////////////////////// procedure setOutlineThickness (text : sfText_Ptr; thickness : float); --////////////////////////////////////////////////////////// --/ @brief Get the string of a text (returns an ANSI string) --/ --/ @param text Text object --/ --/ @return String as a locale-dependant ANSI string --/ --////////////////////////////////////////////////////////// function getString (text : sfText_Ptr) return String; --////////////////////////////////////////////////////////// --/ @brief Get the string of a text (returns a unicode string) --/ --/ @param text Text object --/ --/ @return String as UTF-32 --/ --////////////////////////////////////////////////////////// function getUnicodeString (text : sfText_Ptr) return access sfUint32; --////////////////////////////////////////////////////////// --/ @brief Get the font used by a text --/ --/ If the text has no font attached, a NULL pointer is returned. --/ The returned pointer is const, which means that you can't --/ modify the font when you retrieve it with this function. --/ --/ @param text Text object --/ --/ @return Pointer to the font --/ --////////////////////////////////////////////////////////// function getFont (text : sfText_Ptr) return sfFont_Ptr; --////////////////////////////////////////////////////////// --/ @brief Get the size of the characters of a text --/ --/ @param text Text object --/ --/ @return Size of the characters --/ --////////////////////////////////////////////////////////// function getCharacterSize (text : sfText_Ptr) return sfUint32; --////////////////////////////////////////////////////////// --/ @brief Get the size of the letter spacing factor --/ --/ @param text Text object --/ --/ @return Size of the letter spacing factor --/ --/ @see sfText_setLetterSpacing --/ --////////////////////////////////////////////////////////// function getLetterSpacing (text : sfText_Ptr) return float; --////////////////////////////////////////////////////////// --/ @brief Get the size of the line spacing factor --/ --/ @param text Text object --/ --/ @return Size of the line spacing factor --/ --/ @see sfText_setLineSpacing --/ --////////////////////////////////////////////////////////// function getLineSpacing (text : sfText_Ptr) return float; --////////////////////////////////////////////////////////// --/ @brief Get the style of a text --/ --/ @param text Text object --/ --/ @return Current string style (see sfTextStyle enum) --/ --////////////////////////////////////////////////////////// function getStyle (text : sfText_Ptr) return sfTextStyle; --////////////////////////////////////////////////////////// --/ @brief Get the fill color of a text --/ --/ @param text Text object --/ --/ @return Fill color of the text --/ --/ @deprecated This function is deprecated and may be removed in future releases. --/ Use sfText_getFillColor instead. --/ --////////////////////////////////////////////////////////// function getColor (text : sfText_Ptr) return Sf.Graphics.Color.sfColor; --////////////////////////////////////////////////////////// --/ @brief Get the fill color of a text --/ --/ @param text Text object --/ --/ @return Fill color of the text --/ --////////////////////////////////////////////////////////// function getFillColor (text : sfText_Ptr) return Sf.Graphics.Color.sfColor; --////////////////////////////////////////////////////////// --/ @brief Get the outline color of a text --/ --/ @param text Text object --/ --/ @return Outline color of the text --/ --////////////////////////////////////////////////////////// function getOutlineColor (text : sfText_Ptr) return Sf.Graphics.Color.sfColor; --////////////////////////////////////////////////////////// --/ @brief Get the outline thickness of a text --/ --/ @param text Text object --/ --/ @return Outline thickness of a text, in pixels --/ --////////////////////////////////////////////////////////// function getOutlineThickness (text : sfText_Ptr) return float; --////////////////////////////////////////////////////////// --/ @brief Return the position of the @a index-th character in a text --/ --/ This function computes the visual position of a character --/ from its index in the string. The returned position is --/ in global coordinates (translation, rotation, scale and --/ origin are applied). --/ If @a index is out of range, the position of the end of --/ the string is returned. --/ --/ @param text Text object --/ @param index Index of the character --/ --/ @return Position of the character --/ --////////////////////////////////////////////////////////// function findCharacterPos (text : sfText_Ptr; index : sfSize_t) return Sf.System.Vector2.sfVector2f; --////////////////////////////////////////////////////////// --/ @brief Get the local bounding rectangle of a text --/ --/ The returned rectangle is in local coordinates, which means --/ that it ignores the transformations (translation, rotation, --/ scale, ...) that are applied to the entity. --/ In other words, this function returns the bounds of the --/ entity in the entity's coordinate system. --/ --/ @param text Text object --/ --/ @return Local bounding rectangle of the entity --/ --////////////////////////////////////////////////////////// function getLocalBounds (text : sfText_Ptr) return Sf.Graphics.Rect.sfFloatRect; --////////////////////////////////////////////////////////// --/ @brief Get the global bounding rectangle of a text --/ --/ The returned rectangle is in global coordinates, which means --/ that it takes in account the transformations (translation, --/ rotation, scale, ...) that are applied to the entity. --/ In other words, this function returns the bounds of the --/ text in the global 2D world's coordinate system. --/ --/ @param text Text object --/ --/ @return Global bounding rectangle of the entity --/ --////////////////////////////////////////////////////////// function getGlobalBounds (text : sfText_Ptr) return Sf.Graphics.Rect.sfFloatRect; private pragma Import (C, create, "sfText_create"); pragma Import (C, copy, "sfText_copy"); pragma Import (C, destroy, "sfText_destroy"); pragma Import (C, setPosition, "sfText_setPosition"); pragma Import (C, setRotation, "sfText_setRotation"); pragma Import (C, setScale, "sfText_setScale"); pragma Import (C, setOrigin, "sfText_setOrigin"); pragma Import (C, getPosition, "sfText_getPosition"); pragma Import (C, getRotation, "sfText_getRotation"); pragma Import (C, getScale, "sfText_getScale"); pragma Import (C, getOrigin, "sfText_getOrigin"); pragma Import (C, move, "sfText_move"); pragma Import (C, rotate, "sfText_rotate"); pragma Import (C, scale, "sfText_scale"); pragma Import (C, getTransform, "sfText_getTransform"); pragma Import (C, getInverseTransform, "sfText_getInverseTransform"); pragma Import (C, setUnicodeString, "sfText_setUnicodeString"); pragma Import (C, setFont, "sfText_setFont"); pragma Import (C, setCharacterSize, "sfText_setCharacterSize"); pragma Import (C, setLineSpacing, "sfText_setLineSpacing"); pragma Import (C, setLetterSpacing, "sfText_setLetterSpacing"); pragma Import (C, setStyle, "sfText_setStyle"); pragma Import (C, setColor, "sfText_setColor"); pragma Import (C, setFillColor, "sfText_setFillColor"); pragma Import (C, setOutlineColor, "sfText_setOutlineColor"); pragma Import (C, setOutlineThickness, "sfText_setOutlineThickness"); pragma Import (C, getUnicodeString, "sfText_getUnicodeString"); pragma Import (C, getFont, "sfText_getFont"); pragma Import (C, getCharacterSize, "sfText_getCharacterSize"); pragma Import (C, getLetterSpacing, "sfText_getLetterSpacing"); pragma Import (C, getLineSpacing, "getLineSpacing"); pragma Import (C, getStyle, "sfText_getStyle"); pragma Import (C, getColor, "sfText_getColor"); pragma Import (C, getFillColor, "sfText_getFillColor"); pragma Import (C, getOutlineColor, "sfText_getOutlineColor"); pragma Import (C, getOutlineThickness, "sfText_getOutlineThickness"); pragma Import (C, findCharacterPos, "sfText_findCharacterPos"); pragma Import (C, getLocalBounds, "sfText_getLocalBounds"); pragma Import (C, getGlobalBounds, "sfText_getGlobalBounds"); end Sf.Graphics.Text;
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_146.asm
ljhsiun2/medusa
9
163458
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r14 push %r8 push %rcx push %rdi push %rsi lea addresses_WT_ht+0x33ec, %rcx nop nop nop xor %r14, %r14 mov (%rcx), %r12d nop sub $53053, %r10 lea addresses_WC_ht+0x96da, %rsi lea addresses_D_ht+0x93a8, %rdi nop dec %r14 mov $6, %rcx rep movsw nop cmp $37201, %rcx lea addresses_normal_ht+0xd89c, %rsi clflush (%rsi) nop nop and $19704, %r8 mov (%rsi), %r10 nop nop nop nop inc %rcx lea addresses_WT_ht+0x156b4, %r12 nop and %rsi, %rsi mov $0x6162636465666768, %rcx movq %rcx, %xmm5 movups %xmm5, (%r12) cmp $47059, %r8 lea addresses_D_ht+0xed8, %r14 nop nop nop add %rsi, %rsi movw $0x6162, (%r14) nop nop sub $16020, %r8 pop %rsi pop %rdi pop %rcx pop %r8 pop %r14 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r8 push %rbx push %rdi push %rdx // Faulty Load lea addresses_A+0x1252c, %rdi nop cmp $52723, %r8 mov (%rdi), %r10w lea oracles, %rbx and $0xff, %r10 shlq $12, %r10 mov (%rbx,%r10,1), %r10 pop %rdx pop %rdi pop %rbx pop %r8 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': False, 'type': 'addresses_A'}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': True, 'type': 'addresses_A'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 5, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 1, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'} {'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 2, 'same': True, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 3, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': True, 'type': 'addresses_D_ht'}, 'OP': 'STOR'} {'35': 21829} 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 */
regtests/files/test-ada-8/src/test8.adb
stcarrez/resource-embedder
7
8094
<filename>regtests/files/test-ada-8/src/test8.adb with Resources8; with Ada.Command_Line; with Ada.Text_IO; procedure Test8 is use Resources8; C : Content_Access := Get_Content ("config/test8.xml"); begin if C = null then Ada.Text_IO.Put_Line ("FAIL: No content 'config/test8.xml'"); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); return; end if; if C'Length /= 37 then Ada.Text_IO.Put_Line ("FAIL: Invalid length for 'config/test8.xml'"); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); end if; C := Get_Content ("CONFIG/TEST8.XML"); if C = null then Ada.Text_IO.Put_Line ("FAIL: No content 'config/test8.xml'"); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); return; end if; C := Get_Content ("CoNfIg/TeSt8.XmL"); if C = null then Ada.Text_IO.Put_Line ("FAIL: No content 'config/test8.xml'"); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); return; end if; Ada.Text_IO.Put ("PASS: "); Ada.Text_IO.Put_Line (C.all); end Test8;
DependentExtensions/cat/src/math/big_x64_elf.asm
RichardRanft/RakNet
1,255
246302
; Copyright (c) 2009-2010 <NAME>. All rights reserved. ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions are met: ; ; * Redistributions of source code must retain the above copyright notice, ; this list of conditions and the following disclaimer. ; * Redistributions in binary form must reproduce the above copyright notice, ; this list of conditions and the following disclaimer in the documentation ; and/or other materials provided with the distribution. ; * Neither the name of LibCat 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. ; arith_x64.asm ; ; 64-bit Arithmetic with Big Pseudo-Mersenne (BPM) modulus 2^N-C, for small C ; ; Assembly code written for FASM (flatassembler.net) format ELF64 section '.code' executable ;----------------------------------------------------------------------------- ; Function Declarations ;----------------------------------------------------------------------------- public bpm_add_4 as 'bpm_add_4' public bpm_sub_4 as 'bpm_sub_4' public bpm_mul_4 as 'bpm_mul_4' public bpm_mulx_4 as 'bpm_mulx_4' public bpm_sqr_4 as 'bpm_sqr_4' ; Does not provide these -- just extra complexity i don't need ;public divide_x as 'divide64_x' ;public modulus_x as 'modulus64_x' ;public divide_core as 'divide64_core' ;----------------------------------------------------------------------------- ; bpm_add_4 ;----------------------------------------------------------------------------- ; Arguments: ; rdi (arg 1) : modulus parameter C ; rsi (arg 2) : pointer to input A first leg ; rdx (arg 3) : pointer to input B first leg ; rcx (arg 4) : pointer to output first leg ; Preconditions: ; legs per bigint = 4 ; Output: ; out = A + B (mod C) ;----------------------------------------------------------------------------- bpm_add_4: ; perform addition chain mov r8, qword[rsi] add r8, qword[rdx] mov qword[rcx], r8 mov r9, qword[rsi+8] adc r9, qword[rdx+8] mov qword[rcx+8], r9 mov r10, qword[rsi+16] adc r10, qword[rdx+16] mov qword[rcx+16], r10 mov r11, qword[rsi+24] adc r11, qword[rdx+24] jnc bpm_add_4_done ; add C when it overflows bpm_add_4_mod: add r8, rdi adc r9, 0 adc r10, 0 adc r11, 0 jc bpm_add_4_mod bpm_add_4_done: mov qword[rcx], r8 mov qword[rcx+8], r9 mov qword[rcx+16], r10 mov qword[rcx+24], r11 ret ;----------------------------------------------------------------------------- ; bpm_sub_4 ;----------------------------------------------------------------------------- ; Arguments: ; rdi (arg 1) : modulus parameter C ; rsi (arg 2) : pointer to input A first leg ; rdx (arg 3) : pointer to input B first leg ; rcx (arg 4) : pointer to output first leg ; Preconditions: ; legs per bigint = 4 ; Output: ; out = A - B (mod C) ;----------------------------------------------------------------------------- bpm_sub_4: ; perform subtraction chain mov r8, qword[rsi] sub r8, qword[rdx] mov qword[rcx], r8 mov r9, qword[rsi+8] sbb r9, qword[rdx+8] mov qword[rcx+8], r9 mov r10, qword[rsi+16] sbb r10, qword[rdx+16] mov qword[rcx+16], r10 mov r11, qword[rsi+24] sbb r11, qword[rdx+24] jnc bpm_sub_4_done ; subtract C when it overflows bpm_sub_4_mod: sub r8, rdi sbb r9, 0 sbb r10, 0 sbb r11, 0 jc bpm_sub_4_mod bpm_sub_4_done: mov qword[rcx], r8 mov qword[rcx+8], r9 mov qword[rcx+16], r10 mov qword[rcx+24], r11 ret ;----------------------------------------------------------------------------- ; bpm_mul_4 ;----------------------------------------------------------------------------- ; Arguments: ; rcx->rdi (arg 1) : modulus parameter C ; rdx->rsi (arg 2) : pointer to input A first leg ; r8->rdx (arg 3) : pointer to input B first leg ; r9->rcx (arg 4) : pointer to output first leg ; Preconditions: ; legs per bigint = 4 ; Output: ; out = A * B (mod C) ;----------------------------------------------------------------------------- bpm_mul_4: ; a b c d : A ; x e f g h : B ; ------------------------ ; ah bh ch dh ; ag bg cg dg ; af bf cf df ; + ae be ce de ; ------------------------ push rbp mov rbp, rsp sub rsp, 8*10 push r12 r13 r14 r15 label .pro1 qword at rbp-8 label .pro2 qword at rbp-16 label .pro3 qword at rbp-24 label .pro4 qword at rbp-32 label .pro5 qword at rbp-40 label .pro6 qword at rbp-48 label .pro7 qword at rbp-56 label .pro8 qword at rbp-64 label .modc qword at rbp-72 label .out qword at rbp-80 mov qword[.modc], rdi mov qword[.out], rcx ; ---- 4x4 comba multiply mov r8, [rsi] mov r9, [rsi+8] mov r10, [rsi+16] mov r11, [rsi+24] mov r12, [rdx] mov r13, [rdx+8] mov r14, [rdx+16] mov r15, [rdx+24] ; column 1 mov rax, r8 xor rcx, rcx mul r12 ; dh mov qword[.pro1], rax mov rdi, rdx ; column 2 mov rax, r9 xor rsi, rsi mul r12 ; ch add rdi, rax adc rcx, rdx adc rsi, 0 mov rax, r8 mul r13 ; dg add rdi, rax adc rcx, rdx adc rsi, 0 mov qword[.pro2], rdi ; column 3 mov rax, r10 xor rdi, rdi mul r12 ; bh add rcx, rax adc rsi, rdx adc rdi, 0 mov rax, r9 mul r13 ; cg add rcx, rax adc rsi, rdx adc rdi, 0 mov rax, r8 mul r14 ; df add rcx, rax adc rsi, rdx adc rdi, 0 mov qword[.pro3], rcx ; column 4 mov rax, r11 xor rcx, rcx mul r12 ; ah add rsi, rax adc rdi, rdx adc rcx, 0 mov rax, r10 mul r13 ; bg add rsi, rax adc rdi, rdx adc rcx, 0 mov rax, r9 mul r14 ; cf add rsi, rax adc rdi, rdx adc rcx, 0 mov rax, r8 mul r15 ; de add rsi, rax adc rdi, rdx adc rcx, 0 mov rax, r11 mov qword[.pro4], rsi ; column 5 xor rsi, rsi mul r13 ; ag add rdi, rax adc rcx, rdx adc rsi, 0 mov rax, r10 mul r14 ; bf add rdi, rax adc rcx, rdx adc rsi, 0 mov rax, r9 mul r15 ; ce add rdi, rax adc rcx, rdx adc rsi, 0 ; mov qword[.pro5], rbx mov r8, rdi ; column 6 mov rax, r11 xor rdi, rdi mul r14 ; af add rcx, rax adc rsi, rdx adc rdi, 0 mov rax, r10 mul r15 ; be add rcx, rax adc rsi, rdx adc rdi, 0 ; mov qword[.pro6], rcx mov r12, rcx ; r12 gets .pro6 from rcx ; column 7 mov rax, r11 mul r15 ; ae add rsi, rax adc rdi, rdx ; mov qword[.pro7], rsi ; column 8 ; mov qword[.pro8], rbx ; ---- modular reduction 8->5 mov rcx, qword[.modc] ; generate r12..8 = .pro8..5 * c + .pro4..1 mov rax, r8 mul rcx mov r8, rax mov r9, rdx add r8, qword[.pro1] adc r9, 0 mov rax, r12 mul rcx xor r10, r10 add r9, rax adc r10, rdx add r9, qword[.pro2] adc r10, 0 mov rax, rsi mul rcx xor r11, r11 add r10, rax adc r11, rdx add r10, qword[.pro3] adc r11, 0 mov rax, rdi mul rcx xor r12, r12 add r11, rax adc r12, rdx add r11, qword[.pro4] adc r12, 0 ; ---- modular reduction 5->4 ; generate r11..8 = r12 * c + r11..8 mov rax, r12 mul rcx add r8, rax adc r9, rdx adc r10, 0 adc r11, 0 mov rsi, qword[.out] ; ---- modular reduction 4.1->4 jnc bpm_mul_4_out ; final add carried out so add once more bpm_mul_4_mod: add r8, rcx adc r9, 0 adc r10, 0 adc r11, 0 jc bpm_mul_4_mod bpm_mul_4_out: mov qword[rsi], r8 mov qword[rsi+8], r9 mov qword[rsi+16], r10 mov qword[rsi+24], r11 pop r15 r14 r13 r12 mov rsp, rbp pop rbp ret ;----------------------------------------------------------------------------- ; bpm_mulx_4 ;----------------------------------------------------------------------------- ; Arguments: ; rcx->rdi (arg 1) : modulus parameter C ; rdx->rsi (arg 2) : pointer to input A first leg ; r8->rdx (arg 3) : single leg input B ; r9->rcx (arg 4) : pointer to output first leg ; Preconditions: ; legs per bigint = 4 ; Output: ; out = A * B (mod C) ;----------------------------------------------------------------------------- bpm_mulx_4: mov r8, rdx mov rax, qword[rsi] mul r8 mov r9, rax mov r10, rdx mov rax, qword[rsi+8] mul r8 xor r11, r11 add r10, rax adc r11, rdx mov rax, qword[rsi+16] mul r8 add r11, rax adc rdx, 0 mov rax, qword[rsi+24] mov rsi, rdx mul r8 add rsi, rax adc rdx, 0 ; ---- modular reduction 5->4 mov rax, rdi mul rdx add r9, rax adc r10, rdx adc r11, 0 adc rsi, 0 ; ---- modular reduction 4.1->4 jnc bpm_mulx_4_out ; final add carried out so add once more bpm_mulx_4_mod: add r9, rdi adc r10, 0 adc r11, 0 adc rsi, 0 jc bpm_mulx_4_mod bpm_mulx_4_out: mov qword[rcx], r9 mov qword[rcx+8], r10 mov qword[rcx+16], r11 mov qword[rcx+24], rsi ret ;----------------------------------------------------------------------------- ; bpm_sqr_4 ;----------------------------------------------------------------------------- ; Arguments: ; rcx->rdi (arg 1) : modulus parameter C ; rdx->rsi (arg 2) : pointer to input first leg ; r8->rdx (arg 3) : pointer to output first leg ; Preconditions: ; legs per bigint = 4 ; Output: ; out = in*in (mod C) ;----------------------------------------------------------------------------- bpm_sqr_4: ; a b c d ; x a b c d ; ------------------------ ; ad bd cd dd ; ac bc cc dc ; ab bb cb db ; + aa ba ca da ; ------------------------ ; 2bd dd ; 2ad 2cd ; 2ac cc ; 2ab 2bc ; bb ; + aa ; ------------------------ push rbp mov rbp, rsp sub rsp, 8*10 push r12 label .pro1 qword at rbp-8 label .pro2 qword at rbp-16 label .pro3 qword at rbp-24 label .pro4 qword at rbp-32 label .pro5 qword at rbp-40 label .pro6 qword at rbp-48 label .pro7 qword at rbp-56 label .pro8 qword at rbp-64 label .modc qword at rbp-72 label .out qword at rbp-80 mov qword[.modc], rdi mov qword[.out], rdx ; ---- 4x4 comba square mov r8, qword[rsi] mov r9, qword[rsi+8] mov r10, qword[rsi+16] mov r11, qword[rsi+24] ; column 1 mov rax, r8 mul r8 ; dd mov qword[.pro1], rax mov r12, rdx xor rsi, rsi xor rdi, rdi ; column 2 mov rax, r8 mul r9 ; cd ; r14:r13:r12 = 2(rdx:rax) + r12 add r12, rax adc rsi, rdx adc rdi, 0 add r12, rax adc rsi, rdx adc rdi, 0 mov qword[.pro2], r12 ; column 3 mov rax, r8 xor r12, r12 mul r10 ; bd ; r12:r14:r13 = 2(rdx:rax) + 0:r14:r13 add rsi, rax adc rdi, rdx adc r12, 0 add rsi, rax adc rdi, rdx adc r12, 0 mov rax, r9 mul r9 ; cc ; r12:r14:r13 += 0:rdx:rax add rsi, rax adc rdi, rdx adc r12, 0 mov qword[.pro3], rsi ; column 4 mov rax, r8 xor rsi, rsi mul r11 ; ad ; r13:r12:r14 = 2(rdx:rax) + 0:r12:r14 add rdi, rax adc r12, rdx adc rsi, 0 add rdi, rax adc r12, rdx adc rsi, 0 mov rax, r9 mul r10 ; bc ; r13:r12:r14 += 2(rdx:rax) add rdi, rax adc r12, rdx adc rsi, 0 add rdi, rax adc r12, rdx adc rsi, 0 mov qword[.pro4], rdi ; column 5 mov rax, r9 xor rdi, rdi mul r11 ; ac ; r14:r13:r12 = 2(rdx:rax) + 0:r13:r12 add r12, rax adc rsi, rdx adc rdi, 0 add r12, rax adc rsi, rdx adc rdi, 0 mov rax, r10 mul r10 ; bb ; r14:r13:r12 += 0:rdx:rax add r12, rax adc rsi, rdx adc rdi, 0 ; mov qword[.pro5], r12 mov r8, r12 ; column 6 mov rax, r10 xor r12, r12 mul r11 ; ab ; r12:r14:r13 = 2(rdx:rax) + 0:r14:r13 add rsi, rax adc rdi, rdx adc r12, 0 add rsi, rax adc rdi, rdx adc r12, 0 ; mov qword[.pro6], r13 ; column 7 mov rax, r11 mul r11 ; aa ; r13:r12:r14 = rdx:rax + 0:r12:r14 add rdi, rax adc r12, rdx ; mov qword[.pro7], r14 ; column 8 ; mov qword[.pro8], r12 ; ---- modular reduction 8->5 mov rcx, qword[.modc] ; generate r12..8 = .pro8..5 * c + .pro4..1 mov rax, r8 mul rcx mov r8, rax mov r9, rdx add r8, qword[.pro1] adc r9, 0 mov rax, rsi mul rcx xor r10, r10 add r9, rax adc r10, rdx add r9, qword[.pro2] adc r10, 0 mov rax, rdi mul rcx xor r11, r11 add r10, rax adc r11, rdx add r10, qword[.pro3] adc r11, 0 mov rax, r12 mul rcx xor r12, r12 add r11, rax adc r12, rdx add r11, qword[.pro4] adc r12, 0 ; ---- modular reduction 5->4 ; generate r11..8 = r12 * c + r11..8 mov rax, r12 mul rcx add r8, rax adc r9, rdx adc r10, 0 adc r11, 0 mov rsi, qword[.out] ; ---- modular reduction 4.1->4 jnc bpm_sqr_4_out ; final add carried out so add once more bpm_sqr_4_mod: add r8, rcx adc r9, 0 adc r10, 0 adc r11, 0 jc bpm_sqr_4_mod bpm_sqr_4_out: mov qword[rsi], r8 mov qword[rsi+8], r9 mov qword[rsi+16], r10 mov qword[rsi+24], r11 pop r12 mov rsp, rbp pop rbp ret ;----------------------------------------------------------------------------- ; Appendix: x86-ELF64 Calling Convention ;----------------------------------------------------------------------------- ; Callee save: rsp(stack), rbx(base), rbp(frame), r12-r15 ; Caller save: rax(ret), rcx, rdx, r8-r11, rdi, rsi
oeis/134/A134159.asm
neoneye/loda-programs
11
166184
<reponame>neoneye/loda-programs ; A134159: a(n) = 13 + 165*n + 756*n^2 + 1470*n^3 + 1029*n^4. ; 13,3433,31591,130351,370273,846613,1679323,3013051,5017141,7885633,11837263,17115463,23988361,32748781,43714243,57226963,73653853,93386521,116841271,144459103,176705713,214071493,257071531,306245611 mul $0,7 add $0,3 bin $0,2 mul $0,2 bin $0,2 sub $0,15 div $0,7 mul $0,6 add $0,13
prototyping/Interpreter.agda
Tr4shh/Roblox-Luau
0
15230
<gh_stars>0 module Interpreter where open import Agda.Builtin.IO using (IO) open import Agda.Builtin.Int using (pos) open import Agda.Builtin.Unit using (⊤) open import FFI.IO using (getContents; putStrLn; _>>=_; _>>_) open import FFI.Data.Aeson using (Value; eitherDecode) open import FFI.Data.Either using (Left; Right) open import FFI.Data.String using (String; _++_) open import FFI.Data.Text.Encoding using (encodeUtf8) open import FFI.System.Exit using (exitWith; ExitFailure) open import Luau.Syntax using (Block) open import Luau.Syntax.FromJSON using (blockFromJSON) open import Luau.Syntax.ToString using (blockToString) open import Luau.Run using (run; return; done; error) open import Luau.RuntimeError.ToString using (errToStringᴮ) open import Luau.Value.ToString using (valueToString) runBlock : ∀ {a} → Block a → IO ⊤ runBlock block with run block runBlock block | return V D = putStrLn (valueToString V) runBlock block | done D = putStrLn "nil" runBlock block | error E D = putStrLn (errToStringᴮ E) runJSON : Value → IO ⊤ runJSON value with blockFromJSON(value) runJSON value | (Left err) = putStrLn ("Luau error: " ++ err) >> exitWith (ExitFailure (pos 1)) runJSON value | (Right block) = runBlock block runString : String → IO ⊤ runString txt with eitherDecode (encodeUtf8 txt) runString txt | (Left err) = putStrLn ("JSON error: " ++ err) >> exitWith (ExitFailure (pos 1)) runString txt | (Right value) = runJSON value main : IO ⊤ main = getContents >>= runString
src/sqlite3.adb
faelys/lithium3
1
28631
<filename>src/sqlite3.adb pragma Style_Checks (Off); -- -- Copyright (c) 2009, 2012 <NAME> <<EMAIL>> -- -- 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. -- with Interfaces.C.Strings; package body SQLite3 is procedure Open (Filename : in String; Handle : out SQLite3_DB; Status : out Error_Code) is function sqlite3_open (Filename : Interfaces.C.Char_Array; DB_Handle : access DB_Private_Access) return Interfaces.C.Int; pragma Import (C, sqlite3_open, "sqlite3_open"); Code : Interfaces.C.Int; begin Code := sqlite3_open (Interfaces.C.To_C (Filename), Handle.Ptr'Access); Status := Error_Code (Code); end Open; procedure Close (Handle : in out SQLite3_DB; Status : out Error_Code) is function sqlite3_close (DB_Handle : DB_Private_Access) return Interfaces.C.Int; pragma Import (C, sqlite3_close, "sqlite3_close"); Code : Interfaces.C.Int; begin Code := sqlite3_close (Handle.Ptr); Status := Error_Code (Code); end Close; procedure Prepare (Handle : SQLite3_DB; Sql : String; SQL_Handle : out SQLite3_Statement; Status : out Error_Code) is type Chars_Ptr_Ptr is access all Interfaces.C.Strings.Chars_Ptr; -- int sqlite3_prepare_v2( -- sqlite3 *db, /* Database handle */ -- const char *zSql, /* SQL statement, UTF-8 encoded */ -- int nByte, /* Maximum length of zSql in bytes. */ -- sqlite3_stmt **ppStmt, /* OUT: Statement handle */ -- const char **pzTail /* OUT: Pointer to unused portion of zSql */ -- ); function sqlite3_prepare_v2 (DB_Handle : DB_Private_Access; zSql : Interfaces.C.Char_Array; nByte : Interfaces.C.Int; ppStmt : access Statement_Private_Access; pzTail : Chars_Ptr_Ptr) return Interfaces.C.Int; pragma Import (C, sqlite3_prepare_v2, "sqlite3_prepare_v2"); Sql_Str : constant Interfaces.C.Char_Array := Interfaces.C.To_C (Sql); Code : Interfaces.C.Int; begin Code := sqlite3_prepare_v2 (DB_Handle => Handle.Ptr, zSql => Sql_Str, nByte => Sql_Str'Length, ppStmt => Sql_Handle.Ptr'Access, pzTail => null); Status := Error_Code (Code); end Prepare; procedure Step (SQL_Handle : SQLite3_Statement; Status : out Error_Code) is -- int sqlite3_step(sqlite3_stmt*); function sqlite3_step (Stmt : Statement_Private_Access) return Interfaces.C.Int; pragma Import (C, sqlite3_step, "sqlite3_step"); Code : Interfaces.C.Int; begin Code := sqlite3_step (SQL_Handle.Ptr); Status := Error_Code (Code); end Step; procedure Finish (SQL_Handle : SQLite3_Statement; Status : out Error_Code) is -- int sqlite3_finalize(sqlite3_stmt*); function sqlite3_finalize (Stmt : Statement_Private_Access) return Interfaces.C.Int; pragma Import (C, sqlite3_finalize, "sqlite3_finalize"); Code : Interfaces.C.Int; begin Code := sqlite3_finalize (SQL_Handle.Ptr); Status := Error_Code (Code); end Finish; procedure Reset (SQL_Handle : SQLite3_Statement; Status : out Error_Code) is -- int sqlite3_reset(sqlite3_stmt*); function sqlite3_reset (Stmt : Statement_Private_Access) return Interfaces.C.Int; pragma Import (C, sqlite3_reset, "sqlite3_reset"); Code : Interfaces.C.Int; begin Code := sqlite3_reset (SQL_Handle.Ptr); Status := Error_Code (Code); end Reset; procedure Clear_Bindings (SQL_Handle : SQLite3_Statement; Status : out Error_Code) is -- int sqlite3_clear_bindings(sqlite3_stmt*); function sqlite3_clear_bindings (Stmt : Statement_Private_Access) return Interfaces.C.Int; pragma Import (C, sqlite3_clear_bindings, "sqlite3_clear_bindings"); Code : Interfaces.C.Int; begin Code := sqlite3_clear_bindings (SQL_Handle.Ptr); Status := Error_Code (Code); end Clear_Bindings; procedure Bind (SQL_Handle : SQLite3_Statement; Index : SQL_Parameter_Index; Value : Integer; Status : out Error_Code) is begin Bind (SQL_Handle, Index, Long_Integer (Value), Status); end Bind; procedure Bind (SQL_Handle : SQLite3_Statement; Index : SQL_Parameter_Index; Value : Long_Integer; Status : out Error_Code) is -- int sqlite3_bind_int(sqlite3_stmt*, int, int); function sqlite3_bind_int (Stmt : Statement_Private_Access; Index : Interfaces.C.Int; Value : Interfaces.C.Int) return Interfaces.C.Int; pragma Import (C, sqlite3_bind_int, "sqlite3_bind_int"); Code : Interfaces.C.Int; begin Code := sqlite3_bind_int (Stmt => Sql_Handle.Ptr, Index => Interfaces.C.Int (Index), Value => Interfaces.C.Int (Value)); Status := Error_Code (Code); end Bind; procedure Bind (SQL_Handle : SQLite3_Statement; Index : SQL_Parameter_Index; Value : Ada.Strings.Unbounded.Unbounded_String; Status : out Error_Code) is use Ada.Strings.Unbounded; -- int sqlite3_bind_text -- (sqlite3_stmt*, -- int, -- const char*, -- int, -- void(*)(void*)); function sqlite3_bind_text (Stmt : Statement_Private_Access; Index : Interfaces.C.int; Value : Interfaces.C.char_array; Bytes : Interfaces.C.int; Opt : Interfaces.C.long) return Interfaces.C.Int; pragma Import (C, sqlite3_bind_text, "sqlite3_bind_text"); Code : Interfaces.C.Int; begin Code := sqlite3_bind_text (Stmt => Sql_Handle.Ptr, Index => Interfaces.C.int (Index), Value => Interfaces.C.To_C (To_String (Value)), Bytes => Interfaces.C.int (Length (Value)), Opt => SQLITE_TRANSIENT); Status := Error_Code (Code); end Bind; procedure Bind (SQL_Handle : SQLite3_Statement; Index : SQL_Parameter_Index; Value : String; Status : out Error_Code) is -- int sqlite3_bind_text -- (sqlite3_stmt*, -- int, -- const char*, -- int, -- void(*)(void*)); function sqlite3_bind_text (Stmt : Statement_Private_Access; Index : Interfaces.C.int; Value : Interfaces.C.char_array; Bytes : Interfaces.C.int; Opt : Interfaces.C.long) return Interfaces.C.Int; pragma Import (C, sqlite3_bind_text, "sqlite3_bind_text"); Code : Interfaces.C.Int; begin Code := sqlite3_bind_text (Stmt => Sql_Handle.Ptr, Index => Interfaces.C.int (Index), Value => Interfaces.C.To_C (Value), Bytes => Interfaces.C.int (Value'Length), Opt => SQLITE_TRANSIENT); Status := Error_Code (Code); end Bind; procedure Bind (SQL_Handle : SQLite3_Statement; Index : SQL_Parameter_Index; Value : Interfaces.C.double; Status : out Error_Code) is -- int sqlite3_bind_double -- (sqlite3_stmt*, -- int, -- double); function sqlite3_bind_double (Stmt : Statement_Private_Access; Index : Interfaces.C.int; Value : Interfaces.C.double) return Interfaces.C.Int; pragma Import (C, sqlite3_bind_double, "sqlite3_bind_double"); Code : Interfaces.C.Int; begin Code := sqlite3_bind_double (Stmt => Sql_Handle.Ptr, Index => Interfaces.C.int (Index), Value => Value); Status := Error_Code (Code); end Bind; procedure Column (SQL_Handle : SQLite3_Statement; Index : SQL_Column_Index; Value : out Int) is -- int sqlite3_column_int(sqlite3_stmt*, int iCol); function sqlite3_column_int (Stmt : Statement_Private_Access; Index : Interfaces.C.Int) return Interfaces.C.Int; pragma Import (C, sqlite3_column_int, "sqlite3_column_int"); Ret_Val : Interfaces.C.Int; begin Ret_Val := sqlite3_column_int (Stmt => Sql_Handle.Ptr, Index => Interfaces.C.Int (Index)); Value := Int (Ret_Val); end Column; procedure Column (SQL_Handle : SQLite3_Statement; Index : SQL_Column_Index; Value : out Ada.Strings.Unbounded.Unbounded_String) is use Ada.Strings.Unbounded; use Interfaces; use type Interfaces.C.Strings.chars_ptr; -- const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol); function sqlite3_column_text (Stmt : Statement_Private_Access; Index : Interfaces.C.Int) return Interfaces.C.Strings.chars_ptr; pragma Import (C, sqlite3_column_text, "sqlite3_column_text"); Ret_Val : Interfaces.C.Strings.chars_ptr; begin Ret_Val := sqlite3_column_text (Stmt => Sql_Handle.Ptr, Index => Interfaces.C.Int (Index)); if Ret_Val = C.Strings.Null_Ptr then Value := Null_Unbounded_String; else Value := To_Unbounded_String (C.To_Ada (C.Strings.Value (Ret_Val))); end if; end Column; function Error_Message (Handle : SQLite3_DB) return String is use Interfaces; -- const char *sqlite3_errmsg(sqlite3*); function sqlite3_errmsg(DB_Handle : DB_Private_Access) return C.Strings.chars_ptr; pragma Import (C, sqlite3_errmsg, "sqlite3_errmsg"); begin return C.To_Ada (C.Strings.Value (sqlite3_errmsg (Handle.Ptr))); end Error_Message; procedure Busy_Timeout (Handle : SQLite3_DB; ms : Interfaces.C.int; Status : out Error_Code) is -- int sqlite3_busy_timeout -- (sqlite3*, -- int); function sqlite3_busy_timeout (DB_Handle : DB_Private_Access; ms : Interfaces.C.int) return Interfaces.C.Int; pragma Import (C, sqlite3_busy_timeout, "sqlite3_busy_timeout"); Code : Interfaces.C.Int; begin Code := sqlite3_busy_timeout (DB_Handle => Handle.Ptr, ms => ms); Status := Error_Code (Code); end Busy_Timeout; end SQLite3;
Project 2/src/Preliminary/part1b.asm
Nurl4n/Computer-Organization
0
20333
<reponame>Nurl4n/Computer-Organization .data hexNo: .space 20 userInput: .asciiz "Please enter the hexadecimal number that you want to conver to decimal: " invalidHexNo: .asciiz "You have entered an invalid hexadecimal number, please enter a valid number to convert. \n" endl: "\n" .text main: addi $sp, $sp, -4 sw $s0, 0($sp) input: li $v0, 4 la $a0, userInput syscall li $v0, 8 la $a0, hexNo li $a1, 9 # User can enter at max length of 8 string syscall addi $t2, $zero, 0 # Beginning length of string hexNo # To find how long is the string size: lb $t0, 0($a0) beq $t0, '\0', exitSize addi $t2, $t2, 1 addi $a0, $a0, 1 j size exitSize: addi $t2, $t2, -1 move $t1, $t2 #----------------------Checking validity------------------# la $s0, hexNo # save hexNo in $s0 checkValidity: lb $t0, 0($s0) beq $t0, '\0', exitValidity slti $t7, $t0, 103 bne $t7, 1, invalid addi $s0, $s0, 1 j checkValidity exitValidity: j continue invalid: la $a0, invalidHexNo li $v0, 4 syscall j input continue: la $a0, hexNo # To save beginning address of string hexNo addi $t9, $zero, 0 # Saving the sum jal ConvertToDec move $a0, $t9 li $v0, 1 syscall lw $s0, 0($sp) addi $sp, $sp, 4 # stopping execution li $v0, 10 syscall ConvertToDec: # Checking if reading string is finished or not beq $t1, 0, exitConvertToDec lb $t0, 0($a0) # Keeps track of how many times to multiply with 16 in order to convert hexno to decimal addi $t4, $t2, -1 # Checking if the register $t0 is number or letter slti $t3, $t0, 58 # $t0 keeps assci code of hexno, so decreasing by 48 gives us the hexno itself beq $t3, 0, letter addi $t0, $t0, -48 j oparateForNumber # $t0 keeps assci code of hexno, so decreasing by 87 gives us the hexno itself represented by letter letter: addi $t0, $t0, -87 j operateForLetter oparateForNumber: beq $t4, 0, exitOparateForNumber mul $t0, $t0, 16 addi $t4, $t4, -1 j oparateForNumber exitOparateForNumber: j repeat operateForLetter: beq $t4, 0, exitOparateForLetter mul $t0, $t0, 16 addi $t4, $t4, -1 j operateForLetter exitOparateForLetter: j repeat repeat: addi $a0, $a0, 1 # Increasing 1 byte, to take next element of string hexNo addi $t1, $t1, -1 add $t9, $t9, $t0 # Keeping the sum by adding $t0 to $t9 addi $t2, $t2, -1 # Decreasing the size after each iteration on the string j ConvertToDec exitConvertToDec: jr $ra
programs/oeis/307/A307989.asm
jmorken/loda
1
2382
<gh_stars>1-10 ; A307989: a(n) = n - pi(2*n) + pi(n-1), where pi is the prime counting function. ; 0,0,1,2,3,4,4,6,6,6,7,8,9,11,11,11,12,14,14,16,16,16,17,18,19,20,20,21,22,23,23,25,26,26,27,27,27,29,30,30,31,32,33,35,35,36,37,39,39,40,40,40,41,42,42,43,43,44,45,47,48,50,51,51,52,52,53,55 mov $1,$0 cal $0,35250 ; Number of primes between n and 2n (inclusive). sub $0,1 sub $1,$0
src/security-auth-openid.ads
jquorning/ada-security
19
22100
<reponame>jquorning/ada-security ----------------------------------------------------------------------- -- security-openid -- OpenID 2.0 Support -- Copyright (C) 2009, 2010, 2011, 2012, 2018 <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. ----------------------------------------------------------------------- -- == OpenID Configuration == -- The Open ID provider needs the following configuration parameters: -- -- openid.realm The OpenID realm parameter passed in the authentication URL. -- openid.callback_url The OpenID return_to parameter. -- private package Security.Auth.OpenID is -- ------------------------------ -- OpenID Manager -- ------------------------------ -- The <b>Manager</b> provides the core operations for the OpenID process. type Manager is new Security.Auth.Manager with private; -- Initialize the OpenID authentication realm. Get the <tt>openid.realm</tt> -- and <tt>openid.callback_url</tt> parameters to configure the realm. overriding procedure Initialize (Realm : in out Manager; Params : in Parameters'Class; Name : in String := PROVIDER_OPENID); -- Discover the OpenID provider that must be used to authenticate the user. -- The <b>Name</b> can be an URL or an alias that identifies the provider. -- A cached OpenID provider can be returned. -- Read the XRDS document from the URI and initialize the OpenID provider end point. -- (See OpenID Section 7.3 Discovery) overriding procedure Discover (Realm : in out Manager; Name : in String; Result : out End_Point); -- Associate the application (relying party) with the OpenID provider. -- The association can be cached. -- (See OpenID Section 8 Establishing Associations) overriding procedure Associate (Realm : in out Manager; OP : in End_Point; Result : out Association); -- Get the authentication URL to which the user must be redirected for authentication -- by the authentication server. overriding function Get_Authentication_URL (Realm : in Manager; OP : in End_Point; Assoc : in Association) return String; -- Verify the authentication result overriding procedure Verify (Realm : in out Manager; Assoc : in Association; Request : in Parameters'Class; Result : out Authentication); -- Verify the authentication result procedure Verify_Discovered (Realm : in out Manager; Assoc : in Association; Request : in Parameters'Class; Result : out Authentication); -- Verify the signature part of the result procedure Verify_Signature (Realm : in Manager; Assoc : in Association; Request : in Parameters'Class; Result : in out Authentication); -- Extract from the XRDS content the OpenID provider URI. -- The default implementation is very basic as it returns the first <URI> -- available in the stream without validating the XRDS document. -- Raises the <b>Invalid_End_Point</b> exception if the URI cannot be found. procedure Extract_XRDS (Realm : in out Manager; Content : in String; Result : out End_Point); private type Manager is new Security.Auth.Manager with record Return_To : Unbounded_String; Realm : Unbounded_String; end record; end Security.Auth.OpenID;
host/stm32gd-usart-peripheral.ads
ekoeppen/STM32_Generic_Ada_Drivers
1
30785
<filename>host/stm32gd-usart-peripheral.ads with STM32_SVD; use STM32_SVD; generic Filename : String; package STM32GD.USART.Peripheral is pragma Preelaborate; procedure Init; procedure Transmit (Data : in Byte); function Receive return Byte; end STM32GD.USART.Peripheral;
examples/outdated-and-incorrect/Termination/Common/Level.agda
cruhland/agda
1,989
6751
module Common.Level where open import Agda.Primitive public
commands/apps/tunnelblick/tunnelblick-connect-all.applescript
daviddzhou/script-commands
3,305
2761
#!/usr/bin/osascript # Required parameters: # @raycast.schemaVersion 1 # @raycast.title Tunnelblick: Connect All # @raycast.mode silent # @raycast.packageName TunnelBlick # # Optional parameters: # @raycast.icon images/tunnelblick.png # @raycast.needsConfirmation false # # Documentation: # @raycast.description Connect all unconnected VPN configurations. # @raycast.author <NAME> # @raycast.authorURL https://github.com/pomdtr on run argv tell application "Tunnelblick" to connect all return # Discard Output end run
src/main/antlr4/org/rpgleparser/RpgParser.g4
Neticoa/rpgleparser
0
4167
<filename>src/main/antlr4/org/rpgleparser/RpgParser.g4<gh_stars>0 parser grammar RpgParser; options { tokenVocab = RpgLexer; } r: (dcl_pr | dcl_pi | ctl_opt // | dspec_continuation // | (dspec_continuation* dspec_fixed) | subroutine | statement | procedure )* endSource* ; statement: dspec | dcl_ds | dcl_c | (dspec_fixed) | ospec_fixed | fspec | fspec_fixed | block | cspec_fixed | blank_spec | cspec_fixed_sql | ispec_fixed | hspec_fixed | star_comments | free_linecomments | blank_line | directive | free ; endSource: endSourceHead endSourceLine*; endSourceHead: END_SOURCE ; endSourceLine: EOS_Text (EOL|EOF); star_comments: COMMENT_SPEC_FIXED comments?;//comments COMMENTS_EOL; free_comments: COMMENTS comments COMMENTS_EOL; free_linecomments: COMMENTS comments; comments: COMMENTS_TEXT; //just_comments: COMMENTS COMMENTS_TEXT COMMENTS_EOL; dspec: (DS_Standalone name=identifier datatype? (keyword+)? FREE_SEMI free_linecomments? ) | dspecConstant | ( DS_FIXED ds_name EXTERNAL_DESCRIPTION DATA_STRUCTURE_TYPE DEF_TYPE_S FROM_POSITION TO_POSITION DATA_TYPE DECIMAL_POSITIONS RESERVED keyword* (EOL|EOF) ) ; dspecConstant: DS_FIXED ds_name EXTERNAL_DESCRIPTION DATA_STRUCTURE_TYPE DEF_TYPE_C FROM_POSITION TO_POSITION DATA_TYPE DECIMAL_POSITIONS RESERVED number (EOL|EOF); datatype: datatypeName args?; keyword: keyword_alias | keyword_align | keyword_alt | keyword_altseq | keyword_ascend | keyword_based | keyword_ccsid | keyword_class | keyword_const | keyword_ctdata | keyword_datfmt | keyword_descend | keyword_dim | keyword_dtaara | keyword_export | keyword_ext | keyword_extfld | keyword_extfmt | keyword_extname | keyword_extpgm | keyword_extproc | keyword_fromfile | keyword_import | keyword_inz | keyword_len | keyword_like | keyword_likeds | keyword_likefile | keyword_likerec | keyword_noopt | keyword_occurs | keyword_opdesc | keyword_options | keyword_overlay | keyword_packeven | keyword_perrcd | keyword_prefix | keyword_pos | keyword_procptr | keyword_qualified | keyword_rtnparm | keyword_static | keyword_sqltype | keyword_template | keyword_timfmt | keyword_tofile | keyword_value | keyword_varying | keyword_psds | dspec_bif; // // BIFs allow on dspec. dspec_bif : bif_elem; keyword_alias : KEYWORD_ALIAS; keyword_align : KEYWORD_ALIGN; keyword_alt : KEYWORD_ALT OPEN_PAREN array_name=simpleExpression CLOSE_PAREN; keyword_altseq : KEYWORD_ALTSEQ OPEN_PAREN SPLAT_NONE CLOSE_PAREN; keyword_ascend : KEYWORD_ASCEND; keyword_based : KEYWORD_BASED OPEN_PAREN basing_pointer_name=simpleExpression CLOSE_PAREN; keyword_ccsid : KEYWORD_CCSID OPEN_PAREN (number | SPLAT_DFT) CLOSE_PAREN; keyword_class : KEYWORD_CLASS OPEN_PAREN SPLAT_JAVA COLON class_name=simpleExpression CLOSE_PAREN; keyword_const : KEYWORD_CONST (OPEN_PAREN constant=simpleExpression CLOSE_PAREN)?; keyword_ctdata: KEYWORD_CTDATA; keyword_datfmt : KEYWORD_DATFMT OPEN_PAREN (simpleExpression | symbolicConstants) (dateSeparator)? CLOSE_PAREN; dateSeparator : AMPERSAND | MINUS | DIV | FREE_DOT; keyword_descend : KEYWORD_DESCEND; keyword_dim: KEYWORD_DIM OPEN_PAREN (numeric_constant=simpleExpression) CLOSE_PAREN; keyword_dtaara: KEYWORD_DTAARA (OPEN_PAREN (SPLAT_VAR COLON)? (name=literal | nameVariable=simpleExpression) CLOSE_PAREN)?; keyword_export : KEYWORD_EXPORT (OPEN_PAREN external_name=simpleExpression CLOSE_PAREN)?; keyword_ext : KEYWORD_EXT; keyword_extfld : KEYWORD_EXTFLD OPEN_PAREN field_name=simpleExpression CLOSE_PAREN; keyword_extfmt : KEYWORD_EXTFMT OPEN_PAREN code=simpleExpression CLOSE_PAREN; keyword_extname : KEYWORD_EXTNAME OPEN_PAREN file_name=simpleExpression (COLON format_name=simpleExpression)? (COLON (SPLAT_ALL| SPLAT_INPUT | SPLAT_OUTPUT | SPLAT_KEY))? CLOSE_PAREN; keyword_extpgm : KEYWORD_EXTPGM (OPEN_PAREN name=simpleExpression CLOSE_PAREN)?; keyword_extproc : KEYWORD_EXTPROC OPEN_PAREN ((SPLAT_JAVA COLON class_name=simpleExpression COLON) | (identifier COLON) //TODO *CL|*CWIDEN|*CNOWIDEN| )? name=simpleExpression CLOSE_PAREN; keyword_fromfile : KEYWORD_FROMFILE OPEN_PAREN file_name=simpleExpression CLOSE_PAREN; keyword_import : KEYWORD_IMPORT (OPEN_PAREN external_name=simpleExpression CLOSE_PAREN)?; keyword_inz: KEYWORD_INZ (OPEN_PAREN simpleExpression CLOSE_PAREN)?; keyword_len : KEYWORD_LEN OPEN_PAREN length=simpleExpression CLOSE_PAREN; keyword_like : KEYWORD_LIKE OPEN_PAREN name=simpleExpression (COLON like_lengthAdjustment)? CLOSE_PAREN; keyword_likeds : KEYWORD_LIKEDS OPEN_PAREN data_structure_name=simpleExpression CLOSE_PAREN; keyword_likefile : KEYWORD_LIKEFILE OPEN_PAREN file_name=simpleExpression CLOSE_PAREN; keyword_likerec : KEYWORD_LIKEREC OPEN_PAREN intrecname=simpleExpression (COLON (SPLAT_ALL | SPLAT_INPUT | SPLAT_OUTPUT | SPLAT_KEY))? CLOSE_PAREN; keyword_noopt : KEYWORD_NOOPT; keyword_occurs : KEYWORD_OCCURS OPEN_PAREN (numeric_constant=number | function | identifier) CLOSE_PAREN; keyword_opdesc : KEYWORD_OPDESC; keyword_options : KEYWORD_OPTIONS OPEN_PAREN identifier (COLON identifier)* CLOSE_PAREN; keyword_overlay : KEYWORD_OVERLAY OPEN_PAREN name=simpleExpression (COLON (SPLAT_NEXT | pos=simpleExpression))? CLOSE_PAREN; keyword_packeven : KEYWORD_PACKEVEN; keyword_perrcd : KEYWORD_PERRCD OPEN_PAREN numeric_constant=simpleExpression CLOSE_PAREN; keyword_prefix : KEYWORD_PREFIX OPEN_PAREN prefix=simpleExpression (COLON nbr_of_char_replaced=simpleExpression)? CLOSE_PAREN; keyword_pos : KEYWORD_POS OPEN_PAREN numeric_constant=simpleExpression CLOSE_PAREN; keyword_procptr : KEYWORD_PROCPTR; keyword_qualified : KEYWORD_QUALIFIED; keyword_rtnparm : KEYWORD_RTNPARM; keyword_static : KEYWORD_STATIC (OPEN_PAREN SPLAT_ALLTHREAD CLOSE_PAREN)?; keyword_sqltype : KEYWORD_SQLTYPE (OPEN_PAREN id=simpleExpression (COLON number)? CLOSE_PAREN)?; keyword_template : KEYWORD_TEMPLATE; keyword_timfmt : KEYWORD_TIMFMT OPEN_PAREN format=simpleExpression COLON? CLOSE_PAREN; //TODO separator keyword_tofile : KEYWORD_TOFILE OPEN_PAREN file_name=simpleExpression (separator=simpleExpression)? CLOSE_PAREN; keyword_value : KEYWORD_VALUE; keyword_varying : KEYWORD_VARYING (OPEN_PAREN size=simpleExpression CLOSE_PAREN)?; keyword_psds: KEYWORD_PSDS; // File spec keywords keyword_block: KEYWORD_BLOCK OPEN_PAREN symbolicConstants CLOSE_PAREN; keyword_commit: (KEYWORD_COMMIT | OP_COMMIT)(OPEN_PAREN simpleExpression CLOSE_PAREN)?; keyword_devid: KEYWORD_DEVID (OPEN_PAREN simpleExpression CLOSE_PAREN); keyword_extdesc: KEYWORD_EXTDESC (OPEN_PAREN simpleExpression CLOSE_PAREN); keyword_extfile: KEYWORD_EXTFILE (OPEN_PAREN (simpleExpression | symbolicConstants) CLOSE_PAREN); keyword_extind: KEYWORD_EXTIND OPEN_PAREN simpleExpression CLOSE_PAREN; keyword_extmbr: KEYWORD_EXTMBR OPEN_PAREN simpleExpression CLOSE_PAREN; keyword_formlen: KEYWORD_FORMLEN OPEN_PAREN number CLOSE_PAREN; keyword_formofl: KEYWORD_FORMOFL OPEN_PAREN number CLOSE_PAREN; keyword_ignore: KEYWORD_IGNORE OPEN_PAREN simpleExpression (COLON simpleExpression)* CLOSE_PAREN; keyword_include: KEYWORD_INCLUDE OPEN_PAREN simpleExpression (COLON simpleExpression)* CLOSE_PAREN; keyword_indds: KEYWORD_INDDS OPEN_PAREN data_structure_name=simpleExpression CLOSE_PAREN; keyword_infds: KEYWORD_INFDS OPEN_PAREN simpleExpression CLOSE_PAREN; keyword_infsr: KEYWORD_INFSR OPEN_PAREN subr_name=simpleExpression CLOSE_PAREN; keyword_keyloc: KEYWORD_KEYLOC OPEN_PAREN number CLOSE_PAREN; keyword_maxdev: KEYWORD_MAXDEV OPEN_PAREN symbolicConstants CLOSE_PAREN; keyword_oflind: KEYWORD_OFLIND OPEN_PAREN simpleExpression CLOSE_PAREN; keyword_pass: KEYWORD_PASS OPEN_PAREN symbolicConstants CLOSE_PAREN; keyword_pgmname: KEYWORD_PGMNAME OPEN_PAREN program_name=simpleExpression CLOSE_PAREN; keyword_plist: KEYWORD_PLIST OPEN_PAREN plist_name=simpleExpression CLOSE_PAREN; keyword_prtctl: KEYWORD_PRTCTL OPEN_PAREN data_struct=simpleExpression (COLON symbolicConstants)? CLOSE_PAREN; keyword_rafdata: KEYWORD_RAFDATA OPEN_PAREN file_name=simpleExpression CLOSE_PAREN; keyword_recno: KEYWORD_RECNO OPEN_PAREN field_name=simpleExpression CLOSE_PAREN; keyword_rename: KEYWORD_RENAME OPEN_PAREN ext_format=simpleExpression COLON int_format=simpleExpression CLOSE_PAREN; keyword_saveds: KEYWORD_SAVEDS OPEN_PAREN simpleExpression CLOSE_PAREN; keyword_saveind: KEYWORD_SAVEIND OPEN_PAREN number CLOSE_PAREN; keyword_sfile: KEYWORD_SFILE OPEN_PAREN recformat=simpleExpression COLON rrnfield=simpleExpression CLOSE_PAREN; keyword_sln: KEYWORD_SLN OPEN_PAREN number CLOSE_PAREN; keyword_usropn: KEYWORD_USROPN; keyword_disk: KEYWORD_DISK (OPEN_PAREN SPLAT_EXT CLOSE_PAREN)?; keyword_workstn: KEYWORD_WORKSTN; keyword_printer: KEYWORD_PRINTER OPEN_PAREN symbolicConstants CLOSE_PAREN; keyword_special: KEYWORD_SPECIAL; keyword_keyed: KEYWORD_KEYED; keyword_usage: KEYWORD_USAGE OPEN_PAREN (symbolicConstants | ID) (COLON (symbolicConstants | ID))* CLOSE_PAREN; like_lengthAdjustment: sign number; sign: PLUS | MINUS; dcl_ds: (DS_DataStructureStart identifier keyword* ( ( (FREE_SEMI (star_comments | directive | dcl_ds_field)* )? end_dcl_ds ) | keyword_likerec | keyword_likeds) FREE_SEMI ) | ( DS_FIXED ds_name EXTERNAL_DESCRIPTION DATA_STRUCTURE_TYPE DEF_TYPE_DS FROM_POSITION TO_POSITION DATA_TYPE DECIMAL_POSITIONS RESERVED keyword* (EOL|EOF) ((star_comments |directive | parm_fixed)* parm_fixed)? ); dcl_ds_field: DS_SubField? identifier (datatype | identifier)? keyword* FREE_SEMI; end_dcl_ds: DS_DataStructureEnd identifier?; dcl_pr: (DS_PrototypeStart identifier datatype? keyword* FREE_SEMI? dcl_pr_field* dcl_pi? end_dcl_pr FREE_SEMI) | (prBegin parm_fixed* ); dcl_pr_field: DS_Parm? (identifier (datatype | like=keyword_like) keyword* FREE_SEMI ); end_dcl_pr: DS_PrototypeEnd; dcl_pi: (DS_ProcedureInterfaceStart identifier datatype? keyword* FREE_SEMI? dcl_pi_field* end_dcl_pi FREE_SEMI) | (piBegin pi_parm_fixed* ); dcl_pi_field: DS_Parm? identifier (datatype | like=keyword_like) keyword* FREE_SEMI; end_dcl_pi: DS_ProcedureInterfaceEnd; dcl_c: (DS_Constant name=identifier (keyword_const | literal | SPLAT_ON | SPLAT_OFF | SPLAT_ZEROS | SPLAT_BLANKS)? FREE_SEMI) | ( DS_FIXED ds_name EXTERNAL_DESCRIPTION DATA_STRUCTURE_TYPE DEF_TYPE_C FROM_POSITION TO_POSITION DATA_TYPE DECIMAL_POSITIONS RESERVED (keyword_const | literal | dspec_bif | SPLAT_ON | SPLAT_OFF | SPLAT_ZEROS | SPLAT_BLANKS)? (EOL|EOF) ) ; ctl_opt: H_SPEC (identifier | expression)* FREE_SEMI ; datatypeName: CHAR | DATE_ | VARCHAR | UCS2 | VARUCS2 | GRAPH | VARGRAPH | IND | PACKED | ZONED | BINDEC | INT | UNS | FLOAT | TIME | TIMESTAMP | POINTER | OBJECT; block: ((csDOUxx | csDOWxx | begindou | begindow | begindo) statement* enddo ) | ifstatement | selectstatement | forstatement | monitorstatement | casestatement ; ifstatement: (beginif statement* (elseifstmt statement*)* (elsestmt statement*)? endif) ; casestatement: ((CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor) (csCASEQ | csCASNE | csCASLE | csCASLT | csCASGE | csCASGT | csCAS))+ casestatementend ; casestatementend: CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor (csEND | csENDCS) ; monitorstatement: beginmonitor statement* onError* endmonitor ; beginmonitor: (op_monitor FREE_SEMI) | CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor csMONITOR ; endmonitor: (op_endmon FREE_SEMI) | CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor csENDMON ; onError: ((op_on_error FREE_SEMI) | CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor csON_ERROR ) statement* ; selectstatement: beginselect whenstatement* other? endselect ; other: (CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor csOTHER ) | (op_other FREE_SEMI free_linecomments? ) ; beginselect: (CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor csSELECT ) | (op_select FREE_SEMI free_linecomments? ) ; whenstatement: (csWHENxx | when ) statement* ; when: (CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor csWHEN ) | (op_when FREE_SEMI free_linecomments? ) statement* ; csWHENxx: CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor (csWHENEQ | csWHENNE | csWHENLE | csWHENLT | csWHENGE | csWHENGT) andConds=csANDxx* orConds=csORxx* ; endselect: ( CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor (csEND | csENDSL) ) | (op_endsl FREE_SEMI free_linecomments? ); beginif: csIFxx | (CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor OP_IF cs_operationExtender? fixedexpression=c_free (C_FREE_NEWLINE | EOF) ) | (op_if FREE_SEMI free_linecomments? ) ; begindou: (CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor csDOU ) | (op_dou FREE_SEMI free_linecomments?) ; begindow: (CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor csDOW ) | (op_dow FREE_SEMI free_linecomments?) ; begindo: (CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor csDO ) | (op_dow FREE_SEMI free_linecomments?) ; elseifstmt: (CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor OP_ELSEIF cs_operationExtender? fixedexpression=c_free (C_FREE_NEWLINE | EOF) ) | (op_elseif FREE_SEMI free_linecomments? ) ; elsestmt: (CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor OP_ELSE cspec_fixed_standard_parts ) | (op_else FREE_SEMI free_linecomments? ) ; csIFxx: CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor (csIFEQ | csIFNE | csIFLE | csIFLT | csIFGE | csIFGT) andConds=csANDxx* orConds=csORxx* ; csDOUxx: CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor (csDOUEQ | csDOUNE | csDOULE | csDOULT | csDOUGE | csDOUGT) andConds=csANDxx* orConds=csORxx* ; csDOWxx: CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor (csDOWEQ | csDOWNE | csDOWLE | csDOWLT | csDOWGE | csDOWGT) andConds=csANDxx* orConds=csORxx* ; complexCondxx: csANDxx |csORxx ; csANDxx: CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor (csANDEQ | csANDNE | csANDLE | csANDLT | csANDGE | csANDGT ) ; csORxx: CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor (csOREQ | csORNE | csORLE | csORLT | csORGE | csORGT ) andConds=csANDxx* ; forstatement: beginfor statement* endfor ; beginfor: (CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor csFOR) | (op_for FREE_SEMI free_linecomments? ) ; endif: ( CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor (csEND | csENDIF) ) | (op_endif FREE_SEMI free_linecomments? ); enddo: ( CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor (csEND | csENDDO) ) | (op_enddo FREE_SEMI free_linecomments? ); endfor: ( CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor (csEND | csENDFOR) ) | (op_endfor FREE_SEMI free_linecomments? ); dspec_fixed: DS_FIXED ds_name EXTERNAL_DESCRIPTION DATA_STRUCTURE_TYPE DEF_TYPE FROM_POSITION TO_POSITION DATA_TYPE DECIMAL_POSITIONS RESERVED keyword* (EOL|EOF); ds_name: CONTINUATION_NAME* NAME; ospec_fixed: OS_FIXED (((OS_RecordName OS_Type (os_fixed_pgmdesc1 | os_fixed_pgmdesc2)) | os_fixed_pgmfield) |os_fixed_pgmdesc_compound) OS_Comments? (EOL | EOF); os_fixed_pgmdesc1: OS_FetchOverflow outputConditioningOnOffIndicator outputConditioningOnOffIndicator outputConditioningOnOffIndicator OS_ExceptName OS_Space3 OS_Space3 OS_Space3 OS_Space3 OS_RemainingSpace; outputConditioningOnOffIndicator: onOffIndicatorsFlag outputConditioningIndicator; outputConditioningIndicator: BlankIndicator | GeneralIndicator | FunctionKeyIndicator | ControlLevelIndicator | HaltIndicator | ExternalIndicator | OverflowIndicator | MatchingRecordIndicator | LastRecordIndicator | ReturnIndicator | FirstPageIndicator; os_fixed_pgmdesc_compound: OS_AndOr outputConditioningOnOffIndicator outputConditioningOnOffIndicator outputConditioningOnOffIndicator OS_ExceptName OS_Space3 OS_Space3 OS_Space3 OS_Space3 OS_RemainingSpace; os_fixed_pgmdesc2: OS_AddDelete outputConditioningOnOffIndicator outputConditioningOnOffIndicator outputConditioningOnOffIndicator OS_ExceptName OS_RemainingSpace; os_fixed_pgmfield: OS_FieldReserved outputConditioningOnOffIndicator outputConditioningOnOffIndicator outputConditioningOnOffIndicator OS_FieldName OS_EditNames OS_BlankAfter OS_EndPosition OS_DataFormat literal?; ps_name: PS_CONTINUATION_NAME* PS_NAME; //dspec_continuation: DS_FIXED CONTINUATION_NAME (EOL|EOF); fspec: FS_FreeFile filename fs_keyword* FREE_SEMI; filename: ID; //fs_expression: (ID (OPEN_PAREN (fs_parm (COLON fs_parm)*)? CLOSE_PAREN)?); fs_parm: expression | fs_string; fs_string: (StringLiteralStart|HexLiteralStart|DateLiteralStart) (StringContent | StringEscapedQuote )* StringLiteralEnd; fs_keyword: keyword_alias | keyword_block | keyword_commit | keyword_datfmt | keyword_devid | keyword_dim | keyword_dtaara | keyword_extdesc | keyword_extfile | keyword_extind | keyword_extmbr | keyword_formlen | keyword_formofl | keyword_ignore | keyword_include | keyword_indds | keyword_infds | keyword_infsr | keyword_keyloc | keyword_likefile | keyword_maxdev | keyword_oflind | keyword_pass | keyword_pgmname | keyword_plist | keyword_prefix | keyword_prtctl | keyword_qualified | keyword_rafdata | keyword_recno | keyword_rename | keyword_saveds | keyword_saveind | keyword_sfile | keyword_sln | keyword_static | keyword_template | keyword_timfmt | keyword_tofile | keyword_usropn | keyword_value | keyword_varying | keyword_disk | keyword_workstn | keyword_printer | keyword_special | keyword_keyed | keyword_usage; fspec_fixed: FS_FIXED FS_RecordName FS_Type FS_Designation FS_EndOfFile FS_Addution FS_Sequence FS_Format FS_RecordLength FS_Limits FS_LengthOfKey FS_RecordAddressType FS_Organization FS_Device FS_Reserved? fs_keyword* (EOL|EOF); cspec_fixed: CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor (cspec_fixed_standard|cspec_fixed_x2); cspec_continuedIndicators: cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators EOL CS_FIXED ; cspec_blank: CS_FIXED BlankIndicator BlankFlag BlankIndicator CS_BlankFactor CS_OperationAndExtender_Blank CS_BlankFactor CS_BlankFactor CS_FieldLength CS_DecimalPositions BlankIndicator BlankIndicator BlankIndicator (EOL | EOF); blank_spec: cspec_blank | ( DS_FIXED | FS_FIXED | IS_FIXED | OS_FIXED) BLANK_SPEC (EOL | EOF) ; // -------- interfaces -------- piBegin: DS_FIXED ds_name EXTERNAL_DESCRIPTION DATA_STRUCTURE_TYPE DEF_TYPE_PI FROM_POSITION TO_POSITION DATA_TYPE DECIMAL_POSITIONS RESERVED keyword* (EOL|EOF); parm_fixed: DS_FIXED ds_name EXTERNAL_DESCRIPTION DATA_STRUCTURE_TYPE DEF_TYPE_BLANK FROM_POSITION TO_POSITION DATA_TYPE DECIMAL_POSITIONS RESERVED keyword* (EOL|EOF); pr_parm_fixed: DS_FIXED ds_name? EXTERNAL_DESCRIPTION DATA_STRUCTURE_TYPE DEF_TYPE_BLANK FROM_POSITION TO_POSITION DATA_TYPE DECIMAL_POSITIONS RESERVED keyword* (EOL|EOF); pi_parm_fixed : parm_fixed | (prBegin pr_parm_fixed* ); // -------- sub procedures -------- procedure: beginProcedure dcl_pi? statements=subprocedurestatement* endProcedure; beginProcedure: psBegin | freeBeginProcedure; endProcedure: psEnd | freeEndProcedure; psBegin: PS_FIXED ps_name PS_BEGIN PS_KEYWORDS; freeBeginProcedure:DS_ProcedureStart identifier FREE_SEMI; psEnd: PS_FIXED ps_name PS_END PS_KEYWORDS; freeEndProcedure:DS_ProcedureEnd identifier? FREE_SEMI; prBegin: DS_FIXED ds_name EXTERNAL_DESCRIPTION DATA_STRUCTURE_TYPE DEF_TYPE_PR FROM_POSITION TO_POSITION DATA_TYPE DECIMAL_POSITIONS RESERVED keyword* (EOL|EOF); // -------- sub routines -------- subroutine: begin=begsr statement* end=endsr ; subprocedurestatement: statement | subroutine | dcl_pr ; begsr:csBEGSR | freeBEGSR; endsr:csENDSR | freeENDSR; csBEGSR: CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor operation=OP_BEGSR cspec_fixed_standard_parts; freeBEGSR: OP_BEGSR identifier FREE_SEMI free_linecomments? ; csENDSR: CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor operation=OP_ENDSR cspec_fixed_standard_parts; freeENDSR: OP_ENDSR (identifier | literal)? FREE_SEMI free_linecomments? ; onOffIndicatorsFlag: BlankFlag | NoFlag; cs_controlLevel: BlankIndicator | ControlLevel0Indicator | ControlLevelIndicator | LastRecordIndicator | SubroutineIndicator | AndIndicator | OrIndicator ; cs_indicators: BlankIndicator | GeneralIndicator | ControlLevelIndicator | FunctionKeyIndicator | LastRecordIndicator | MatchingRecordIndicator | HaltIndicator | ReturnIndicator | ExternalIndicator | OverflowIndicator ; resultIndicator: BlankIndicator | GeneralIndicator | ControlLevelIndicator | FunctionKeyIndicator | LastRecordIndicator | MatchingRecordIndicator | HaltIndicator | ExternalIndicator | OverflowIndicator | ReturnIndicator ; cspec_fixed_sql: CS_ExecSQL CSQL_TEXT+ CSQL_END; cspec_fixed_standard: csACQ | csADD | csADDDUR | csALLOC //| csANDxx //| csANDEQ //| csANDNE //| csANDLE //| csANDLT //| csANDGE //| csANDGT //| csBEGSR | csBITOFF | csBITON | csCABxx | csCABEQ | csCABNE | csCABLE | csCABLT | csCABGE | csCABGT | csCALL | csCALLB //| csCASEQ //| csCASNE //| csCASLE //| csCASLT //| csCASGE //| csCASGT | csCAT | csCHAIN | csCHECK | csCHECKR | csCLEAR | csCLOSE | csCOMMIT | csCOMP | csDEALLOC | csDEFINE | csDELETE | csDIV | csDO //| csDOU //| csDOUEQ //| csDOUNE //| csDOULE //| csDOULT //| csDOUGE //| csDOUGT //| csDOW //| csDOWEQ //| csDOWNE //| csDOWLE //| csDOWLT //| csDOWGE //| csDOWGT | csDSPLY | csDUMP //| csELSE //| csELSEIF //| csEND //| csENDCS //| csENDDO //| csENDFOR //| csENDIF //| csENDMON //| csENDSL //| csENDSR | csEVAL | csEVAL_CORR | csEVALR | csEXCEPT | csEXFMT | csEXSR | csEXTRCT | csFEOD //| csFOR | csFORCE | csGOTO //| csIF //| csIFEQ //| csIFNE //| csIFLE //| csIFLT //| csIFGE //| csIFGT | csIN | csITER | csKLIST | csLEAVE | csLEAVESR | csLOOKUP | csMHHZO | csMHLZO | csMLHZO | csMLLZO //| csMONITOR | csMOVE | csMOVEA | csMOVEL | csMULT //| csMVR | csNEXT | csOCCUR //| csON_ERROR | csOPEN //| csOREQ //| csORNE //| csORLE //| csORLT //| csORGE //| csORGT | csOTHER | csOUT //| csPARM | csPLIST | csPOST | csREAD | csREADC | csREADE | csREADP | csREADPE | csREALLOC | csREL | csRESET | csRETURN | csROLBK | csSCAN //| csSELECT | csSETGT | csSETLL | csSETOFF | csSETON | csSHTDN | csSORTA | csSQRT | csSUB | csSUBDUR | csSUBST | csTAG | csTEST | csTESTB | csTESTN | csTESTZ | csTIME | csUNLOCK | csUPDATE //| csWHEN //| csWHENEQ //| csWHENNE //| csWHENLE //| csWHENLT //| csWHENGE //| csWHENGT | csWRITE | csXFOOT | csXLATE | csXML_INTO | csXML_SAX | csZ_ADD | csZ_SUB |(operation=CS_OperationAndExtender operationExtender=cs_operationExtender? cspec_fixed_standard_parts); cspec_fixed_standard_parts: factor2=factor result=resultType len=CS_FieldLength decimalPositions=CS_DecimalPositions hi=resultIndicator lo=resultIndicator eq=resultIndicator cs_fixed_comments? (EOL|EOF); /* * Fixed op codes */ csACQ: operation=OP_ACQ operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csADD: operation=OP_ADD operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csADDDUR: operation=OP_ADDDUR operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csALLOC: operation=OP_ALLOC operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csANDEQ: operation=OP_ANDEQ cspec_fixed_standard_parts; csANDNE: operation=OP_ANDNE cspec_fixed_standard_parts; csANDLE: operation=OP_ANDLE cspec_fixed_standard_parts; csANDLT: operation=OP_ANDLT cspec_fixed_standard_parts; csANDGE: operation=OP_ANDGE cspec_fixed_standard_parts; csANDGT: operation=OP_ANDGT cspec_fixed_standard_parts; //csBEGSR: // operation=OP_BEGSR // cspec_fixed_standard_parts; csBITOFF: operation=OP_BITOFF cspec_fixed_standard_parts; csBITON: operation=OP_BITON cspec_fixed_standard_parts; csCABxx: operation=OP_CABxx cspec_fixed_standard_parts; csCABEQ: operation=OP_CABEQ cspec_fixed_standard_parts; csCABNE: operation=OP_CABNE cspec_fixed_standard_parts; csCABLE: operation=OP_CABLE cspec_fixed_standard_parts; csCABLT: operation=OP_CABLT cspec_fixed_standard_parts; csCABGE: operation=OP_CABGE cspec_fixed_standard_parts; csCABGT: operation=OP_CABGT cspec_fixed_standard_parts; csCALL: operation=OP_CALL operationExtender=cs_operationExtender? cspec_fixed_standard_parts csPARM*; csCALLB: operation=OP_CALLB operationExtender=cs_operationExtender? cspec_fixed_standard_parts csPARM*; csCALLP: operation=OP_CALLP operationExtender=cs_operationExtender? fixedexpression=c_free (C_FREE_NEWLINE | EOF); csCASEQ: operation=OP_CASEQ cspec_fixed_standard_parts; csCASNE: operation=OP_CASNE cspec_fixed_standard_parts; csCASLE: operation=OP_CASLE cspec_fixed_standard_parts; csCASLT: operation=OP_CASLT cspec_fixed_standard_parts; csCASGE: operation=OP_CASGE cspec_fixed_standard_parts; csCASGT: operation=OP_CASGT cspec_fixed_standard_parts; csCAS: operation=OP_CAS cspec_fixed_standard_parts; csCAT: operation=OP_CAT operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csCHAIN: operation=OP_CHAIN operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csCHECK: operation=OP_CHECK operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csCHECKR: operation=OP_CHECKR operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csCLEAR: operation=OP_CLEAR cspec_fixed_standard_parts; csCLOSE: operation=OP_CLOSE operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csCOMMIT: operation=OP_COMMIT operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csCOMP: operation=OP_COMP cspec_fixed_standard_parts; csDEALLOC: operation=OP_DEALLOC operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csDEFINE: operation=OP_DEFINE cspec_fixed_standard_parts; csDELETE: operation=OP_DELETE operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csDIV: operation=OP_DIV operationExtender=cs_operationExtender? cspec_fixed_standard_parts csMVR?; csDO: operation=OP_DO cspec_fixed_standard_parts; csDOU: operation=OP_DOU operationExtender=cs_operationExtender? fixedexpression=c_free (C_FREE_NEWLINE | EOF); csDOUEQ: operation=OP_DOUEQ cspec_fixed_standard_parts; csDOUNE: operation=OP_DOUNE cspec_fixed_standard_parts; csDOULE: operation=OP_DOULE cspec_fixed_standard_parts; csDOULT: operation=OP_DOULT cspec_fixed_standard_parts; csDOUGE: operation=OP_DOUGE cspec_fixed_standard_parts; csDOUGT: operation=OP_DOUGT cspec_fixed_standard_parts; csDOW: operation=OP_DOW operationExtender=cs_operationExtender? fixedexpression=c_free (C_FREE_NEWLINE | EOF); csDOWEQ: operation=OP_DOWEQ cspec_fixed_standard_parts; csDOWNE: operation=OP_DOWNE cspec_fixed_standard_parts; csDOWLE: operation=OP_DOWLE cspec_fixed_standard_parts; csDOWLT: operation=OP_DOWLT cspec_fixed_standard_parts; csDOWGE: operation=OP_DOWGE cspec_fixed_standard_parts; csDOWGT: operation=OP_DOWGT cspec_fixed_standard_parts; csDSPLY: operation=OP_DSPLY operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csDUMP: operation=OP_DUMP operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csELSE: operation=OP_ELSE cspec_fixed_standard_parts; csELSEIF: operation=OP_ELSEIF operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csEND: operation=OP_END cspec_fixed_standard_parts; csENDCS: operation=OP_ENDCS cspec_fixed_standard_parts; csENDDO: operation=OP_ENDDO cspec_fixed_standard_parts; csENDFOR: operation=OP_ENDFOR cspec_fixed_standard_parts; csENDIF: operation=OP_ENDIF cspec_fixed_standard_parts; csENDMON: operation=OP_ENDMON cspec_fixed_standard_parts; csENDSL: operation=OP_ENDSL cspec_fixed_standard_parts; //csENDSR: // operation=OP_ENDSR // cspec_fixed_standard_parts; csEVAL: operation=OP_EVAL operationExtender=cs_operationExtender? fixedexpression=c_free (C_FREE_NEWLINE | EOF); csEVAL_CORR: operation=OP_EVAL_CORR fixedexpression=c_free (C_FREE_NEWLINE | EOF); csEVALR: operation=OP_EVALR operationExtender=cs_operationExtender? fixedexpression=c_free (C_FREE_NEWLINE | EOF); csEXCEPT: operation=OP_EXCEPT cspec_fixed_standard_parts; csEXFMT: operation=OP_EXFMT operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csEXSR: operation=OP_EXSR cspec_fixed_standard_parts; csEXTRCT: operation=OP_EXTRCT operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csFEOD: operation=OP_FEOD operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csFOR: operation=OP_FOR operationExtender=cs_operationExtender? expression //For(E) I (EQUAL expression )? // = 1 ( (FREE_BY expression )? // By 1 ((FREE_TO | FREE_DOWNTO) expression )? | ((FREE_TO | FREE_DOWNTO) expression )? (FREE_BY expression )? // By 1 ) (C_FREE_NEWLINE | EOF); // TO 10 ; csFORCE: operation=OP_FORCE cspec_fixed_standard_parts; csGOTO: operation=OP_GOTO cspec_fixed_standard_parts; csIF: operation=OP_IF operationExtender=cs_operationExtender? fixedexpression=c_free (C_FREE_NEWLINE | EOF); csIFEQ: operation=OP_IFEQ cspec_fixed_standard_parts; csIFNE: operation=OP_IFNE cspec_fixed_standard_parts; csIFLE: operation=OP_IFLE cspec_fixed_standard_parts; csIFLT: operation=OP_IFLT cspec_fixed_standard_parts; csIFGE: operation=OP_IFGE cspec_fixed_standard_parts; csIFGT: operation=OP_IFGT cspec_fixed_standard_parts; csIN: operation=OP_IN operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csITER: operation=OP_ITER cspec_fixed_standard_parts; csKLIST: operation=OP_KLIST cspec_fixed_standard_parts csKFLD*; csKFLD: CS_FIXED BlankIndicator BlankFlag BlankIndicator CS_BlankFactor operation=OP_KFLD cspec_fixed_standard_parts; csLEAVE: operation=OP_LEAVE cspec_fixed_standard_parts; csLEAVESR: operation=OP_LEAVESR cspec_fixed_standard_parts; csLOOKUP: operation=OP_LOOKUP cspec_fixed_standard_parts; csMHHZO: operation=OP_MHHZO cspec_fixed_standard_parts; csMHLZO: operation=OP_MHLZO cspec_fixed_standard_parts; csMLHZO: operation=OP_MLHZO cspec_fixed_standard_parts; csMLLZO: operation=OP_MLLZO cspec_fixed_standard_parts; csMONITOR: operation=OP_MONITOR cspec_fixed_standard_parts; csMOVE: operation=OP_MOVE operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csMOVEA: operation=OP_MOVEA operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csMOVEL: operation=OP_MOVEL operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csMULT: operation=OP_MULT operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csMVR: CS_FIXED BlankIndicator BlankFlag ( BlankIndicator | GeneralIndicator ) CS_BlankFactor operation=OP_MVR cspec_fixed_standard_parts; csNEXT: operation=OP_NEXT operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csOCCUR: operation=OP_OCCUR operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csON_ERROR: operation=OP_ON_ERROR (onErrorCode (COLON onErrorCode) *)? (C_FREE_NEWLINE | EOF); onErrorCode: (identifier | number); csOPEN: operation=OP_OPEN operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csOREQ: operation=OP_OREQ cspec_fixed_standard_parts; csORNE: operation=OP_ORNE cspec_fixed_standard_parts; csORLE: operation=OP_ORLE cspec_fixed_standard_parts; csORLT: operation=OP_ORLT cspec_fixed_standard_parts; csORGE: operation=OP_ORGE cspec_fixed_standard_parts; csORGT: operation=OP_ORGT cspec_fixed_standard_parts; csOTHER: operation=OP_OTHER cspec_fixed_standard_parts; csOUT: operation=OP_OUT operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csPARM: CS_FIXED cspec_continuedIndicators* cs_controlLevel indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor operation=OP_PARM cspec_fixed_standard_parts; csPLIST: operation=OP_PLIST cspec_fixed_standard_parts csPARM*; csPOST: operation=OP_POST operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csREAD: operation=OP_READ operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csREADC: operation=OP_READC operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csREADE: operation=OP_READE operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csREADP: operation=OP_READP operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csREADPE: operation=OP_READPE operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csREALLOC: operation=OP_REALLOC operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csREL: operation=OP_REL operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csRESET: operation=OP_RESET operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csRETURN: operation=OP_RETURN operationExtender=cs_operationExtender? fixedexpression=c_free? (C_FREE_NEWLINE | EOF); csROLBK: operation=OP_ROLBK operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csSCAN: operation=OP_SCAN operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csSELECT: operation=OP_SELECT cspec_fixed_standard_parts; csSETGT: operation=OP_SETGT operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csSETLL: operation=OP_SETLL operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csSETOFF: operation=OP_SETOFF cspec_fixed_standard_parts; csSETON: operation=OP_SETON cspec_fixed_standard_parts; csSHTDN: operation=OP_SHTDN cspec_fixed_standard_parts; csSORTA: operation=OP_SORTA operationExtender=cs_operationExtender? fixedexpression=c_free (C_FREE_NEWLINE | EOF); csSQRT: operation=OP_SQRT operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csSUB: operation=OP_SUB operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csSUBDUR: operation=OP_SUBDUR operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csSUBST: operation=OP_SUBST operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csTAG: operation=OP_TAG cspec_fixed_standard_parts; csTEST: operation=OP_TEST operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csTESTB: operation=OP_TESTB cspec_fixed_standard_parts; csTESTN: operation=OP_TESTN cspec_fixed_standard_parts; csTESTZ: operation=OP_TESTZ cspec_fixed_standard_parts; csTIME: operation=OP_TIME cspec_fixed_standard_parts; csUNLOCK: operation=OP_UNLOCK operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csUPDATE: operation=OP_UPDATE operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csWHEN: OP_WHEN operationExtender=cs_operationExtender? fixedexpression=c_free (C_FREE_NEWLINE | EOF); csWHENEQ: operation=OP_WHENEQ cspec_fixed_standard_parts; csWHENNE: operation=OP_WHENNE cspec_fixed_standard_parts; csWHENLE: operation=OP_WHENLE cspec_fixed_standard_parts; csWHENLT: operation=OP_WHENLT cspec_fixed_standard_parts; csWHENGE: operation=OP_WHENGE cspec_fixed_standard_parts; csWHENGT: operation=OP_WHENGT cspec_fixed_standard_parts; csWRITE: operation=OP_WRITE operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csXFOOT: operation=OP_XFOOT operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csXLATE: operation=OP_XLATE operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csXML_INTO: operation=OP_XML_INTO operationExtender=cs_operationExtender? fixedexpression=c_free (C_FREE_NEWLINE | EOF); csXML_SAX: operation=OP_XML_SAX operationExtender=cs_operationExtender? fixedexpression=c_free (C_FREE_NEWLINE | EOF); csZ_ADD: operation=OP_Z_ADD operationExtender=cs_operationExtender? cspec_fixed_standard_parts; csZ_SUB: operation=OP_Z_SUB operationExtender=cs_operationExtender? cspec_fixed_standard_parts; cs_operationExtender: OPEN_PAREN? extender=CS_OperationAndExtender extender2=CS_OperationAndExtender? extender3=CS_OperationAndExtender? extender4=CS_OperationAndExtender? CLOSE_PAREN; factor: content=factorContent (COLON (content2=factorContent | constant2=symbolicConstants))? | CS_BlankFactor | constant=symbolicConstants literal?; factorContent: CS_FactorContent | literal; resultType: CS_FactorContent (COLON (constant=symbolicConstants))? | CS_BlankFactor; cs_fixed_comments:CS_FixedComments; //cs_fixed_x2: CS_OperationAndExtendedFactor2 C2_FACTOR2_CONT* C2_FACTOR2 C_EOL; cspec_fixed_x2: csOperationAndExtendedFactor2 fixedexpression=c_free (C_FREE_NEWLINE | EOF); csOperationAndExtendedFactor2: operation=OP_EVAL //|operation=OP_IF |operation=OP_CALLP operationExtender=cs_operationExtender? //|operation=OP_DOW //|operation=OP_ELSEIF ; ispec_fixed: IS_FIXED ((IS_FileName //IS_LogicalRelationship (is_external_rec |is_rec) (EOL|EOF) ) | (is_external_field (EOL|EOF) ) | (IFD_DATA_ATTR IFD_DATETIME_SEP IFD_DATA_FORMAT IFD_FIELD_LOCATION IFD_DECIMAL_POSITIONS IFD_FIELD_NAME IFD_CONTROL_LEVEL IFD_MATCHING_FIELDS fieldRecordRelation fieldIndicator fieldIndicator fieldIndicator IFD_COMMENTS? (EOL|EOF) )) ; fieldRecordRelation: BlankIndicator | GeneralIndicator | ControlLevelIndicator | MatchingRecordIndicator | ExternalIndicator | HaltIndicator | ReturnIndicator ; fieldIndicator: BlankIndicator | GeneralIndicator | ControlLevelIndicator | HaltIndicator | ExternalIndicator | ReturnIndicator ; is_external_rec: IS_ExtRecordReserved resultIndicator WS?; is_rec: IS_Sequence IS_Number IS_Option recordIdIndicator IS_RecordIdCode; recordIdIndicator: GeneralIndicator | HaltIndicator | ControlLevelIndicator | LastRecordIndicator | ExternalIndicator | ReturnIndicator | BlankIndicator; is_external_field: IF_Name IF_FieldName controlLevelIndicator matchingFieldsIndicator resultIndicator resultIndicator resultIndicator ; controlLevelIndicator: ControlLevelIndicator | BlankIndicator; matchingFieldsIndicator: MatchingRecordIndicator | BlankIndicator; hspec_fixed: HS_FIXED hs_expression* (EOL|EOF); hs_expression: (ID (OPEN_PAREN (hs_parm (COLON hs_parm)*)? CLOSE_PAREN)?); hs_parm: ID | hs_string | symbolicConstants; hs_string: StringLiteralStart (StringContent | StringEscapedQuote )* StringLiteralEnd; blank_line: BLANK_LINE; directive: DIRECTIVE ( beginfree_directive | endfree_directive | title_directive | DIR_EJECT | space_directive | DIR_SET | DIR_RESTORE | dir_copy | dir_include | dir_eof | dir_define | dir_undefine | dir_if | dir_elseif | dir_else | dir_endif ) (EOL|EOF); space_directive: DIR_SPACE (NUMBER)?; dir_copy: (DIR_COPY ( (((library=copyText DIR_Slash)? file=copyText)? member=copyText) | (DIR_Slash? (copyText DIR_Slash)+ copyText) ) ); dir_include: (DIR_INCLUDE ( (((library=copyText DIR_Slash)? file=copyText)? member=copyText) | (file=copyText member=copyText) | (DIR_Slash? (copyText DIR_Slash)+ copyText) ) (DIR_OtherText+)? ); dir_if: DIR_IF not=DIR_NOT? DIR_DEFINED OPEN_PAREN copyText CLOSE_PAREN; dir_elseif: DIR_ELSEIF not=DIR_NOT? DIR_DEFINED OPEN_PAREN copyText CLOSE_PAREN; dir_else: DIR_ELSE; dir_endif: DIR_ENDIF; dir_define: DIR_DEFINE name=DIR_OtherText; dir_undefine: DIR_UNDEFINE name=DIR_OtherText; dir_eof:DIR_EOF; beginfree_directive: DIR_FREE; endfree_directive: DIR_ENDFREE; copyText: DIR_OtherText | (StringLiteralStart StringContent StringLiteralEnd) | DIR_NOT | DIR_DEFINE; trailing_ws: DIR_FREE_OTHER_TEXT; //title_directive: DIR_TITLE title_text; //title_directive: DIR_TITLE (DIR_OtherText)?; title_directive: DIR_TITLE title_text*; //title_text: (NUMBER | DIR_OtherText) (NUMBER | DIR_OtherText); title_text: (NUMBER | DIR_OtherText); //------- Auto from here op: op_acq // | op_begsr | op_callp | op_chain | op_clear | op_close | op_commit | op_dealloc | op_delete //| op_dou //| op_dow | op_dsply | op_dump //| op_else //| op_elseif //| op_enddo //| op_endfor //| op_endif //| op_endmon //| op_endsl //| op_endsr | op_eval | op_evalr | op_eval_corr | op_except | op_exfmt | op_exsr | op_feod //| op_for | op_force //| op_if | op_in | op_iter | op_leave | op_leavesr //| op_monitor | op_next //| op_on_error | op_open //| op_other | op_out | op_post | op_read | op_readc | op_reade | op_readp | op_readpe | op_rel | op_reset | op_reset2 | op_return | op_rolbk //| op_select | op_setgt | op_setll | op_sorta | op_test | op_unlock | op_update //| op_when | op_write | op_xml_into | op_xml_sax; op_acq: OP_ACQ cs_operationExtender? identifier identifier ; //op_begsr: OP_BEGSR identifier ; op_callp: (OP_CALLP cs_operationExtender? )? identifier OPEN_PAREN (expression (COLON expression )* )? CLOSE_PAREN ; op_chain: OP_CHAIN cs_operationExtender? search_arg identifier (identifier )? ; op_clear: OP_CLEAR (identifier )? (identifier )? expression ; op_close: OP_CLOSE cs_operationExtender? identifier ; op_commit: OP_COMMIT cs_operationExtender? (identifier )? ; op_dealloc: OP_DEALLOC cs_operationExtender? identifier ; op_delete: OP_DELETE cs_operationExtender? (search_arg )? identifier ; op_dou: OP_DOU cs_operationExtender? indicator_expr ; op_dow: OP_DOW cs_operationExtender? indicator_expr ; op_dsply: OP_DSPLY cs_operationExtender? (expression (expression (expression )? )? )? ; op_dump: OP_DUMP cs_operationExtender? (identifier )? ; op_else: OP_ELSE ; op_elseif: OP_ELSEIF cs_operationExtender? indicator_expr ; op_enddo: OP_ENDDO ; op_endfor: OP_ENDFOR ; op_endif: OP_ENDIF ; op_endmon: OP_ENDMON ; op_endsl: OP_ENDSL ; //op_endsr: OP_ENDSR (identifier )? ; op_eval: (OP_EVAL cs_operationExtender? )? evalExpression ; op_evalr: OP_EVALR cs_operationExtender? assignmentExpression ; op_eval_corr: OP_EVAL_CORR cs_operationExtender? assignmentExpression ; op_except: OP_EXCEPT (identifier )? ; op_exfmt: OP_EXFMT cs_operationExtender? identifier (identifier )? ; op_exsr: OP_EXSR identifier ; op_feod: OP_FEOD cs_operationExtender? identifier ; op_for: OP_FOR cs_operationExtender? indexname=expression //For(E) I (EQUAL startvalue=expression )? // = 1 (FREE_BY increment=expression )? // By 1 ((FREE_TO | FREE_DOWNTO) limit=expression )?; // TO 10 ; op_force: OP_FORCE identifier ; op_if: OP_IF cs_operationExtender? expression ; op_in: OP_IN cs_operationExtender? (identifier )? identifier ; op_iter: OP_ITER ; op_leave: OP_LEAVE ; op_leavesr: OP_LEAVESR ; op_monitor: OP_MONITOR ; op_next: OP_NEXT cs_operationExtender? (literal | identifier) identifier ; op_on_error: OP_ON_ERROR (onErrorCode (COLON onErrorCode )* )? ; op_open: OP_OPEN cs_operationExtender? identifier ; op_other: OP_OTHER ; op_out: OP_OUT cs_operationExtender? (identifier )? identifier ; op_post: OP_POST cs_operationExtender? (literal | identifier)? identifier ; op_read: OP_READ cs_operationExtender? identifier (identifier )? ; op_readc: OP_READC cs_operationExtender? identifier (identifier )? ; op_reade: OP_READE cs_operationExtender? search_arg identifier (identifier )? ; op_readp: OP_READP cs_operationExtender? identifier (identifier )? ; op_readpe: OP_READPE cs_operationExtender? search_arg identifier (identifier )? ; op_rel: OP_REL cs_operationExtender? (literal | identifier) identifier ; op_reset2: OP_RESET cs_operationExtender? identifier OPEN_PAREN MULT_NOSPACE? CLOSE_PAREN ; op_reset: OP_RESET cs_operationExtender? (identifier)? (identifier )? identifier ; op_return: OP_RETURN cs_operationExtender? expression? ; op_rolbk: OP_ROLBK cs_operationExtender? ; op_select: OP_SELECT ; op_setgt: OP_SETGT cs_operationExtender? search_arg identifier ; op_setll: OP_SETLL cs_operationExtender? search_arg identifier ; op_sorta: OP_SORTA cs_operationExtender? (identifier | bif_subarr); op_test: OP_TEST cs_operationExtender? (identifier )? identifier ; op_unlock: OP_UNLOCK cs_operationExtender? identifier ; op_update: OP_UPDATE cs_operationExtender? identifier (identifier | bif_fields )? ; op_when: OP_WHEN cs_operationExtender? indicator_expr ; op_write: OP_WRITE cs_operationExtender? identifier (identifier )? ; op_xml_into: OP_XML_INTO cs_operationExtender? identifier expression ; op_xml_sax: OP_XML_SAX cs_operationExtender? bif_handler bif_xml ; search_arg: expression | args; op_code: OP_ACQ | OP_BEGSR | OP_CALLP | OP_CHAIN | OP_CLEAR | OP_CLOSE | OP_COMMIT | OP_DEALLOC | OP_DELETE //| OP_DOU //| OP_DOW | OP_DSPLY | OP_DUMP //| OP_ELSE //| OP_ELSEIF //| OP_ENDDO //| OP_ENDFOR //| OP_ENDIF //| OP_ENDMON //| OP_ENDSL | OP_ENDSR | OP_EVAL | OP_EVALR | OP_EVAL_CORR | OP_EXCEPT | OP_EXFMT | OP_EXSR | OP_FEOD //| OP_FOR | OP_FORCE //| OP_IF | OP_IN | OP_ITER | OP_LEAVE | OP_LEAVESR //| OP_MONITOR | OP_NEXT //| OP_ON_ERROR | OP_OPEN | OP_OTHER | OP_OUT | OP_POST | OP_READ | OP_READC | OP_READE | OP_READP | OP_READPE | OP_REL | OP_RESET | OP_RETURN | OP_ROLBK | OP_SELECT | OP_SETGT | OP_SETLL | OP_SORTA | OP_TEST | OP_UNLOCK | OP_UPDATE | OP_WHEN | OP_WRITE | OP_XML_INTO | OP_XML_SAX; //-------------------------------- bif: bif_abs | bif_addr | bif_alloc | bif_bitand | bif_bitnot | bif_bitor | bif_bitxor | bif_char | bif_check | bif_checkr | bif_date | bif_days | bif_dec | bif_dech | bif_decpos | bif_diff | bif_div | bif_editc | bif_editflt | bif_editw | bif_elem | bif_eof | bif_equal | bif_error | bif_fields | bif_float | bif_found | bif_graph | bif_handler | bif_hours | bif_int | bif_inth | bif_kds | bif_len | bif_lookup | bif_lookuplt | bif_lookuple | bif_lookupgt | bif_lookupge | bif_minutes | bif_months | bif_mseconds | bif_nullind | bif_occur | bif_open | bif_paddr | bif_parms | bif_parmnum | bif_realloc | bif_rem | bif_replace | bif_scan | bif_scanrpl | bif_seconds | bif_shtdn | bif_size | bif_sqrt | bif_status | bif_str | bif_subarr | bif_subdt | bif_subst | bif_this | bif_time | bif_timestamp | bif_tlookup | bif_tlookuplt | bif_tlookuple | bif_tlookupgt | bif_tlookupge | bif_trim | bif_triml | bif_trimr | bif_ucs2 | bif_uns | bif_unsh | bif_xfoot | bif_xlate | bif_xml | bif_years; optargs: (OPEN_PAREN (expression (COLON expression)*)? CLOSE_PAREN)?; // TODO bif_charformat: symbolicConstants; //SPLAT_JOBRUN | SPLAT_HMS | SPLAT_ISO | SPLAT_EUR | SPLAT_DMY .. bif_dateformat: symbolicConstants; bif_timeformat: symbolicConstants; bif_editccurrency : SPLAT_ASTFILL | SPLAT_CURSYM | literal; bif_lookupargs: OPEN_PAREN arg=expression (COLON array=expression)? (COLON startindex=expression)? (COLON numberelements=expression)? CLOSE_PAREN; durationCode: SPLAT_D | SPLAT_H | SPLAT_HOURS | SPLAT_DAYS | SPLAT_M | SPLAT_MINUTES | SPLAT_MONTHS | SPLAT_MN | SPLAT_MS | SPLAT_MSECONDS | SPLAT_S | SPLAT_SECONDS | SPLAT_Y |SPLAT_YEARS; bif_timestampargs : SPLAT_ISO ; bif_tlookupargs: OPEN_PAREN arg=expression COLON searchtable=expression (COLON alttable=expression)? CLOSE_PAREN; bif_abs: BIF_ABS OPEN_PAREN numericexpression=expression CLOSE_PAREN; bif_addr: BIF_ADDR OPEN_PAREN variable=expression (COLON stardata=SPLAT_DATA)? CLOSE_PAREN; bif_alloc: BIF_ALLOC OPEN_PAREN num=expression CLOSE_PAREN; bif_bitand: BIF_BITAND OPEN_PAREN expression COLON expression (COLON expression)* CLOSE_PAREN; bif_bitnot: BIF_BITNOT OPEN_PAREN expression CLOSE_PAREN; bif_bitor: BIF_BITOR OPEN_PAREN expression COLON expression (COLON expression)* CLOSE_PAREN; bif_bitxor: BIF_BITXOR OPEN_PAREN expression COLON expression CLOSE_PAREN; bif_char: BIF_CHAR OPEN_PAREN expression (COLON format=bif_charformat)? CLOSE_PAREN; bif_check: BIF_CHECK OPEN_PAREN comparator=expression COLON base=expression (COLON start=expression)? CLOSE_PAREN; bif_checkr: BIF_CHECKR OPEN_PAREN comparator=expression COLON base=expression (COLON start=expression)? CLOSE_PAREN; bif_date: BIF_DATE (OPEN_PAREN expression? (COLON dateformat=bif_dateformat)? CLOSE_PAREN)?; bif_days: BIF_DAYS OPEN_PAREN numberexpression=expression CLOSE_PAREN; bif_dec: BIF_DEC OPEN_PAREN expression (COLON expression)? (COLON expression)? CLOSE_PAREN; bif_dech: BIF_DECH OPEN_PAREN expression COLON expression COLON expression CLOSE_PAREN; bif_decpos: BIF_DECPOS OPEN_PAREN numericexpression=expression CLOSE_PAREN; bif_diff: BIF_DIFF OPEN_PAREN op1=expression COLON op2=expression COLON format=durationCode CLOSE_PAREN; bif_div: BIF_DIV OPEN_PAREN numerator=expression COLON denominator=expression CLOSE_PAREN; bif_editc: BIF_EDITC OPEN_PAREN numeric=expression COLON editcode=expression (COLON currency=bif_editccurrency)? CLOSE_PAREN; bif_editflt: BIF_EDITFLT OPEN_PAREN numericexpression=expression CLOSE_PAREN; bif_editw: BIF_EDITW OPEN_PAREN numeric=expression COLON editword=expression CLOSE_PAREN; bif_elem: BIF_ELEM OPEN_PAREN expression CLOSE_PAREN; bif_eof: BIF_EOF (OPEN_PAREN (filenameident=identifier)? CLOSE_PAREN)?; bif_equal: BIF_EQUAL (OPEN_PAREN filenameident=identifier CLOSE_PAREN)?; bif_error: BIF_ERROR (OPEN_PAREN CLOSE_PAREN)?; bif_fields: BIF_FIELDS OPEN_PAREN identifier (COLON identifier)* CLOSE_PAREN; bif_float: BIF_FLOAT OPEN_PAREN expression CLOSE_PAREN; bif_found: BIF_FOUND (OPEN_PAREN (filenameident=identifier)? CLOSE_PAREN)?; bif_graph: BIF_GRAPH OPEN_PAREN expression (COLON identifier)? CLOSE_PAREN; bif_handler: BIF_HANDLER OPEN_PAREN handlingprocedure=expression COLON communicationarea=expression CLOSE_PAREN; bif_hours: BIF_HOURS OPEN_PAREN numberexpression=expression CLOSE_PAREN; bif_int: BIF_INT OPEN_PAREN expression CLOSE_PAREN; bif_inth: BIF_INTH OPEN_PAREN expression CLOSE_PAREN; bif_kds: BIF_KDS OPEN_PAREN datastructure=expression (COLON numkeys=expression)? CLOSE_PAREN; bif_len: BIF_LEN OPEN_PAREN expression (COLON starmax=SPLAT_MAX)? CLOSE_PAREN; bif_lookup: BIF_LOOKUP bif_lookupargs; bif_lookuplt: BIF_LOOKUPLT bif_lookupargs; bif_lookuple: BIF_LOOKUPLE bif_lookupargs; bif_lookupgt: BIF_LOOKUPGT bif_lookupargs; bif_lookupge: BIF_LOOKUPGE bif_lookupargs; bif_minutes: BIF_MINUTES OPEN_PAREN minutes=expression CLOSE_PAREN; bif_months: BIF_MONTHS OPEN_PAREN numberexpression=expression CLOSE_PAREN; bif_mseconds: BIF_MSECONDS OPEN_PAREN numberexpression=expression CLOSE_PAREN; bif_nullind: BIF_NULLIND OPEN_PAREN fieldname=identifier CLOSE_PAREN; bif_occur: BIF_OCCUR OPEN_PAREN dsnname=identifier CLOSE_PAREN; bif_open: BIF_OPEN OPEN_PAREN filenameident=identifier CLOSE_PAREN; bif_paddr: BIF_PADDR OPEN_PAREN identifier CLOSE_PAREN; bif_parms: BIF_PARMS (OPEN_PAREN CLOSE_PAREN)?; bif_parmnum: BIF_PARMNUM OPEN_PAREN identifier CLOSE_PAREN; bif_realloc: BIF_REALLOC OPEN_PAREN ptr=identifier COLON num=expression CLOSE_PAREN; bif_rem: BIF_REM OPEN_PAREN numerator=expression COLON denominator=expression CLOSE_PAREN; bif_replace: BIF_REPLACE OPEN_PAREN replacement=expression COLON source=expression (COLON start=expression (COLON length=expression)? )? CLOSE_PAREN; bif_scan: BIF_SCAN OPEN_PAREN searcharg=expression COLON source=expression (COLON start=expression )? CLOSE_PAREN; bif_scanrpl: BIF_SCANRPL OPEN_PAREN scanstring=expression COLON replacement=expression COLON source=expression (COLON start=expression (COLON length=expression)? )? CLOSE_PAREN; bif_seconds: BIF_SECONDS OPEN_PAREN numberexpression=expression CLOSE_PAREN; bif_shtdn: BIF_SHTDN; bif_size: BIF_SIZE OPEN_PAREN expression (COLON SPLAT_ALL)? CLOSE_PAREN; bif_sqrt: BIF_SQRT OPEN_PAREN numeric=expression CLOSE_PAREN; bif_status: BIF_STATUS (OPEN_PAREN filenameident=identifier CLOSE_PAREN)?; bif_str: BIF_STR OPEN_PAREN basingpointer=expression (COLON maxlength=expression)? CLOSE_PAREN; bif_subarr: BIF_SUBARR OPEN_PAREN array=expression COLON start=expression (COLON numberelements=expression)? CLOSE_PAREN; bif_subdt: BIF_SUBDT OPEN_PAREN value=expression COLON format=durationCode CLOSE_PAREN; bif_subst: BIF_SUBST OPEN_PAREN string=expression COLON start=expression (COLON length=expression )? CLOSE_PAREN; bif_this: BIF_THIS; bif_time: BIF_TIME (OPEN_PAREN expression? (COLON timeformat=bif_timeformat)? CLOSE_PAREN)?; bif_timestamp: BIF_TIMESTAMP (OPEN_PAREN expression? (COLON format=bif_timestampargs)? CLOSE_PAREN)?; bif_tlookup: BIF_TLOOKUP bif_tlookupargs; bif_tlookuplt: BIF_TLOOKUPLT bif_tlookupargs; bif_tlookuple: BIF_TLOOKUPLE bif_tlookupargs; bif_tlookupgt: BIF_TLOOKUPGT bif_tlookupargs; bif_tlookupge: BIF_TLOOKUPGE bif_tlookupargs; bif_trim: BIF_TRIM OPEN_PAREN string=expression (COLON trimcharacters=expression)? CLOSE_PAREN; bif_triml: BIF_TRIML OPEN_PAREN string=expression (COLON trimcharacters=expression)? CLOSE_PAREN; bif_trimr: BIF_TRIMR OPEN_PAREN string=expression (COLON trimcharacters=expression)? CLOSE_PAREN; bif_ucs2: BIF_UCS2 OPEN_PAREN expression CLOSE_PAREN; bif_uns: BIF_UNS OPEN_PAREN expression CLOSE_PAREN; bif_unsh: BIF_UNSH OPEN_PAREN expression CLOSE_PAREN; bif_xfoot: BIF_XFOOT OPEN_PAREN arrayexpression=expression CLOSE_PAREN; bif_xlate: BIF_XLATE OPEN_PAREN from=expression COLON to=expression COLON string=expression (COLON startpos=expression)? CLOSE_PAREN; bif_xml: BIF_XML OPEN_PAREN xmldocument=expression (COLON options=expression)? CLOSE_PAREN; bif_years: BIF_YEARS OPEN_PAREN numberexpression=expression CLOSE_PAREN; bif_code: BIF_ABS | BIF_ADDR | BIF_ALLOC | BIF_BITAND | BIF_BITNOT | BIF_BITOR | BIF_BITXOR | BIF_CHAR | BIF_CHECK | BIF_CHECKR | BIF_DATE | BIF_DAYS | BIF_DEC | BIF_DECH | BIF_DECPOS | BIF_DIFF | BIF_DIV | BIF_EDITC | BIF_EDITFLT | BIF_EDITW | BIF_ELEM | BIF_EOF | BIF_EQUAL | BIF_ERROR | BIF_FIELDS | BIF_FLOAT | BIF_FOUND | BIF_GRAPH | BIF_HANDLER | BIF_HOURS | BIF_INT | BIF_INTH | BIF_KDS | BIF_LEN | BIF_LOOKUP | BIF_LOOKUPLT | BIF_LOOKUPLE | BIF_LOOKUPGT | BIF_LOOKUPGE | BIF_MINUTES | BIF_MONTHS | BIF_MSECONDS | BIF_NULLIND | BIF_OCCUR | BIF_OPEN | BIF_PADDR | BIF_PARMS | BIF_PARMNUM | BIF_REALLOC | BIF_REM | BIF_REPLACE | BIF_SCAN | BIF_SCANRPL | BIF_SECONDS | BIF_SHTDN | BIF_SIZE | BIF_SQRT | BIF_STATUS | BIF_STR | BIF_SUBARR | BIF_SUBDT | BIF_SUBST | BIF_THIS | BIF_TIME | BIF_TIMESTAMP | BIF_TLOOKUP | BIF_TLOOKUPLT | BIF_TLOOKUPLE | BIF_TLOOKUPGT | BIF_TLOOKUPGE | BIF_TRIM | BIF_TRIML | BIF_TRIMR | BIF_UCS2 | BIF_UNS | BIF_UNSH | BIF_XFOOT | BIF_XLATE | BIF_XML | BIF_YEARS; free: ((baseExpression FREE_SEMI free_linecomments? ) | exec_sql); // (NEWLINE |COMMENTS_EOL); c_free: (((expression) free_linecomments? ) | exec_sql); control: opCode indicator_expr; exec_sql: EXEC_SQL WORDS+ SEMI ; //sql_quoted: SINGLE_QTE (WORDS | SEMI | DOUBLE_QTE) * SINGLE_QTE ; //sql_quoted2: DOUBLE_QTE (WORDS | SEMI |SINGLE_QTE)* DOUBLE_QTE ; //--------------- baseExpression: op | expression; indicator: SPLAT_IN OPEN_PAREN baseExpression CLOSE_PAREN; assignmentExpression: simpleExpression EQUAL expression; assignOperatorExpression : simpleExpression assignmentOperator expression; evalExpression : assignmentExpression | assignOperatorExpression; simpleExpression: function | bif | identifier | number | literal | OPEN_PAREN expression CLOSE_PAREN ; unaryExpression: sign expression; expression: NOT expression | OPEN_PAREN expression CLOSE_PAREN | expression (assignmentOperator | comparisonOperator | EQUAL) expression | <assoc=right> expression EXP expression | expression (MULT | MULT_NOSPACE) expression | expression DIV expression | expression PLUS expression | expression MINUS expression | expression EQUAL expression | expression AND expression | expression OR expression | unaryExpression | indicator | function | identifier | number | literal | bif ; indicator_expr: expression; function: functionName args; //arithmeticalOperator:PLUS | MINUS | EXP | MULT | MULT_NOSPACE | DIV; comparisonOperator: GT | LT | GE | LE | NE; assignmentOperator: CPLUS | CMINUS | CMULT | CDIV | CEXP ; /*--------------- what words assignment: expression EQUAL indicator_expr; indicator_expr: indicator_expr_simple ((OR | AND | FREE_OPERATION) indicator_expr)*; indicator_expr_simple: (NOT? expression (compare_expr expression)?) ; compare_expr:(EQUAL | FREE_COMPARE); //and_or: {$getText =="OR"}? free_identifier ; //TODO expression: identifier | number | literal | function; function: functionName args; //---------------*/ args: OPEN_PAREN (expression (COLON expression)*)? CLOSE_PAREN; literal: (StringLiteralStart|HexLiteralStart|DateLiteralStart|TimeLiteralStart|TimeStampLiteralStart|UCS2LiteralStart|GraphicLiteralStart) content=(StringContent | StringEscapedQuote | PlusOrMinus)* StringLiteralEnd; identifier: free_identifier |multipart_identifier | all; all: symbolicConstants literal?; //assignIdentifier: multipart_identifier; functionName: free_identifier; multipart_identifier: (free_identifier | indexed_identifier) (FREE_DOT (free_identifier | indexed_identifier))*; indexed_identifier: free_identifier OPEN_PAREN (expression | ARRAY_REPEAT) CLOSE_PAREN; opCode: free_identifier; number: MINUS? NUMBER NumberPart* ; free_identifier: (continuedIdentifier | MULT_NOSPACE? idOrKeyword | NOT | FREE_BY | FREE_TO | FREE_DOWNTO |op_code);//OP_E? //free_identifier: (continuedIdentifier | ID | NOT | FREE_BY | FREE_TO | FREE_DOWNTO |op_code) OP_E?; continuedIdentifier: (idOrKeyword CONTINUATION)+ idOrKeyword ; idOrKeyword: ID | KEYWORD_ALIAS | KEYWORD_ALIGN | KEYWORD_ALT | KEYWORD_ALTSEQ | KEYWORD_ASCEND | KEYWORD_BASED | KEYWORD_CCSID | KEYWORD_CLASS | KEYWORD_CONST | KEYWORD_CTDATA | KEYWORD_DATFMT | KEYWORD_DESCEND | KEYWORD_DIM | KEYWORD_DTAARA | KEYWORD_EXPORT | KEYWORD_EXT | KEYWORD_EXTFLD | KEYWORD_EXTFMT | KEYWORD_EXTNAME | KEYWORD_EXTPGM | KEYWORD_EXTPROC | KEYWORD_FROMFILE | KEYWORD_IMPORT | KEYWORD_INZ | KEYWORD_LEN | KEYWORD_LIKE | KEYWORD_LIKEDS | KEYWORD_LIKEFILE | KEYWORD_LIKEREC | KEYWORD_NOOPT | KEYWORD_OCCURS | KEYWORD_OPDESC | KEYWORD_OPTIONS | KEYWORD_OVERLAY | KEYWORD_PACKEVEN | KEYWORD_PERRCD | KEYWORD_PREFIX | KEYWORD_POS | KEYWORD_PROCPTR | KEYWORD_QUALIFIED | KEYWORD_RTNPARM | KEYWORD_STATIC | KEYWORD_TEMPLATE | KEYWORD_TIMFMT | KEYWORD_TOFILE | KEYWORD_VALUE | KEYWORD_VARYING //File spec keywords | KEYWORD_BLOCK | KEYWORD_COMMIT | KEYWORD_DEVID | KEYWORD_EXTDESC | KEYWORD_EXTFILE | KEYWORD_EXTIND | KEYWORD_EXTMBR | KEYWORD_FORMLEN | KEYWORD_FORMOFL | KEYWORD_IGNORE | KEYWORD_INCLUDE | KEYWORD_INDDS | KEYWORD_INFDS | KEYWORD_INFSR | KEYWORD_KEYLOC | KEYWORD_MAXDEV | KEYWORD_OFLIND | KEYWORD_PASS | KEYWORD_PGMNAME | KEYWORD_PLIST | KEYWORD_PRTCTL | KEYWORD_RAFDATA | KEYWORD_RECNO | KEYWORD_RENAME | KEYWORD_SAVEDS | KEYWORD_SAVEIND | KEYWORD_SFILE | KEYWORD_SLN | KEYWORD_USROPN | KEYWORD_DISK | KEYWORD_WORKSTN | KEYWORD_PRINTER | KEYWORD_SPECIAL | KEYWORD_KEYED | KEYWORD_USAGE | KEYWORD_PSDS | UDATE | UMONTH | UYEAR | UDAY |datatypeName; argument: ID; symbolicConstants: SPLAT_ALL | SPLAT_NONE | SPLAT_NO | SPLAT_YES | SPLAT_ILERPG | SPLAT_COMPAT | SPLAT_CRTBNDRPG | SPLAT_CRTRPGMOD | SPLAT_VRM | SPLAT_ALLG | SPLAT_ALLU | SPLAT_ALLTHREAD | SPLAT_ALLX | SPLAT_BLANKS | SPLAT_CANCL | SPLAT_CYMD | SPLAT_CMDY | SPLAT_CDMY | SPLAT_MDY | SPLAT_DMY | SPLAT_DFT | SPLAT_YMD | SPLAT_JUL | SPLAT_INPUT | SPLAT_OUTPUT | SPLAT_ISO | SPLAT_KEY | SPLAT_NEXT | SPLAT_USA | SPLAT_EUR | SPLAT_JIS | SPLAT_JAVA | SPLAT_DATE | SPLAT_DAY | SPLAT_DETC | SPLAT_DETL | SPLAT_DTAARA | SPLAT_END | SPLAT_ENTRY | SPLAT_EQUATE | SPLAT_EXTDFT | SPLAT_EXT | SPLAT_FILE | SPLAT_GETIN | SPLAT_HIVAL | SPLAT_INIT | SPLAT_INDICATOR | SPLAT_INZSR | SPLAT_IN | SPLAT_JOBRUN | SPLAT_JOB | SPLAT_LDA | SPLAT_LIKE | SPLAT_LONGJUL | SPLAT_LOVAL | SPLAT_MONTH | SPLAT_NOIND | SPLAT_NOKEY | SPLAT_NULL | SPLAT_OFL | SPLAT_ON | SPLAT_ONLY | SPLAT_OFF | SPLAT_PDA | SPLAT_PLACE | SPLAT_PSSR | SPLAT_ROUTINE | SPLAT_START | SPLAT_SYS | SPLAT_TERM | SPLAT_TOTC | SPLAT_TOTL | SPLAT_USER | SPLAT_VAR | SPLAT_YEAR | SPLAT_ZEROS | SPLAT_HMS | SPLAT_INLR | SPLAT_INOF | SPLAT_DATA | SPLAT_ASTFILL | SPLAT_CURSYM | SPLAT_MAX | SPLAT_LOCK | SPLAT_PROGRAM //Durations | SPLAT_D | SPLAT_DAYS | SPLAT_H | SPLAT_HOURS | SPLAT_M | SPLAT_MINUTES | SPLAT_MONTHS | SPLAT_MN | SPLAT_MS | SPLAT_MSECONDS | SPLAT_S | SPLAT_SECONDS | SPLAT_Y | SPLAT_YEARS | SPLAT_EXTDESC | SPLAT_STRING | SPLAT_CONSTRUCTOR | SPLAT_LIKEDS | SPLAT_VARSIZE | SPLAT_NOPASS | SPLAT_PROC | SPLAT_STATUS ;
Cubical/Data/Bool/Properties.agda
dan-iel-lee/cubical
0
11128
{-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.Data.Bool.Properties where open import Cubical.Core.Everything open import Cubical.Functions.Involution open import Cubical.Foundations.Prelude open import Cubical.Foundations.Equiv open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.Transport open import Cubical.Foundations.Univalence open import Cubical.Data.Bool.Base open import Cubical.Data.Empty open import Cubical.Relation.Nullary open import Cubical.Relation.Nullary.DecidableEq notnot : ∀ x → not (not x) ≡ x notnot true = refl notnot false = refl notIsEquiv : isEquiv not notIsEquiv = involIsEquiv {f = not} notnot notEquiv : Bool ≃ Bool notEquiv = involEquiv {f = not} notnot notEq : Bool ≡ Bool notEq = involPath {f = not} notnot private variable ℓ : Level -- This computes to false as expected nfalse : Bool nfalse = transp (λ i → notEq i) i0 true -- Sanity check nfalsepath : nfalse ≡ false nfalsepath = refl K-Bool : (P : {b : Bool} → b ≡ b → Type ℓ) → (∀{b} → P {b} refl) → ∀{b} → (q : b ≡ b) → P q K-Bool P Pr {false} = J (λ{ false q → P q ; true _ → Lift ⊥ }) Pr K-Bool P Pr {true} = J (λ{ true q → P q ; false _ → Lift ⊥ }) Pr isSetBool : isSet Bool isSetBool a b = J (λ _ p → ∀ q → p ≡ q) (K-Bool (refl ≡_) refl) true≢false : ¬ true ≡ false true≢false p = subst (λ b → if b then Bool else ⊥) p true false≢true : ¬ false ≡ true false≢true p = subst (λ b → if b then ⊥ else Bool) p true not≢const : ∀ x → ¬ not x ≡ x not≢const false = true≢false not≢const true = false≢true zeroˡ : ∀ x → true or x ≡ true zeroˡ false = refl zeroˡ true = refl zeroʳ : ∀ x → x or true ≡ true zeroʳ false = refl zeroʳ true = refl or-identityˡ : ∀ x → false or x ≡ x or-identityˡ false = refl or-identityˡ true = refl or-identityʳ : ∀ x → x or false ≡ x or-identityʳ false = refl or-identityʳ true = refl or-comm : ∀ x y → x or y ≡ y or x or-comm false y = false or y ≡⟨ or-identityˡ y ⟩ y ≡⟨ sym (or-identityʳ y) ⟩ y or false ∎ or-comm true y = true or y ≡⟨ zeroˡ y ⟩ true ≡⟨ sym (zeroʳ y) ⟩ y or true ∎ or-assoc : ∀ x y z → x or (y or z) ≡ (x or y) or z or-assoc false y z = false or (y or z) ≡⟨ or-identityˡ _ ⟩ y or z ≡[ i ]⟨ or-identityˡ y (~ i) or z ⟩ ((false or y) or z) ∎ or-assoc true y z = true or (y or z) ≡⟨ zeroˡ _ ⟩ true ≡⟨ sym (zeroˡ _) ⟩ true or z ≡[ i ]⟨ zeroˡ y (~ i) or z ⟩ (true or y) or z ∎ or-idem : ∀ x → x or x ≡ x or-idem false = refl or-idem true = refl ⊕-identityʳ : ∀ x → x ⊕ false ≡ x ⊕-identityʳ false = refl ⊕-identityʳ true = refl ⊕-comm : ∀ x y → x ⊕ y ≡ y ⊕ x ⊕-comm false false = refl ⊕-comm false true = refl ⊕-comm true false = refl ⊕-comm true true = refl ⊕-assoc : ∀ x y z → x ⊕ (y ⊕ z) ≡ (x ⊕ y) ⊕ z ⊕-assoc false y z = refl ⊕-assoc true false z = refl ⊕-assoc true true z = notnot z not-⊕ˡ : ∀ x y → not (x ⊕ y) ≡ not x ⊕ y not-⊕ˡ false y = refl not-⊕ˡ true y = notnot y ⊕-invol : ∀ x y → x ⊕ (x ⊕ y) ≡ y ⊕-invol false x = refl ⊕-invol true x = notnot x isEquiv-⊕ : ∀ x → isEquiv (x ⊕_) isEquiv-⊕ x = involIsEquiv (⊕-invol x) ⊕-Path : ∀ x → Bool ≡ Bool ⊕-Path x = involPath {f = x ⊕_} (⊕-invol x) ⊕-Path-refl : ⊕-Path false ≡ refl ⊕-Path-refl = isInjectiveTransport refl ¬transportNot : ∀(P : Bool ≡ Bool) b → ¬ (transport P (not b) ≡ transport P b) ¬transportNot P b eq = not≢const b sub where sub : not b ≡ b sub = subst {A = Bool → Bool} (λ f → f (not b) ≡ f b) (λ i c → transport⁻Transport P c i) (cong (transport⁻ P) eq) module BoolReflection where data Table (A : Type₀) (P : Bool ≡ A) : Type₀ where inspect : (b c : A) → transport P false ≡ b → transport P true ≡ c → Table A P table : ∀ P → Table Bool P table = J Table (inspect false true refl refl) reflLemma : (P : Bool ≡ Bool) → transport P false ≡ false → transport P true ≡ true → transport P ≡ transport (⊕-Path false) reflLemma P ff tt i false = ff i reflLemma P ff tt i true = tt i notLemma : (P : Bool ≡ Bool) → transport P false ≡ true → transport P true ≡ false → transport P ≡ transport (⊕-Path true) notLemma P ft tf i false = ft i notLemma P ft tf i true = tf i categorize : ∀ P → transport P ≡ transport (⊕-Path (transport P false)) categorize P with table P categorize P | inspect false true p q = subst (λ b → transport P ≡ transport (⊕-Path b)) (sym p) (reflLemma P p q) categorize P | inspect true false p q = subst (λ b → transport P ≡ transport (⊕-Path b)) (sym p) (notLemma P p q) categorize P | inspect false false p q = rec (¬transportNot P false (q ∙ sym p)) categorize P | inspect true true p q = rec (¬transportNot P false (q ∙ sym p)) ⊕-complete : ∀ P → P ≡ ⊕-Path (transport P false) ⊕-complete P = isInjectiveTransport (categorize P) ⊕-comp : ∀ p q → ⊕-Path p ∙ ⊕-Path q ≡ ⊕-Path (q ⊕ p) ⊕-comp p q = isInjectiveTransport (λ i x → ⊕-assoc q p x i) open Iso reflectIso : Iso Bool (Bool ≡ Bool) reflectIso .fun = ⊕-Path reflectIso .inv P = transport P false reflectIso .leftInv = ⊕-identityʳ reflectIso .rightInv P = sym (⊕-complete P) reflectEquiv : Bool ≃ (Bool ≡ Bool) reflectEquiv = isoToEquiv reflectIso
45/runtime/rt/fhutil.asm
minblock/msdos
0
170248
<filename>45/runtime/rt/fhutil.asm TITLE FHUTIL - Far Heap and Array Utility routines PAGE 56,132 ;*** ;FHUTIL - Far Heap and Array Utility routines ; ; Copyright <C> 1987, Microsoft Corporation ; ;Purpose: ; Contains utility routines used in Far Heap and general array accessing. ; ;****************************************************************************** INCLUDE switch.inc INCLUDE rmacros.inc ;Runtime Macro Defintions useSeg _DATA useSeg FH_TEXT INCLUDE seg.inc INCLUDE array.inc ;far heap and array descriptor structures INCLUDE idmac.inc sBegin FH_TEXT assumes CS,FH_TEXT SUBTTL B$ADArraySize - compute array size from descriptor PAGE ;*** ;B$ADArraySize - compute array size from descriptor ; ;Purpose: ; To compute the array size in bytes from its descriptor. ; This value is the product of the element size and the ; size of each dimension. ; ; For FV_LONGPTR versions: ; return value is not defined if array is not dimensioned ; ;Entry: ; ds:bx = offset of array descriptor. ;Exit: ; CY = set if overflow, else cleared. ; DX:AX = 32-bit size of the array in bytes (invalid if overflow). ;Uses: ; None. ;Exceptions: ; None. ;****************************************************************************** cProc B$ADArraySize,<NEAR,PUBLIC>,<BX,CX,SI,DI> cBegin ; Get the number of dimensions from the descriptor. MOV CL,[BX].AD_cDims ;move the dimension number XOR CH,CH ;make a word value DbAssertRel CX,NE,0,FH_TEXT,<Array with zero dimensions in B$ADArraySize> ; Initialize the running product in SI:DI to the element size. MOV DI,[BX].AD_cbElement ;get the element size XOR SI,SI ;make a doubleword value ; For each dimension, multiply SI:DI by the element count. ADArraySizeLoop: MOV AX,DI ;get low-order word of running product MUL [BX].AD_tDM.DM_cElements ;get first product of loop MOV DI,AX ;move low-order word of first product MOV AX,SI ;get high-order word of running product MOV SI,DX ;running product now has first product MUL [BX].AD_tDM.DM_cElements ;get second product of loop JC ADArraySizeOflo ;if high-order word nonzero, then overflow ADD SI,AX ;add low-order word to high-order running prod JC ADArraySizeOflo ;if carry, then overflow ADD BX,SIZE DM ;add size of array dim info - clears carry LOOP ADArraySizeLoop ;loop until done ; Move final result to DX:AX. MOV AX,DI ;move low-order result and.. MOV DX,SI ;the high-order result ; Exit with carry set if overflow in computation (> 32 bits), ; else with carry clear. NotDimmed: ADArraySizeOflo: cEnd sEnd END
Asm4Kids/6on.asm
jacmoe/c64adventures
17
96444
<reponame>jacmoe/c64adventures<filename>Asm4Kids/6on.asm ; Turn key repeat on ; 10 SYS (49152) *=$0801 BYTE $0E, $08, $0A, $00, $9E, $20, $28, $34, $39, $31, $35, $32, $29, $00, $00, $00 *=$c000 lda #$80 sta $28a ; 650 - repeat all keys if $80 rts
src/API/protypo-api-field_names.ads
fintatarta/protypo
0
10378
-- -- Utility package to convert IDs to enumarative values. -- private generic type Field_Enumerator is (<>); Prefix : String := ""; package Protypo.Api.Field_Names is function Is_Field (X : ID) return Boolean; function To_Field (X : ID) return Field_Enumerator; end Protypo.Api.Field_Names;
agda/AssocList.agda
halfaya/MusicTools
28
66
{-# OPTIONS --cubical --safe #-} module AssocList where open import Cubical.Core.Everything using (Type) open import Data.Bool using (Bool; false; true; _∨_; _∧_) open import Data.List using (List; []; _∷_; foldr) open import Data.Product using (_×_; _,_; proj₂) open import Function using (_∘_) AList : (A B : Type) → Type AList A B = List (A × List B) -- Does not deduplicate in list of B. insert : {A B : Type} → (A → A → Bool) → A × B → AList A B → AList A B insert eq (a , b) [] = (a , b ∷ []) ∷ [] insert eq (a , b) ((a' , bs) ∷ xs) with eq a a' ... | false = (a' , bs) ∷ insert eq (a , b) xs ... | true = (a' , b ∷ bs) ∷ xs lookup : {A B : Type} → (A → A → Bool) → A → AList A B → List B lookup eq _ [] = [] lookup eq a ((a' , bs) ∷ xs) with eq a a' ... | false = lookup eq a xs ... | true = bs
src/Implicits/Resolution/Stack/Algorithm.agda
metaborg/ts.agda
4
8266
open import Prelude module Implicits.Resolution.Stack.Algorithm where open import Induction.WellFounded open import Induction.Nat open import Data.Fin.Substitution open import Data.Nat.Base using (_<′_) open import Data.List.Any open Membership-≡ open import Implicits.Syntax open import Implicits.Substitutions open import Implicits.Substitutions.Lemmas open import Implicits.Resolution.Stack.Resolution open import Implicits.Resolution.Termination open import Implicits.Syntax.Type.Unification open import Function.Inverse as Inv using (_↔_; module Inverse) open import Function.Equality hiding (cong; flip; const) open import Data.List.Any.Properties using (Any↔) open import Data.Nat hiding (_<_) open import Data.Nat.Properties open import Relation.Binary using (module DecTotalOrder) open DecTotalOrder decTotalOrder using () renaming (refl to ≤-refl) module M = MetaTypeMetaSubst module Lemmas where postulate lem₄ : ∀ {m ν} (a : MetaType m (suc ν)) u us → from-meta ((M.open-meta a) M./ (us M.↑) M./ (M.sub u)) ≡ (from-meta (a M./ (us M.↑tp))) tp[/tp from-meta u ] open Lemmas _s<'_ : ∀ {ν} → (∃ λ (Δ : ICtx ν) → Stack Δ) → (∃ λ (Δ' : ICtx ν) → Stack Δ') → Set s s<' t = {!!} module Arg<-well-founded where open Lexicographic (_s<_) (const _sρ<_) arg<-well-founded : Well-founded _<_ arg<-well-founded = well-founded s<-well-founded sρ<-well-founded _arg<_ = _<_ open Lexicographic using (left; right) open Arg<-well-founded {-# NO_TERMINATION_CHECK #-} mutual match' : ∀ {m ν ρ} (Δ : ICtx ν) s (r∈Δ : ρ List.∈ Δ) τ → (r : MetaType m ν) → Acc _arg<_ (s , (, simpl τ)) → Acc _m<_ (, , r) → Maybe (∃ λ u → Δ & s , r∈Δ ⊢ from-meta (r M./ u) ↓ τ) match' Δ s r∈Δ τ (simpl x) (acc f) _ with mgu (simpl x) τ match' Δ s r∈Δ τ (simpl x) (acc f) _ | just (u , p) = just ( (asub u) , subst (λ a → Δ & s , r∈Δ ⊢ a ↓ τ) (sym $ mgu-unifies (simpl x) τ (u , p)) (i-simp τ) ) match' Δ s r∈Δ τ (simpl x) (acc f) _ | nothing = nothing match' Δ s r∈Δ τ (a ⇒ b) (acc f) (acc g) with match' Δ s r∈Δ τ b (acc f) (g _ (b-m<-a⇒b a b)) match' Δ s r∈Δ τ (a ⇒ b) (acc f) (acc g) | nothing = nothing match' Δ s r∈Δ τ (a ⇒ b) (acc f) (acc g) | just (u , b/u↓τ) with (from-meta (a M./ u)) for r∈Δ ?⊬dom s match' Δ s r∈Δ τ (a ⇒ b) (acc f) (acc g) | just (u , b/u↓τ) | yes p with let a' = from-meta (a M./ u) in let s' = (s push a' for r∈Δ) in resolve' Δ s' a' (f (s' , _ , a') (left {!!})) match' Δ s r∈Δ τ (a ⇒ b) (acc f) (acc g) | just (u , b/u↓τ) | yes p | just ⊢ᵣa = just (u , i-iabs p ⊢ᵣa b/u↓τ) match' Δ s r∈Δ τ (a ⇒ b) (acc f) (acc g) | just (u , b/u↓τ) | yes p | nothing = nothing match' Δ s r∈Δ τ (a ⇒ b) (acc f) (acc g) | just (u , b/u↓τ) | no ¬p = nothing -- The following with clause fails to satisfy termination checking. -- Somehow we have to prove to Agda that (open-meta a) is structurally smaller than (∀' a) match' Δ s r∈Δ τ (∀' a) (acc f) (acc g) with match' Δ s r∈Δ τ (open-meta a) (acc f) (g _ (open-meta-a-m<-∀'a a)) match' Δ s r∈Δ τ (∀' a) (acc f) (acc g) | just p = just $ lem p where lem : (∃ λ u → Δ & s , r∈Δ ⊢ (from-meta ((open-meta a) M./ u)) ↓ τ) → ∃ λ u' → Δ & s , r∈Δ ⊢ (from-meta (∀' a M./ u')) ↓ τ lem (u ∷ us , p) = us , (i-tabs (from-meta u) (subst (λ v → Δ & s , r∈Δ ⊢ v ↓ τ) (begin from-meta (M._/_ (open-meta a) (u ∷ us)) ≡⟨ cong (λ v → from-meta (M._/_ (open-meta a) v)) (sym $ us↑-⊙-sub-u≡u∷us u us) ⟩ from-meta ((open-meta a) M./ (us M.↑ M.⊙ (M.sub u))) ≡⟨ cong from-meta (/-⊙ (open-meta a)) ⟩ from-meta ((open-meta a) M./ us M.↑ M./ (M.sub u)) ≡⟨ lem₄ a u us ⟩ from-meta (a M./ (us M.↑tp)) tp[/tp from-meta u ] ∎) p)) where open MetaTypeMetaLemmas hiding (subst) match' Δ s r∈Δ τ (∀' r) (acc f) (acc g) | nothing = nothing -- match defers to match', which concerns itself with MetaTypes. -- If match' finds a match, we can use the fact that we have zero unification variables open here -- to show that we found the right thing. match : ∀ {ν ρ} (Δ : ICtx ν) s (r∈Δ : ρ List.∈ Δ) r τ → Acc _arg<_ (s , _ , simpl τ) → Maybe (Δ & s , r∈Δ ⊢ r ↓ τ) match Δ s r∈Δ a τ ac with match' Δ s r∈Δ τ (to-meta {zero} a) ac (m<-well-founded _) match Δ s r∈Δ a τ ac | just x = just (lem x) where eq : ∀ {ν} {a : Type ν} {s} → from-meta (to-meta {zero} a M./ s) ≡ a eq {a = a} {s = []} = begin from-meta (M._/_ (to-meta {zero} a) []) ≡⟨ cong (λ q → from-meta q) (MetaTypeMetaLemmas.id-vanishes (to-meta {zero} a)) ⟩ from-meta (to-meta {zero} a) ≡⟨ to-meta-zero-vanishes ⟩ a ∎ lem : ∃ (λ u → Δ & s , r∈Δ ⊢ from-meta (to-meta {zero} a M./ u) ↓ τ) → Δ & s , r∈Δ ⊢ a ↓ τ lem ([] , proj₂) = subst (λ u → Δ & s , r∈Δ ⊢ u ↓ τ) eq proj₂ match Δ s r∈Δ a τ ac | nothing = nothing match1st : ∀ {ν} (Δ : ICtx ν) (s : Stack Δ) τ → Acc _arg<_ (s , _ , simpl τ) → Maybe (∃₂ λ r (r∈Δ : r List.∈ Δ) → Δ & s , r∈Δ ⊢ r ↓ τ) match1st Δ s τ ac = match1st' Δ Δ Prelude.id s τ ac -- any (λ r → match Δ r τ) where match1st' : ∀ {ν} (Δ ρs : ICtx ν) → ρs ⊆ Δ → (s : Stack Δ) → (τ : SimpleType ν) → Acc _arg<_ (s , _ , simpl τ) → Maybe (∃₂ λ r (r∈Δ : r List.∈ Δ) → Δ & s , r∈Δ ⊢ r ↓ τ) match1st' Δ List.[] sub s τ ac = nothing match1st' Δ (x List.∷ xs) sub s τ ac with match Δ s (sub (here refl)) x τ ac match1st' Δ (x List.∷ xs) sub s τ ac | just px = just (x , ((sub (here refl)) , px)) match1st' Δ (x List.∷ xs) sub s τ ac | nothing with match1st' Δ xs {!!} s τ ac match1st' Δ (x List.∷ xs) sub s τ ac | nothing | just p = just p match1st' Δ (x List.∷ xs) sub s τ ac | nothing | nothing = nothing resolve' : ∀ {ν} (Δ : ICtx ν) s r → Acc _arg<_ (s , _ , r) → (Maybe (Δ & s ⊢ᵣ r)) resolve' Δ s (simpl x) ac with match1st Δ s x ac resolve' Δ s (simpl x) ac | just (_ , r∈Δ , r↓x) = just (r-simp r∈Δ r↓x) resolve' Δ s (simpl x) ac | nothing = nothing -- no (λ{ (r-simp x₁ x₂) → ¬p (_⟨$⟩_ (Inverse.to Any↔) (_ , (x₁ , x₂))) }) resolve' Δ s (a ⇒ b) (acc f) with resolve' (a List.∷ Δ) (s prepend a) b {!f!} resolve' Δ s (a ⇒ b) (acc f) | just p = just (r-iabs p) resolve' Δ s (a ⇒ b) (acc f) | nothing = nothing -- no (λ{ (r-iabs x) → ¬p x }) resolve' Δ s (∀' r) (acc f) with resolve' (ictx-weaken Δ) (stack-weaken s) r {!f ? ?!} resolve' Δ s (∀' r) (acc f) | just p = just (r-tabs p) resolve' Δ s (∀' r) (acc f) | nothing = nothing --no (λ{ (r-tabs x) → ¬p x }) resolve : ∀ {ν} (Δ : ICtx ν) r → (Maybe (Δ ⊢ᵣ r)) resolve Δ r = resolve' Δ (All.tabulate (const r)) r (arg<-well-founded _)
sources/utils/command.asm
SashaVolohov/VH-DOS
3
241088
<reponame>SashaVolohov/VH-DOS org 0x0600 include "..\standards.inc" MACRO ccmps nstr, nlength, jumpto { mov si,[Command_Integer_Parse@stringd] push si mov si,nstr mov cx,nlength rep cmpsb jz jumpto } Task_command: mov ax,2 int 10h mov ah,2 mov bh,0 xor dx,dx int 10h mov bp,cmd_prompt call TxtPrint mov dx,4 ;x,y = 4,0 call SetCursorPos jmp Pre_Command ; Functions (/kernel/*.asm) include "..\kernel\Global.inc" ; VersionInfo ; ClearScreen ; ClearScreen_cl include "..\kernel\BSOD.inc" ; BSOD include "..\kernel\GHNRandom.inc" ; GHNRandom include "..\kernel\StringReg.inc" ; UpperCase(BP = offset, !stops with 0); ; LowerCase(BP = offset, !stops with 0) include "..\kernel\PCSpeaker.inc" ; Beep(AX = Hz); ; NoBeep include "..\kernel\PwrMgmt.inc" ; Restart; ; ACPI_Shutdown include "..\kernel\ReverseByte.inc" ; ReverseByte include "..\kernel\TxtPrint.inc" ; TxtPrint ; MultiTxtPrint stringd equ 0x2000 stringd_len equ 0x33 Pre_Command: mov cx,50d ClearBuf: mov bx,cx add bx,stringd mov byte [ds:bx],0 loop ClearBuf jmp Command Command: mov ah,10h int 16h cmp ah,00Eh ; [Backspace] jz Delete_symbol cmp ah,01Ch ; [Return] jz Parse_Command cmp al,32d jae CheckForPrintableRange jmp Command CheckForPrintableRange: cmp al,126d jle AddToBuffer jmp Command AddToBuffer: mov ah,3 mov bh,0 int 10h cmp dl,53d ; Is cursor at end? jz Command mov [ds:stringd+si],al inc si mov ah,00Ah mov bx,7 mov cx,1 int 10h mov ah,3 mov bh,0 int 10h inc dl mov ah,2 mov bh,0 int 10h jmp Command Parse_Command: mov ah,3 mov bh,0 int 10h cmp dh,24d jz ScrollDown AfterScroll: inc dh xor dl,dl call SetCursorPos mov ax,cs ; ? mov ds,ax ; ? mov es,ax ; ? mov ax,cs ; ? mov ds,ax ; ? mov es,ax ; ? mov bp,stringd call UpperCase mov di,stringd jmp Command_Integer_Parse AfterIntegerParse: cmp ax,0 ; bad command jz Bad_Command cmp ax,1 ; cls jz ClearScreen_cl cmp ax,2 ; ver jz VersionInfo cmp ax,3 ; restart jz Restart jmp BSOD Command_Integer_Parse: ; What it returns: ;_____________________. ; AX | Meaning ; ;--------+------------; ; 0x0000 | <Bad cmd.> ; ; 0x0001 | CLS ; ; 0x0002 | VER ; ; 0x0003 | RESTART ; ;---------------------; mov [Command_Integer_Parse@stringd],si xor ax,ax ccmps cmd_cls, 3, CC_cls ; AX = 0x0001 ccmps cmd_ver, 3, CC_version ; AX = 0x0002 ccmps cmd_restart, 7, CC_restart ; AX = 0x0003 jmp AfterIntegerParse CC_restart: inc ax CC_version: inc ax CC_cls: inc ax jmp AfterIntegerParse ;---- Command_Integer_Parse@stringd dw ? ;---- ScrollDown: mov ah,7 mov al,3 mov bh,7 mov cx,dx mov dx,0184Fh ; x,y = 80,25 jmp AfterScroll ;---- Delete_symbol: cmp dl,4 jz Command dec dl call SetCursorPos mov al,20h mov [stringd+si],al mov ah,9 mov bx,7 mov cx,1 int 10h dec si jmp Command ;---- bad db 'Bad command or file name',0 cmd_ver db 'VER',0 cmd_cls db 'CLS',0 cmd_restart db 'RESTART',0 ;---- Bad_Command: mov bp,bad call TxtPrint ;add dh,2 ;mov dl,0 ;call SetCursorPos mov bp,cmd_prompt call TxtPrint ;add dl,4 ;call SetCursorPos jmp ClearBuffer ; ret ; Смысла в RET здесь нет PageUp: mov ax,2 ; debug int 10h ; debug mov dl,0 ; debug mov dh,0 ; debug call SetCursorPos ; debug mov ax,00600h mov bx,00007h xor cx,cx mov dx,0184Fh ; x,y = 80,25 int 10h mov ah,2 mov bh,0 xor dx,dx int 10h mov bp,cmd_prompt call TxtPrint mov dl,4 ; debug mov dh,0 ; debug call SetCursorPos ; debug jmp Command ret ;stringd db (50 + 1) dup (0) ; (%d + 1) для /kernel/UpperCase
day07/src/day.adb
jwarwick/aoc_2020
3
27446
-- AoC 2020, Day 7 -- with Ada.Text_IO; with Bag; use Bag; with Ada.Containers; with Ada.Containers.Ordered_Sets; with Ada.Containers.Indefinite_Ordered_Maps; package body Day is -- package TIO renames Ada.Text_IO; use Bag.Bag_Maps; package Color_Sets is new Ada.Containers.Ordered_Sets (Element_Type => Bag_Color); use Color_Sets; package Reverse_Bag_Maps is new Ada.Containers.Indefinite_Ordered_Maps (Key_Type => Bag_Color, Element_Type => Color_Sets.Set); use Reverse_Bag_Maps; function build_reverse_map(m : in Bag_Maps.Map) return Reverse_Bag_Maps.Map is rev : Reverse_Bag_Maps.Map; begin for c in m.Iterate loop for s of element(c) loop if not rev.contains(s.Color) then rev.include(s.Color, Empty_Set); end if; declare curr : Color_Sets.Set := rev(s.Color); begin curr.include(key(c)); rev(s.color) := curr; end; end loop; end loop; return rev; end build_reverse_map; -- procedure print_rev(m : in Reverse_Bag_Maps.Map) is -- begin -- for c in m.Iterate loop -- TIO.put_line(Bag_Color'Image(key(c))); -- for s of element(c) loop -- TIO.put_line(" " & Bag_Color'Image(s)); -- end loop; -- end loop; -- end print_rev; procedure dfs(curr : in Bag_Color; rev : in Reverse_Bag_Maps.Map; reach : in out Color_Sets.Set) is parents : Color_Sets.Set := Empty_Set; begin if rev.contains(curr) then parents := rev(curr); for p of parents loop if not reach.contains(p) then reach.insert(p); dfs(p, rev, reach); end if; end loop; end if; end dfs; function count_valid(m : in Bag_Maps.Map) return Natural is rev : constant Reverse_Bag_Maps.Map := build_reverse_map(m); reach : Color_Sets.Set := Empty_Set; begin -- print_rev(rev); dfs(Bag.my_color, rev, reach); return Natural(Color_Sets.length(reach)); end count_valid; function valid_bag_colors return Natural is b : constant Bag_Maps.Map := Bag.input_data; begin return count_valid(b); end valid_bag_colors; function valid_test_bag_colors return Natural is b : constant Bag_Maps.Map := Bag.test_data; begin return count_valid(b); end valid_test_bag_colors; function count_nested(curr : in Bag_Color; bags : in Bag_Maps.Map) return Natural is subs : Bag_Sets.Set; sum : Natural := 0; begin if bags.contains(curr) then subs := bags(curr); for s of subs loop sum := sum + s.count + (s.count * count_nested(s.color, bags)); end loop; return sum; else return 0; end if; end count_nested; function nested_bags return Natural is b : constant Bag_Maps.Map := Bag.input_data; begin return count_nested(my_color, b); end nested_bags; function nested_test_bags return Natural is b : constant Bag_Maps.Map := Bag.test_data; begin return count_nested(my_color, b); end nested_test_bags; end Day;
ALINK/tdll.asm
DarkRiDDeR/mandelbrotin-fractal-generation-NASM
3
4796
<reponame>DarkRiDDeR/mandelbrotin-fractal-generation-NASM ; tdll.asm ; ; assemble with ; nasm -fobj tdll.asm ; ; link with ; alink -oPE -dll tdll win32.lib ; (win32.lib is available from my web page) global start global title1 export start export title1 ;these names are defined in win32.lib as the names of ;a stub proc, and the IAT entry name for MessageBoxA extern MessageBoxA extern __imp_MessageBoxA segment code public use32 class=CODE ;DLL entry point - do nothing, but flag success ;This is a STDCALL entrypoint, so remove 3 params from stack on return ..start: dllstart: mov eax,1 ret 12 ;exported procedure start: push dword 0 ; OK button push dword title1 push dword string1 push dword 0 call MessageBoxA ;call stub routine in win32.lib push dword 0 ; OK button push dword title1 push dword string2 push dword 0 call [__imp_MessageBoxA] ;call routine via IAT ret segment data public use32 class=DATA string1: db 'hello world, through redirection',13,10,0 ;exported data title1: db 'Hello',0 string2: db 'hello world, called through import table',13,10,0
src/C0.g4
Alex-Beng/qcc
4
2101
grammar C0; compilationUnit : (variableDefinition | functionDefinition )* EOF ; functionDefinition : ret=typeType name=Identifier'(' (parameter (',' parameter)*)? ')' block ; variableDefinition : typeType Identifier (',' Identifier)* ';' #defVar | typeType Identifier ('=' rhs=(CharLiteral|DecimalInteger))? ';' #defConst | typeType Identifier '[' DecimalInteger ']' ';' #defArray ; parameter : typeType Identifier ; typeType : type = ('int' | 'char' | 'const int' | 'const char' | 'void') ; block : '{' statement* '}' ; statement : block # blockStmt | variableDefinition # varDefStmt | 'if' '(' ifCondition ')' ifStatement ('else' elseStatement)? # ifStmt | 'for' '(' expression? ';' forCondition? ';'forStep? ')' statement # forStmt | 'while' '(' whileCondition ')' whileStatement # whileStmt | 'return' expression? ';' # returnStmt | 'break' ';' # breakStmt | 'continue' ';' # continueStmt | expression ';' # exprStmt | ';' # blankStmt ; ifCondition : expression ; ifStatement : statement ; elseStatement : statement ; whileCondition : expression ; whileStatement : statement ; forCondition : expression ; forStep : expression ; expressionList : expression (',' expression)* ; expression : primary # primaryExpr | expression '[' expression ']' # arefExpr | 'printf' '(' expressionList? ')' # printfExpr | 'scanf' '(' expressionList? ')' # scanfExpr | expression '(' expressionList? ')' # funcallExpr | op=('+' | '-') expression # prefixExpr | expression op=('*' | '/') expression # binaryExpr | expression op=('+' | '-') expression # binaryExpr | expression op=('<' | '>' | '>=' | '<=') expression # binaryExpr | expression op=('==' | '!=' ) expression # binaryExpr | <assoc=right> expression '=' expression # assignExpr // 指定右结合 ; primary : '(' expression ')' # subExpr | Identifier # variableExpr | lite=(DecimalInteger|CharLiteral|StringLiteral) # literalExpr ; CharLiteral : '\'' Character '\'' ; StringLiteral : '"' Character* '"' ; fragment Character : ~["\\\n\r] | '\\' ["n\\] ; Identifier : [a-zA-Z_] [a-zA-Z_0-9]* ; DecimalInteger : [1-9] [0-9]* | '0' ; WS : [ \t\r\n]+ -> skip ; BLOCK_COMMENT : '/*' .*? '*/' -> skip ; LINE_COMMENT : '//' ~[\r\n]* -> skip ;
grammar/siliconLexer.g4
cyyber/silicon
6
3580
lexer grammar siliconLexer; Println : 'println'; Print : 'print'; Input : 'input'; Def : 'def'; If : 'if'; Else : 'else'; Return : 'return'; For : 'for'; While : 'while'; To : 'to'; Do : 'do'; End : 'end'; In : 'in'; Null : 'null'; Or : '||'; And : '&&'; Equals : '=='; NEquals : '!='; GTEquals : '>='; LTEquals : '<='; Pow : '^'; Excl : '!'; GT : '>'; LT : '<'; Add : '+'; Subtract : '-'; Multiply : '*'; Divide : '/'; Modulus : '%'; OBrace : '{'; CBrace : '}'; OBracket : '['; CBracket : ']'; OParen : '('; CParen : ')'; SColon : ';'; Assign : '='; Comma : ','; QMark : '?'; Colon : ':'; Bool : 'true' | 'false' ; Number : Int ( '.' Digit* )? ; Identifier : [a-zA-Z_] [a-zA-Z_0-9]* ; String : ["] ( ~["\r\n\\] | '\\' ~[\r\n] )* ["] | ['] ( ~['\r\n\\] | '\\' ~[\r\n] )* ['] ; Comment : ( '//' ~[\r\n]* | '/*' .*? '*/' ) -> skip ; Space : [ \t\r\n\u000C] -> skip ; fragment Int : [1-9] Digit* | '0' ; fragment Digit : [0-9] ;
agda/Note.agda
halfaya/MusicTools
28
16095
<reponame>halfaya/MusicTools {-# OPTIONS --erased-cubical --safe #-} module Note where open import Data.Integer using (ℤ) open import Data.Nat using (ℕ; _+_; _*_; ⌊_/2⌋) open import Function using (_∘_) open import Pitch using (Pitch; transposePitch) open import Interval using (Upi; Opi; transposePitchInterval) Duration : Set Duration = ℕ data Note : Set where tone : Duration → Pitch → Note rest : Duration → Note noteDuration : Note → ℕ noteDuration (tone d _) = d noteDuration (rest d) = d liftPitch : (Pitch → Pitch) → Note → Note liftPitch f (tone d p) = tone d (f p) liftPitch f (rest d) = rest d transposeNote : ℤ → Note → Note transposeNote = liftPitch ∘ transposePitch transposeNoteInterval : Opi → Note → Note transposeNoteInterval = liftPitch ∘ transposePitchInterval -- rounds down doubleSpeed : Note → Note doubleSpeed (tone d p) = tone (⌊_/2⌋ d) p doubleSpeed (rest d) = rest (⌊_/2⌋ d) slowDown : ℕ → Note → Note slowDown k (tone d p) = tone (d * k) p slowDown k (rest d) = rest (d * k) -- duration in 16th notes -- assume duration of a 16th note is 1 16th 8th d8th qtr dqtr half whole : Duration 16th = 1 8th = 2 d8th = 3 qtr = 4 dqtr = 6 half = 8 dhalf = 12 whole = 16 dwhole = 24