max_stars_repo_path stringlengths 4 261 | max_stars_repo_name stringlengths 6 106 | max_stars_count int64 0 38.8k | id stringlengths 1 6 | text stringlengths 7 1.05M |
|---|---|---|---|---|
programs/oeis/017/A017136.asm | neoneye/loda | 22 | 101173 | ; A017136: a(n) = (8*n + 5)^12.
; 244140625,23298085122481,7355827511386641,353814783205469041,6582952005840035281,68952523554931640625,491258904256726154641,2654348974297586158321,11646329922777311412561,43439888521963583647921,142241757136172119140625,418596297479370673535601,1126825030131969720661201,2812664781782894485727281,6580067382037190942729361,14551915228366851806640625,30635127461052805121505361,61748917974902741368975281,119738888098469732352733201,224282727500720205065439601,407199588611568593994140625,718709255220793060317103921,1236354171303115835117980561,2077502954475116767205550321,3416604542324232545384738641,5508664624112838398681640625,8720778205368893309992171281,13573982477229290545823357041,20798201815902925734870098641,31403651714183943747186386481,46772761567521097265869140625,68777479182635902650515347441,99927745220846124633825584721,143557987030641165766449098161,204059692922921316864296943121,287169505347519450195556640625,400323831115571027902364072401,553092726310835924575445943601,757707791466420184947746068881,1029701028696997844179291768561,1388674087672293186187744140625,1859220083686070369445516586161,2472023231929042220921962513681,3265164931981755884811169330801,4285668681360310036179623022801,5591320323850160818242431640625,7252804675881436727210363928721,9356204552249879185458266174961,12005913662407062729708916003921,15328020803120684935518067665841,19474229266814577603359619140625,24626382453131088146385741940081,31001674351559225686692396607441,38858631894268190306056236008241,48503965201122371247515895457681,60300391495425327222539306640625,74675549003124234238645683260241,92132128505596173454447158291121,113259362444075505199073576063761,138746024621391125681807156958321,169395107664901855540781494140625,206140360556133241705736489329201,250064884752295712280965016506001,302422004779181639964896403690481,364658647722422976797962491527761,438441485845246374607086181640625,525686117678205789920105722386961,628589585424465130312977473332081,749666550469685041251761511208401,891789474247188754533370855326001,1058233178757736020094453369140625,1252724189751992140313894717473521,1479495296027921174174630123649361,1743345790552381084833418599737521,2049707893265951944936297569313041,2404719891554592552419883056640625,2815306572555543411645056214428881,3289267561794796586432994591137841,3835374225218664055388955943197841,4463475836574164471582877087248881,5184615759406255094024375244140625,6011158442771008350019598709893041,6956928082211856941544138544277521,8037359852712765181583868932309361,9269664678331989431355838883693521,10673008564139966653532929931640625,12268707580044487117643999129306001,14080439653198038396506364992348401,16134474396061162385625440298592081,18459922270959723690417004862006961,21089004469243826925754547119140625,24057344964055257779773665418907761,27404286280365141501046272061430481,31173230614483296954789340818366001,35412008027797732443707036682349201,40173273536212065607522226806640625,45514935017748537945243970657738321,51500613966215951343360724450403761,58200141228849561310411799296751121,65690089980561099570826551409680241
mul $0,8
add $0,5
pow $0,12
|
awa/plugins/awa-images/regtests/awa-images-tests.ads | My-Colaborations/ada-awa | 81 | 3840 | -----------------------------------------------------------------------
-- awa-images-tests -- Unit tests for images module
-- Copyright (C) 2020 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Tests;
with AWA.Tests;
with Ada.Strings.Unbounded;
package AWA.Images.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new AWA.Tests.Test with record
Folder_Ident : Ada.Strings.Unbounded.Unbounded_String;
end record;
-- Get some access on the image as anonymous users.
procedure Verify_Anonymous (T : in out Test;
Page : in String;
Title : in String);
-- Verify that the image lists contain the given image.
procedure Verify_List_Contains (T : in out Test;
Name : in String);
-- Test access to the image as anonymous user.
procedure Test_Anonymous_Access (T : in out Test);
-- Test creation of image by simulating web requests.
procedure Test_Create_Image (T : in out Test);
-- Test getting an image which does not exist.
procedure Test_Missing_Image (T : in out Test);
end AWA.Images.Tests;
|
lib/ayacc/error_report_file.adb | alvaromb/Compilemon | 1 | 23696 |
with Ayacc_File_Names, Text_IO, Source_File, Str_pack;
use Ayacc_File_Names, Text_IO;
package body Error_Report_File is
--
-- TITLE: package body Error_Report_File
-- Output the code which allows users to see what the error token was.
-- This is for non-correctable errors.
-- Also in this package: The declaration of user actions for correctable
-- (continuable) errors.
--
-- LANGUAGE:
-- Ada
--
-- PERSONNEL:
-- AUTHOR: <NAME>
-- DATE: Jul 27 1990
--
-- OVERVIEW:
-- Parse the last section of the .y file, looking for
-- %report_continuable_error and the related procedures. From these,
-- generate procedure bodies which will be called from yyparse when
-- there is an error which has been corrected. Since the errors get
-- corrected, yyerror does not get called.
--
max_line_length : constant integer := 370;
The_File : File_Type; -- Where the error report goes
Text : String(1..max_line_length); -- Current line from source file
Length : Natural := 1; -- and its length
-- types of lines found in the continuable error report section
type user_defined_thing is (with_thing,
use_thing,
init_thing,
report_thing,
finish_thing,
line_thing,
eof_thing);
--
-- TITLE:
-- Get Next Thing : Classify a line of text from the user defined error
-- report section of the .y file
--
-- OVERVIEW:
-- Read one line of the .y file, classifying it.
-- In the case of a %use or %with line, set the global variables Text and
-- Length to the tail of the line after the %use or %with.
-- ...................................................
procedure get_next_thing(thing : in out user_defined_thing) is
use str_pack;
with_string : constant string := "%WITH";
use_string : constant string := "%USE";
init_string : constant string := "%INITIALIZE_ERROR_REPORT";
finish_string: constant string:= "%TERMINATE_ERROR_REPORT";
report_string: constant string:= "%REPORT_ERROR";
temp : STR(max_line_length);
begin
if thing = eof_thing or else Source_File.is_end_of_file then
thing := eof_thing;
return;
end if;
Source_File.Read_Line(Text, Length);
if length >= use_string'length then
assign(text(1..use_string'length), temp);
if value_of(upper_case(temp)) = use_string then
thing := use_thing;
length := length - use_string'length;
text(1..length) := text((use_string'length + 1)..
length + use_string'length);
return;
end if;
end if;
if length >= with_string'length then
assign(text(1..with_string'length), temp);
if Value_of(upper_case(temp)) = with_string then
thing := with_thing;
length := length - with_string'length;
text(1..length) := text((with_string'length + 1)..
length + with_string'length);
return;
end if;
end if;
if length >= init_string'length then
assign(text(1..init_string'length), temp);
if Value_of(str_pack.upper_case(temp)) = init_string then
thing := init_thing;
return;
end if;
end if;
if length >= finish_string'length then
assign(text(1..finish_string'length), temp);
if value_of(str_pack.upper_case(temp)) = finish_string then
thing := finish_thing;
return;
end if;
end if;
if length >= report_string'length then
assign(text(1..report_string'length), temp);
if value_of(str_pack.upper_case(temp)) = report_string then
thing := report_thing;
return;
end if;
end if;
thing := line_thing;
end get_next_thing;
--
-- TITLE: procedure Write_Line
-- Write out a line to the Error Report generated ada file.
--
-- OVERVIEW:
--
-- ...................................................
procedure Write_Line(S: in String) is
begin
Put_Line(The_File, S);
end Write_Line;
--
-- TITLE:
-- Write the body of one of the user-defined procedures
--
-- OVERVIEW:
-- If User is True it means the user is defining the procedure body. So
-- copy it from the source file. Otherwise provide a null body.
-- ...................................................
procedure write_thing(user : in boolean;
thing : in out user_defined_thing) is
begin
if user then
loop
get_next_thing(thing);
exit when thing /= line_thing;
Write_Line(Text(1..length));
end loop;
else
Write_Line("begin");
Write_Line(" null;");
Write_Line("end;");
end if;
Write_Line("");
end write_thing;
--
-- TITLE:
-- Write the error report initialization function
--
-- OVERVIEW:
-- Write the header & then then body
-- ...................................................
procedure write_init(user : in boolean;
thing : in out user_defined_thing) is
begin
Write_Line("procedure Initialize_User_Error_Report is");
write_thing(user, thing);
end write_init;
--
-- TITLE:
-- Write the error report completion function
--
-- OVERVIEW:
-- Write the header & then then body
-- ...................................................
procedure write_finish(user : in boolean;
thing : in out user_defined_thing) is
begin
Write_Line("procedure Terminate_User_Error_Report is");
write_thing(user, thing);
end write_finish;
--
-- TITLE:
-- Write the error report function
--
-- OVERVIEW:
-- Write out the header with signature and then the body.
-- ...................................................
procedure write_report(user : in boolean;
thing : in out user_defined_thing) is
begin
Write_Line("procedure Report_Continuable_Error ");
Write_Line(" (Line_Number : in Natural;");
Write_Line(" Offset : in Natural;");
Write_Line(" Finish : in Natural;");
Write_Line(" Message : in String;");
Write_Line(" Error : in Boolean) is");
write_thing(user, thing);
end write_report;
--
-- TITLE: procedure Write_File
-- Create & open the Error_Report file, dump its contents.
--
-- PERSONNEL:
-- AUTHOR: <NAME>
-- DATE: Mar 11 1990
--
-- OVERVIEW:
-- The file being created will be used to report errors which yyparse
-- encounters. Some of them it can correct, and some it cannot.
-- There are different mechanisms for reporting each of these. There
-- is default reporting of corrected errors; messages are written
-- into the .lis file (Put, Put_Line). Also,
-- the user can define his/her own error reporting of correctable errors
-- in the last section of the .y file. If so, we here construct the
-- error report file so as to use these procedures.
-- Also in this package are variables and routines to
-- manipulate error information which the user can call from yyerror,
-- the procedure called when a non-correctable error is encountered.
-- The things generated which vary with runs of Ayacc is the names
-- of the Ada units, the packages With'ed and Used by the generated
-- error report package body and the bodies of the user-defined error report
-- routines for continuable errors.
--
-- NOTES:
-- This procedure is exported from the package.
--
-- SUBPROGRAM BODY:
--
procedure Write_File is
current_thing : user_defined_thing := line_thing;
wrote_init : boolean := false;
wrote_finish : boolean := false;
wrote_report : boolean := false;
begin
Create(The_File, Out_File, Get_Error_Report_File_Name);
Write_Line("package " & Error_Report_Unit_Name & " is");
Write_Line("");
Write_Line(" Syntax_Error : Exception;");
Write_Line(" Syntax_Warning : Exception;");
Write_Line(" Total_Errors : Natural := 0; -- number of syntax errors found." );
Write_Line(" Total_Warnings : Natural := 0; -- number of syntax warnings found." );
Write_Line(" ");
Write_Line(" procedure Report_Continuable_Error(Line_Number : in Natural;");
Write_Line(" Offset : in Natural;");
Write_Line(" Finish : in Natural;");
Write_Line(" Message : in String;");
Write_Line(" Error : in Boolean);");
Write_Line("");
Write_Line(" procedure Initialize_Output;");
Write_Line("");
Write_Line(" procedure Finish_Output;");
Write_Line("");
Write_Line(" procedure Put(S: in String);");
Write_Line("");
Write_Line(" procedure Put(C: in Character);");
Write_Line("");
Write_Line(" procedure Put_Line(S: in String);");
Write_Line("");
Write_Line("end " & Error_Report_Unit_Name & ";");
Write_Line("");
Write_Line("");
Write_Line("with Text_IO;");
-- Get %with's & %use's from source file
loop
get_next_thing(current_thing);
if current_thing = with_thing then
Write_Line("With " & text(1..length));
elsif current_thing = use_thing then
Write_Line("Use " & text(1..length));
elsif current_thing = line_thing then
null;
else
exit;
end if;
end loop;
Write_Line("");
Write_Line("package body " & Error_Report_Unit_Name & " is");
Write_Line("");
Write_Line(" The_File : Text_io.File_Type;");
Write_Line("");
-- Get user declarations of error reporting procedures from source file
while(current_thing /= eof_thing) loop
if current_thing = init_thing then
Write_init(true, current_thing);
wrote_init := true;
elsif current_thing = finish_thing then
Write_finish(true, current_thing);
wrote_finish := true;
elsif current_thing = report_thing then
Write_report(true, current_thing);
wrote_report := true;
else
get_next_thing(current_thing);
end if;
end loop;
if not wrote_init then
Write_init(false, current_thing);
end if;
if not wrote_finish then
Write_finish(false, current_thing);
end if;
if not wrote_report then
Write_report(false, current_thing);
end if;
Write_Line("");
Write_Line(" procedure Initialize_Output is");
Write_Line(" begin");
Write_Line(" Text_io.Create(The_File, Text_io.Out_File, " &
'"' & Get_Listing_File_Name & '"' & ");");
Write_Line(" initialize_user_error_report;");
Write_Line(" end Initialize_Output;");
Write_Line("");
Write_Line(" procedure Finish_Output is");
Write_Line(" begin");
Write_Line(" Text_io.Close(The_File);");
Write_Line(" terminate_user_error_report;");
Write_Line(" end Finish_Output;");
Write_Line("");
Write_Line(" procedure Put(S: in String) is");
Write_Line(" begin");
Write_Line(" Text_io.put(The_File, S);");
Write_Line(" end Put;");
Write_Line("");
Write_Line(" procedure Put(C: in Character) is");
Write_Line(" begin");
Write_Line(" Text_io.put(The_File, C);");
Write_Line(" end Put;");
Write_Line("");
Write_Line(" procedure Put_Line(S: in String) is");
Write_Line(" begin");
Write_Line(" Text_io.put_Line(The_File, S);");
Write_Line(" end Put_Line;");
Write_Line("");
Write_Line("");
Write_Line("end " & Error_Report_Unit_Name & ";");
Close(The_File);
end Write_File;
-- ...................................................
begin
null;
end Error_Report_File;
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c4/c45274b.ada | best08618/asylo | 7 | 13076 | <reponame>best08618/asylo
-- C45274B.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT THE MEMBERSHIP OPERATOR IN ( NOT IN ) ALWAYS
-- YIELDS TRUE (RESP. FALSE ) FOR
--
-- * RECORD TYPES WITHOUT DISCRIMINANTS;
-- * PRIVATE TYPES WITHOUT DISCRIMINANTS;
-- * LIMITED PRIVATE TYPES WITHOUT DISCRIMINANTS;
-->> * (UNCONSTRAINED) RECORD TYPES WITH DISCRIMINANTS;
-->> * (UNCONSTRAINED) PRIVATE TYPES WITH DISCRIMINANTS;
-->> * (UNCONSTRAINED) LIMITED PRIVATE TYPES WITH DISCRIMINANTS.
-- RM 3/03/82
WITH REPORT;
USE REPORT;
PROCEDURE C45274B IS
BEGIN
TEST ( "C45274B" , "CHECK THAT THE MEMBERSHIP OPERATOR IN " &
" ( NOT IN ) YIELDS TRUE (RESP. FALSE )" &
" FOR UNCONSTRAINED TYPES WITH DISCRIMINANTS" );
-------------------------------------------------------------------
-------- UNCONSTRAINED RECORD TYPES WITH DISCRIMINANTS ----------
DECLARE
TYPE REC ( DISCR : BOOLEAN ) IS
RECORD
A , B : INTEGER ;
END RECORD ;
X : REC(FALSE) := ( FALSE , 19 , 81 );
TYPE REC0 ( DISCR : BOOLEAN := FALSE ) IS
RECORD
A , B : INTEGER ;
END RECORD ;
Y : REC0 := ( TRUE , 19 , 81 );
BEGIN
IF X IN REC THEN
NULL;
ELSE
FAILED( "WRONG VALUE: 'IN', 1A" );
END IF;
IF Y NOT IN REC0 THEN
FAILED( "WRONG VALUE: 'NOT IN', 1B" );
ELSE
NULL;
END IF;
EXCEPTION
WHEN OTHERS =>
FAILED( "1 - 'IN' ( 'NOT IN' ) RAISED AN EXCEPTION");
END;
-------------------------------------------------------------------
------- UNCONSTRAINED PRIVATE TYPES WITH DISCRIMINANTS ----------
DECLARE
PACKAGE P IS
TYPE PRIV ( DISCR : BOOLEAN ) IS PRIVATE;
PRIVATE
TYPE PRIV ( DISCR : BOOLEAN ) IS
RECORD
A , B : INTEGER ;
END RECORD ;
END P ;
USE P ;
X : PRIV(FALSE) ;
PACKAGE BODY P IS
BEGIN
X := ( FALSE , 19 , 91 );
END P ;
BEGIN
IF X IN PRIV THEN
NULL;
ELSE
FAILED( "WRONG VALUE: 'IN', 2" );
END IF;
IF X NOT IN PRIV THEN
FAILED( "WRONG VALUE: 'NOT IN', 2" );
ELSE
NULL;
END IF;
EXCEPTION
WHEN OTHERS =>
FAILED( "2 - 'IN' ( 'NOT IN' ) RAISED AN EXCEPTION");
END;
-------------------------------------------------------------------
--------- UNCONSTRAINED LIM. PRIV. TYPES WITH DISCRIM. ----------
DECLARE
PACKAGE P IS
TYPE LP ( DISCR : BOOLEAN := FALSE ) IS LIMITED PRIVATE;
PRIVATE
TYPE LP ( DISCR : BOOLEAN := FALSE ) IS
RECORD
A , B : INTEGER ;
END RECORD ;
END P ;
USE P ;
X : LP(TRUE) ;
PACKAGE BODY P IS
BEGIN
X := ( TRUE , 19 , 91 );
END P ;
BEGIN
IF X IN LP THEN
NULL;
ELSE
FAILED( "WRONG VALUE: 'IN', 3" );
END IF;
IF X NOT IN LP THEN
FAILED( "WRONG VALUE: 'NOT IN', 3" );
ELSE
NULL;
END IF;
EXCEPTION
WHEN OTHERS =>
FAILED( "3 - 'IN' ( 'NOT IN' ) RAISED AN EXCEPTION");
END;
-------------------------------------------------------------------
DECLARE
PACKAGE P IS
TYPE LP ( DISCR : BOOLEAN := FALSE ) IS LIMITED PRIVATE;
PRIVATE
TYPE LP ( DISCR : BOOLEAN := FALSE ) IS
RECORD
A , B : INTEGER ;
END RECORD ;
END P ;
USE P ;
Y : LP(TRUE) ;
-- CHECK THAT NO EXCEPTION FOR UNINITIALIZED VARIABLE
BEGIN
IF Y IN LP THEN
NULL;
ELSE
FAILED( "WRONG VALUE: 'IN', 3BIS" );
END IF;
IF Y NOT IN LP THEN
FAILED( "WRONG VALUE: 'NOT IN', 3BIS" );
ELSE
NULL;
END IF;
EXCEPTION
WHEN OTHERS =>
FAILED( "3BIS - UNINITIALIZED VARIABLE - 'IN' " &
"( 'NOT IN' ) RAISED AN EXCEPTION" );
END;
-------------------------------------------------------------------
RESULT;
END C45274B ;
|
test/fail/Issue328.agda | asr/agda-kanso | 1 | 352 | <reponame>asr/agda-kanso<filename>test/fail/Issue328.agda
module Issue328 where
mutual
postulate D : Set
-- An internal error has occurred. Please report this as a bug.
-- Location of the error: src/full/Agda/Syntax/Concrete/Definitions.hs:398
|
test/Succeed/Subset.agda | cruhland/agda | 1,989 | 12875 | <reponame>cruhland/agda
module Subset where
data Subset (A : Set) (P : A -> Set) : Set where
inn : (a : A) -> .(P a) -> Subset A P
out : forall {A P} -> Subset A P -> A
out (inn a p) = a
|
programs/oeis/214/A214944.asm | jmorken/loda | 1 | 93508 | <filename>programs/oeis/214/A214944.asm
; A214944: Number of squarefree words of length 5 in an (n+1)-ary alphabet.
; 0,30,264,1140,3480,8610,18480,35784,64080,107910,172920,265980,395304,570570,803040,1105680,1493280,1982574,2592360,3343620,4259640,5366130,6691344,8266200,10124400,12302550,14840280,17780364,21168840,25055130
mov $1,$0
mul $1,2
mov $3,$0
mov $4,$0
mov $6,$0
lpb $3
sub $3,1
add $5,$6
lpe
mov $2,9
mov $6,$5
lpb $2
add $1,$6
sub $2,1
lpe
mov $3,$4
mov $5,0
lpb $3
sub $3,1
add $5,$6
lpe
mov $2,12
mov $6,$5
lpb $2
add $1,$6
sub $2,1
lpe
mov $3,$4
mov $5,0
lpb $3
sub $3,1
add $5,$6
lpe
mov $2,6
mov $6,$5
lpb $2
add $1,$6
sub $2,1
lpe
mov $3,$4
mov $5,0
lpb $3
sub $3,1
add $5,$6
lpe
mov $2,1
mov $6,$5
lpb $2
add $1,$6
sub $2,1
lpe
|
programs/oeis/026/A026184.asm | karttu/loda | 1 | 169456 | ; A026184: a(n) = (1/3)*s(n), where s(n) is the n-th multiple of 3 in A026136.
; 1,3,5,2,7,9,11,4,13,15,17,6,19,21,23,8,25,27,29,10,31,33,35,12,37,39,41,14,43,45,47,16,49,51,53,18,55,57,59,20,61,63,65,22,67,69,71,24,73,75,77,26,79,81,83,28,85,87,89,30,91,93,95
add $0,1
cal $0,26218 ; a(n) = (1/3)*(s(n) + 2), where s(n) is the n-th number congruent to 1 mod 3 in A026177.
mov $1,$0
sub $1,1
|
oeis/259/A259157.asm | neoneye/loda-programs | 11 | 168680 | ; A259157: Positive triangular numbers (A000217) that are hexagonal numbers (A000384) divided by 2.
; 3,3570,4119885,4754343828,5486508657735,6331426236682470,7306460390622912753,8431648959352604634600,9730115592632515125415755,11228544962248963102125146778,12957731156319710787337293966165,14953210525847983999624135111807740,17255991989097417215855464581732165903,19913399802207893619113206503183807644430,22980046115755920139039424449209532289506425,26518953304182529632557876701181297078282770128,30602849132980523440051650673738767618806027221395
mul $0,2
add $0,1
seq $0,2315 ; NSW numbers: a(n) = 6*a(n-1) - a(n-2); also a(n)^2 - 2*b(n)^2 = -1 with b(n)=A001653(n+1).
pow $0,2
div $0,48
mul $0,3
|
projects/batfish/src/main/antlr4/org/batfish/vendor/a10/grammar/A10_router_bgp.g4 | ton31337/batfish | 763 | 3277 | parser grammar A10_router_bgp;
import A10_common;
options {
tokenVocab = A10Lexer;
}
sr_bgp: BGP bgp_asn NEWLINE srb_definition*;
srb_definition
:
srb_bgp
| srb_maximum_paths
| srb_timers
| srb_synchronization
| srb_neighbor
| srb_redistribute
;
srb_bgp: BGP srbb;
srbb
:
srbb_default_local_preference
| srbb_fast_external_failover
| srbb_log_neighbor_changes
| srbb_nexthop_trigger_count
| srbb_router_id
| srbb_scan_time
;
srbb_default_local_preference: DEFAULT LOCAL_PREFERENCE bgp_local_preference NEWLINE;
srbb_fast_external_failover: FAST_EXTERNAL_FAILOVER NEWLINE;
srbb_log_neighbor_changes: LOG_NEIGHBOR_CHANGES NEWLINE;
srbb_nexthop_trigger_count: NEXTHOP_TRIGGER_COUNT null_rest_of_line;
srbb_router_id: ROUTER_ID ip_address NEWLINE;
srbb_scan_time: SCAN_TIME null_rest_of_line;
srb_maximum_paths: MAXIMUM_PATHS bgp_max_paths NEWLINE;
srb_timers: TIMERS BGP bgp_keepalive bgp_holdtime NEWLINE;
srb_synchronization: SYNCHRONIZATION NEWLINE;
srb_neighbor: NEIGHBOR bgp_neighbor srbn;
bgp_neighbor: ip_address;
srbn
:
srbn_activate
| srbn_description
| srbn_maximum_prefix
| srbn_remote_as
| srbn_send_community
| srbn_weight
| srbn_update_source
| srbn_null
;
srbn_null
:
(
CAPABILITY
| FALL_OVER
| SOFT_RECONFIGURATION
| TIMERS
) null_rest_of_line
;
srbn_activate: ACTIVATE NEWLINE;
srbn_description: DESCRIPTION bgp_neighbor_description NEWLINE;
srbn_maximum_prefix: MAXIMUM_PREFIX bgp_neighbor_max_prefix bgp_neighbor_max_prefix_threshold? NEWLINE;
srbn_remote_as: REMOTE_AS bgp_asn NEWLINE;
srbn_send_community: SEND_COMMUNITY send_community NEWLINE;
send_community: BOTH | EXTENDED | STANDARD | NONE;
srbn_weight: WEIGHT bgp_neighbor_weight NEWLINE;
srbn_update_source: UPDATE_SOURCE bgp_neighbor_update_source NEWLINE;
bgp_neighbor_update_source: ip_address;
srb_redistribute: REDISTRIBUTE srbr;
srbr
:
srbr_connected
| srbr_floating_ip
| srbr_ip_nat
| srbr_vip
;
srbr_connected: CONNECTED NEWLINE;
srbr_floating_ip: FLOATING_IP NEWLINE;
srbr_ip_nat: IP_NAT NEWLINE;
srbr_vip: VIP srbrv;
srbrv: srbrv_only_flagged | srbrv_only_not_flagged;
srbrv_only_flagged: ONLY_FLAGGED NEWLINE;
srbrv_only_not_flagged: ONLY_NOT_FLAGGED NEWLINE;
// 1-64
bgp_max_paths: uint8;
// 0-65535
bgp_keepalive: uint16;
// 0-65535
bgp_holdtime: uint16;
// 0-4294967295
bgp_local_preference: uint32;
// 1-80 chars
bgp_neighbor_description: word;
// 0-65535
bgp_neighbor_weight: uint16;
// 1-65536
bgp_neighbor_max_prefix: uint32;
// 1-100
bgp_neighbor_max_prefix_threshold: uint8;
|
programs/oeis/178/A178389.asm | neoneye/loda | 22 | 11315 | <reponame>neoneye/loda<filename>programs/oeis/178/A178389.asm
; A178389: Multiples of 3 in A175461.
; 21,69,93,141,213,237,309,381,453,501,573,597,669,717,789,813,933,1077,1101,1149,1293,1317,1389,1437,1461,1509,1797,1821,1893,1941,2157,2181,2229,2253,2469,2517,2589,2661,2733,2757,2901,2949,2973,3093,3117,3189
mov $2,$0
add $2,1
pow $2,2
lpb $2
add $1,6
sub $2,1
mov $3,$1
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,2
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
lpe
div $1,2
sub $1,4
mul $1,6
add $1,21
mov $0,$1
|
src/aco-slave_monitors.ads | jonashaggstrom/ada-canopen | 6 | 18233 | <filename>src/aco-slave_monitors.ads
with Ada.Real_Time;
with ACO.States;
with ACO.Messages;
with ACO.OD;
private with ACO.Utils.Generic_Alarms;
private with ACO.Configuration;
package ACO.Slave_Monitors is
type Slave_Monitor (Od : not null access ACO.OD.Object_Dictionary'Class) is
tagged limited private;
type Slave_Monitor_Ref is access all Slave_Monitor'Class;
function Is_Monitored
(This : Slave_Monitor;
Node_Id : ACO.Messages.Slave_Node_Nr)
return Boolean;
function Get_State
(This : Slave_Monitor;
Node_Id : ACO.Messages.Slave_Node_Nr)
return ACO.States.State
with Pre => This.Is_Monitored (Node_Id);
procedure Restart
(This : in out Slave_Monitor;
T_Now : in Ada.Real_Time.Time);
procedure Start
(This : in out Slave_Monitor;
Node_Id : in ACO.Messages.Slave_Node_Nr;
Slave_State : in ACO.States.State;
T_Now : in Ada.Real_Time.Time)
with Pre => not This.Is_Monitored (Node_Id);
procedure Update_State
(This : in out Slave_Monitor;
Node_Id : in ACO.Messages.Slave_Node_Nr;
Slave_State : in ACO.States.State;
T_Now : in Ada.Real_Time.Time)
with Pre => This.Is_Monitored (Node_Id);
procedure Update_Alarms
(This : in out Slave_Monitor;
T_Now : in Ada.Real_Time.Time);
private
package Alarms is new ACO.Utils.Generic_Alarms
(Maximum_Nof_Alarms => ACO.Configuration.Max_Nof_Heartbeat_Slaves);
type Slave_Alarm
(Ref : access Slave_Monitor := null)
is new Alarms.Alarm_Type with record
Node_Id : ACO.Messages.Node_Nr;
Slave_State : ACO.States.State_Transition;
end record;
overriding
procedure Signal
(This : access Slave_Alarm;
T_Now : in Ada.Real_Time.Time);
type Slaves_Array is array (Positive range <>) of aliased Slave_Alarm;
type Slave_Monitor (Od : not null access ACO.OD.Object_Dictionary'Class) is
tagged limited
record
Manager : Alarms.Alarm_Manager;
Slaves : Slaves_Array (1 .. ACO.Configuration.Max_Nof_Heartbeat_Slaves) :=
(others => (Slave_Monitor'Access,
ACO.Messages.Not_A_Slave,
(ACO.States.Unknown_State, ACO.States.Unknown_State)));
end record;
end ACO.Slave_Monitors;
|
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_12_96.asm | ljhsiun2/medusa | 9 | 11093 | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %r15
push %r8
push %r9
push %rdx
lea addresses_A_ht+0xa1f4, %rdx
clflush (%rdx)
nop
xor $53669, %r9
movb (%rdx), %r14b
nop
nop
nop
nop
dec %r13
lea addresses_WC_ht+0xffe4, %r8
nop
nop
nop
nop
inc %r14
movw $0x6162, (%r8)
nop
xor $36485, %r14
pop %rdx
pop %r9
pop %r8
pop %r15
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %rbp
push %rdi
push %rdx
push %rsi
// Store
lea addresses_WC+0x6844, %rdi
nop
cmp $13971, %rbp
movw $0x5152, (%rdi)
nop
and $1097, %rdx
// Load
lea addresses_WC+0xe104, %r12
nop
nop
sub $44339, %r13
mov (%r12), %bp
xor %rbp, %rbp
// Load
lea addresses_A+0x1e844, %rdx
nop
nop
nop
nop
nop
add $22786, %rdi
vmovups (%rdx), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $0, %xmm4, %rbp
nop
and %rdx, %rdx
// Store
lea addresses_normal+0x102d4, %rdx
nop
nop
xor %rsi, %rsi
movb $0x51, (%rdx)
inc %r10
// Faulty Load
lea addresses_WT+0x16044, %rbp
clflush (%rbp)
nop
nop
nop
nop
nop
sub $35317, %rdx
mov (%rbp), %esi
lea oracles, %rdi
and $0xff, %rsi
shlq $12, %rsi
mov (%rdi,%rsi,1), %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rbp
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 8, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 6, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 10, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 3, 'size': 1, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 4, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 3, 'size': 2, 'same': False, 'NT': False}}
{'00': 12}
00 00 00 00 00 00 00 00 00 00 00 00
*/
|
oeis/346/A346672.asm | neoneye/loda-programs | 11 | 169310 | ; A346672: a(n) = Sum_{k=0..n} binomial(8*k,k) / (7*k + 1).
; 1,2,10,102,1342,19620,305004,4943352,82595376,1412486081,24602515801,434935956337,7783978950825,140752989839105,2567623696254905,47195200645619009,873239636055018809,16251426606785706209,304007720310330530081,5713101394865420846381,107807642745602563613941,2041941706599459444720361,38806405111617176830523641,739775290098345415293787101,14142271289851406246494296501,271057791779353956296370360609,5207630409192750587661363448257,100271151035060410987183411649441,1934639176324818099664828139793577
mov $3,$0
mov $5,$0
lpb $5
mov $0,$3
sub $5,1
sub $0,$5
mov $2,7
mul $2,$0
add $0,$2
bin $0,$2
add $2,1
div $0,$2
add $4,$0
lpe
mov $0,$4
add $0,1
|
programs/oeis/008/A008600.asm | karttu/loda | 1 | 7716 | ; A008600: Multiples of 18.
; 0,18,36,54,72,90,108,126,144,162,180,198,216,234,252,270,288,306,324,342,360,378,396,414,432,450,468,486,504,522,540,558,576,594,612,630,648,666,684,702,720,738,756,774,792,810,828,846,864,882,900,918,936,954,972,990,1008,1026,1044,1062,1080,1098,1116,1134,1152,1170,1188,1206,1224,1242,1260,1278,1296,1314,1332,1350,1368,1386,1404,1422,1440,1458,1476,1494,1512,1530,1548,1566,1584,1602,1620,1638,1656,1674,1692,1710,1728,1746,1764,1782,1800,1818,1836,1854,1872,1890,1908,1926,1944,1962,1980,1998,2016,2034,2052,2070,2088,2106,2124,2142,2160,2178,2196,2214,2232,2250,2268,2286,2304,2322,2340,2358,2376,2394,2412,2430,2448,2466,2484,2502,2520,2538,2556,2574,2592,2610,2628,2646,2664,2682,2700,2718,2736,2754,2772,2790,2808,2826,2844,2862,2880,2898,2916,2934,2952,2970,2988,3006,3024,3042,3060,3078,3096,3114,3132,3150,3168,3186,3204,3222,3240,3258,3276,3294,3312,3330,3348,3366,3384,3402,3420,3438,3456,3474,3492,3510,3528,3546,3564,3582,3600,3618,3636,3654,3672,3690,3708,3726,3744,3762,3780,3798,3816,3834,3852,3870,3888,3906,3924,3942,3960,3978,3996,4014,4032,4050,4068,4086,4104,4122,4140,4158,4176,4194,4212,4230,4248,4266,4284,4302,4320,4338,4356,4374,4392,4410,4428,4446,4464,4482
mov $1,$0
mul $1,18
|
lemmas-general.agda | hazelgrove/hazelnat-myth- | 1 | 4512 | open import Nat
open import Prelude
open import List
open import contexts
open import core
module lemmas-general where
Coerce-unicity : ∀{r ex1 ex2} →
Coerce r := ex1 →
Coerce r := ex2 →
ex1 == ex2
Coerce-unicity CoerceUnit CoerceUnit = refl
Coerce-unicity (CoercePair C1 C2) (CoercePair C3 C4)
rewrite Coerce-unicity C1 C3 | Coerce-unicity C2 C4
= refl
Coerce-unicity (CoerceCtor C1) (CoerceCtor C2)
rewrite Coerce-unicity C1 C2
= refl
Fuel-depletion-unicity : ∀{⛽ ⛽↓1 ⛽↓2} →
⛽ ⛽⇓ ⛽↓1 →
⛽ ⛽⇓ ⛽↓2 →
⛽↓1 == ⛽↓2
Fuel-depletion-unicity CF∞ CF∞ = refl
Fuel-depletion-unicity CF⛽ CF⛽ = refl
|
asmFiles/palgorithm.asm | hythzz/MIPS-Processor | 0 | 28886 | <reponame>hythzz/MIPS-Processor
#------------------------------------------
# Parallel Algorithm by <NAME>
#------------------------------------------
#----------------------------------------------------------
# First Processor - Consumer
#----------------------------------------------------------
org 0x0000 # first processor p0
ori $sp, $zero, 0x3ffc # stack
jal mainp0 # go to program
halt
# main function does something ugly but demonstrates beautifully
mainp0:
push $ra # save return address
ori $s0, $zero, 256 # main loop index, do 256 times
ori $s1, $zero, 0 # sum of 256 random numbers
p0loop:
# pre-processing:
p0check:
# check the stack pointer
ori $t1, $zero, bsp # obtain buffer stack pointer addr
lw $t0, 0($t1) # obtain buffer stack pointer value
slti $t2, $t0, 0x800
beq $t2, $zero, p0check # no valid data in buffer stack
# lock
ori $a0, $zero, lck # move lock to arguement register
jal lock # try to aquire the lock
# consistency maintained
jal bufpop
or $s2, $zero, $v0
# unlock
ori $a0, $zero, lck # move lock to arguement register
jal unlock # release the lock
# post-processing: 1. crop lower 16b 2. add to sum, 3. update min and max
andi $s2, $s2, 0x0000FFFF # crop lower 16b
add $s1, $s1, $s2 # add to sum
ori $t1, $zero, resmax # obtain result max addr
lw $a0, 0($t1) # move result max value to argument register
or $a1, $zero, $s2 # move new random number to argument register
jal max
sw $v0, 0($t1) # update result max
ori $t1, $zero, resmin # obtain result min addr
lw $a0, 0($t1) # move result min value to argument register
jal min
sw $v0, 0($t1) # update result min
# loop control
addi $s0, $s0, -1 # index <= index - 1
bne $s0, $zero, p0loop
# calculate average
or $a0, $zero, $s1 # move sum to argument
ori $a1, $zero, 256 # move denominator to argument
jal divide
ori $t1, $zero, resavg # obtain result average addr
sw $v0, 0($t1) # store result average
# end of p0
pop $ra # get return address
jr $ra # return to caller
lck:
cfw 0x0
bsp:
cfw 0x800
#----------------------------------------------------------
# Second Processor - producer
#----------------------------------------------------------
org 0x200 # second processor p1
ori $sp, $zero, 0x7ffc # stack
jal mainp1 # go to program
halt
# main function does something ugly but demonstrates beautifully
mainp1:
push $ra # save return address
ori $s0, $zero, 256 # main loop index, do 256 times
ori $s1, $zero, 0xBEEF # initial seed
p1loop:
# pre-processing: 1. get new random number
or $a0, $zero, $s1 # move previous random number to argument register
jal crc32
or $s1, $zero, $v0 # move new random number to register
p1check:
# check the stack pointer
ori $t1, $zero, bsp # obtain buffer stack pointer addr
lw $t0, 0($t1) # obtain buffer stack pointer value
slti $t2, $t0, 0x7dc
bne $t2, $zero, p1check # buffer stack full
# lock
ori $a0, $zero, lck # move lock to arguement register
jal lock # try to aquire the lock
# consistency maintained
or $a0, $zero, $s1 # move new random number to argument register
jal bufpsh
# unlock
ori $a0, $zero, lck # move lock to arguement register
jal unlock # release the lock
# post-processing:
# loop control
addi $s0, $s0, -1 # index <= index - 1
bne $s0, $zero, p1loop
# end of p1
pop $ra # get return address
jr $ra # return to caller
# Results
resavg:
cfw 0x0 # average of 256 random numbers
resmax:
cfw 0x0 # max of 256 random numbers
resmin:
cfw 0xFFFF # min of 256 random numbers
#----------------------------------------------------------
# Lock
#----------------------------------------------------------
# pass in an address to lock function in argument register 0
# returns when lock is available
lock:
aquire:
ll $t0, 0($a0) # load lock location
bne $t0, $0, aquire # wait on lock to be open
addiu $t0, $t0, 1
sc $t0, 0($a0)
beq $t0, $0, lock # if sc failed retry
jr $ra
# pass in an address to unlock function in argument register 0
# returns when lock is free
unlock:
sw $0, 0($a0)
jr $ra
#----------------------------------------------------------
# Circular Buffer (stack)
#----------------------------------------------------------
# buffer push
# bufpsh($a0)
bufpsh:
ori $t1, $zero, bsp # obtain buffer stack pointer addr
lw $t0, 0($t1) # obtain buffer stack pointer value
addi $t0, $t0, -4 # decrement buffer stack pointer
sw $a0, 0($t0) # store the top most stack element
sw $t0, 0($t1) # store updated buffer stack pointer
jr $ra
# buffer pop
# bufpop returns ($v0)
bufpop:
ori $t1, $zero, bsp # obtain buffer stack pointer addr
lw $t0, 0($t1) # obtain buffer stack pointer value
lw $v0, 0($t0) # load the top most stack element
sw $zero, 0($t0) # zero out the top most stack element
addi $t0, $t0, 4 # increment buffer stack pointer
sw $t0, 0($t1) # store updated buffer stack pointer
jr $ra
#----------------------------------------------------------
# CRC
#
# USAGE random0 = crc(seed), random1 = crc(random0)
# randomN = crc(randomN-1)
#----------------------------------------------------------
# $v0 = crc32($a0)
crc32:
lui $t1, 0x04C1
ori $t1, $t1, 0x1DB7
or $t2, $0, $0
ori $t3, $0, 32
l1:
slt $t4, $t2, $t3
beq $t4, $zero, l2
srl $t4, $a0, 31
sll $a0, $a0, 1
beq $t4, $0, l3
xor $a0, $a0, $t1
l3:
addiu $t2, $t2, 1
j l1
l2:
or $v0, $a0, $0
jr $ra
#----------------------------------------------------------
# Divide
#
# divide(N=$a0,D=$a1) returns (Q=$v0,R=$v1)
#----------------------------------------------------------
divide: # setup frame
push $ra # saved return address
push $a0 # saved register
push $a1 # saved register
or $v0, $0, $0 # Quotient v0=0
or $v1, $0, $a0 # Remainder t2=N=a0
beq $0, $a1, divrtn # test zero D
slt $t0, $a1, $0 # test neg D
bne $t0, $0, divdneg
slt $t0, $a0, $0 # test neg N
bne $t0, $0, divnneg
divloop:
slt $t0, $v1, $a1 # while R >= D
bne $t0, $0, divrtn
addiu $v0, $v0, 1 # Q = Q + 1
subu $v1, $v1, $a1 # R = R - D
j divloop
divnneg:
subu $a0, $0, $a0 # negate N
jal divide # call divide
subu $v0, $0, $v0 # negate Q
beq $v1, $0, divrtn
addiu $v0, $v0, -1 # return -Q-1
j divrtn
divdneg:
subu $a0, $0, $a1 # negate D
jal divide # call divide
subu $v0, $0, $v0 # negate Q
divrtn:
pop $a1
pop $a0
pop $ra
jr $ra
#----------------------------------------------------------
# Max
#
# max (a0=a,a1=b) returns v0=max(a,b)
#----------------------------------------------------------
max:
push $ra
push $a0
push $a1
or $v0, $0, $a0
slt $t0, $a0, $a1
beq $t0, $0, maxrtn
or $v0, $0, $a1
maxrtn:
pop $a1
pop $a0
pop $ra
jr $ra
#----------------------------------------------------------
# Min
#
# min (a0=a,a1=b) returns v0=min(a,b)
#----------------------------------------------------------
min:
push $ra
push $a0
push $a1
or $v0, $0, $a0
slt $t0, $a1, $a0
beq $t0, $0, minrtn
or $v0, $0, $a1
minrtn:
pop $a1
pop $a0
pop $ra
jr $ra
|
src/lv-hal.ads | Fabien-Chouteau/ada-lvlg | 3 | 18361 | <filename>src/lv-hal.ads
package Lv.Hal is
end Lv.Hal;
|
programs/oeis/113/A113405.asm | neoneye/loda | 22 | 170226 | ; A113405: Expansion of x^3/(1-2*x+x^3-2*x^4) = x^3/( (1-2*x)*(1+x)*(1-x+x^2) ).
; 0,0,0,1,2,4,7,14,28,57,114,228,455,910,1820,3641,7282,14564,29127,58254,116508,233017,466034,932068,1864135,3728270,7456540,14913081,29826162,59652324,119304647,238609294,477218588,954437177,1908874354,3817748708,7635497415,15270994830,30541989660,61083979321,122167958642,244335917284,488671834567,977343669134,1954687338268,3909374676537,7818749353074,15637498706148,31274997412295,62549994824590,125099989649180,250199979298361,500399958596722,1000799917193444,2001599834386887,4003199668773774,8006399337547548,16012798675095097,32025597350190194,64051194700380388,128102389400760775,256204778801521550,512409557603043100,1024819115206086201,2049638230412172402,4099276460824344804,8198552921648689607,16397105843297379214,32794211686594758428,65588423373189516857,131176846746379033714,262353693492758067428,524707386985516134855,1049414773971032269710,2098829547942064539420,4197659095884129078841,8395318191768258157682,16790636383536516315364,33581272767073032630727,67162545534146065261454,134325091068292130522908,268650182136584261045817,537300364273168522091634,1074600728546337044183268,2149201457092674088366535,4298402914185348176733070,8596805828370696353466140,17193611656741392706932281,34387223313482785413864562,68774446626965570827729124,137548893253931141655458247,275097786507862283310916494,550195573015724566621832988,1100391146031449133243665977,2200782292062898266487331954,4401564584125796532974663908,8803129168251593065949327815,17606258336503186131898655630,35212516673006372263797311260,70425033346012744527594622521
mov $1,2
pow $1,$0
add $1,4
div $1,9
mov $0,$1
|
alloy4fun_models/trashltl/models/3/v9vmPb7ammvNoPffL.als | Kaixi26/org.alloytools.alloy | 0 | 4012 | open main
pred idv9vmPb7ammvNoPffL_prop4 {
some f: File | eventually f in Trash since f not in Protected
}
pred __repair { idv9vmPb7ammvNoPffL_prop4 }
check __repair { idv9vmPb7ammvNoPffL_prop4 <=> prop4o } |
firmware/coreboot/src/lib/gnat/i-c.adb | fabiojna02/OpenCellular | 1 | 5021 | <reponame>fabiojna02/OpenCellular
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- I N T E R F A C E S . C --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2009, 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. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package body Interfaces.C is
-----------------------
-- Is_Nul_Terminated --
-----------------------
-- Case of char_array
function Is_Nul_Terminated (Item : char_array) return Boolean is
begin
for J in Item'Range loop
if Item (J) = nul then
return True;
end if;
end loop;
return False;
end Is_Nul_Terminated;
------------
-- To_Ada --
------------
-- Convert char to Character
function To_Ada (Item : char) return Character is
begin
return Character'Val (char'Pos (Item));
end To_Ada;
----------
-- To_C --
----------
-- Convert Character to char
function To_C (Item : Character) return char is
begin
return char'Val (Character'Pos (Item));
end To_C;
end Interfaces.C;
|
AdaToolsTests/Pure.ads | gitter-badger/Ada-tools | 0 | 29583 | <reponame>gitter-badger/Ada-tools
package Pure with Pure is
--@description A pure spec test package
end Pure; |
oeis/142/A142313.asm | neoneye/loda-programs | 11 | 1646 | <reponame>neoneye/loda-programs
; A142313: Primes congruent to 2 mod 45.
; Submitted by <NAME>
; 2,47,137,227,317,587,677,857,947,1217,1307,1487,1667,1847,2027,2207,2297,2477,2657,2837,2927,3467,3557,3917,4007,4457,4547,4637,4817,5087,5717,5807,5897,5987,6257,6977,7247,7517,7607,7877,8147,8237,8597,8867,9137,9227,9497,9587,9677,9767,9857,10037,10487,10667,10847,10937,11027,11117,11657,11927,12107,12197,12377,12647,12917,13007,13187,13367,13457,13907,13997,14087,14177,14447,14537,14627,14717,14897,15077,15527,15797,15887,16067,16427,16607,16787,17327,17417,17597,17957,18047,18587,18947
mov $2,36
mul $2,$0
mov $4,1
lpb $2
mov $3,$4
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
mov $1,$0
max $1,0
cmp $1,$0
mul $2,$1
sub $2,1
add $4,45
lpe
mov $0,$4
add $0,1
|
src/Parse/GeneratedLexer.g4 | Naios/swy | 19 | 3070 |
/**
Copyright(c) 2016 - 2017 <NAME> <denis.blank at outlook dot com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
**/
lexer grammar GeneratedLexer;
// https://github.com/antlr/antlr4/blob/master/doc/lexer-rules.md
Return: 'return';
// Func: 'func';
Meta: 'meta';
If: 'if';
Else: 'else';
For: 'for';
Break: 'break';
Continue: 'continue';
OpenPar: '(';
ClosePar: ')';
OpenCurly: '{';
CloseCurly: '}';
Arrow: '->';
Comma: ',';
Semicolon: ';';
True: 'true';
False: 'false';
IntegerLiteral: (OperatorPlus | OperatorMinus)? Digit+;
fragment Digit: [0-9];
Identifier: LETTER (LETTER | Digit )*;
fragment LETTER : [a-zA-Z_];
OperatorMul: '*';
OperatorDiv: '/';
OperatorPlus: '+';
OperatorMinus: '-';
OperatorAssign: '=';
OperatorLessThan: '<';
OperatorGreaterThan: '>';
OperatorLessThanOrEq: '<=';
OperatorGreaterThanOrEq: '>=';
OperatorEqual: '==';
OperatorNotEqual: '!=';
Comment: '//' ~[\r\n]* '\r'? '\n' -> skip;
MultilineComment : '/*' .*? '*/' -> skip;
Whitespace: [ \t\r\n]+ -> skip;
|
Transynther/x86/_processed/US/_zr_/i7-7700_9_0x48_notsx.log_13_510.asm | ljhsiun2/medusa | 9 | 84641 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %r15
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0xa6eb, %rsi
lea addresses_D_ht+0x705b, %rdi
nop
nop
nop
nop
add $42320, %r10
mov $4, %rcx
rep movsw
nop
nop
nop
nop
cmp %r10, %r10
lea addresses_WC_ht+0x4663, %r11
cmp %r15, %r15
movw $0x6162, (%r11)
nop
nop
nop
nop
cmp $35558, %rdi
lea addresses_D_ht+0x12099, %rcx
nop
nop
nop
nop
cmp %rsi, %rsi
mov (%rcx), %edi
nop
nop
nop
nop
nop
dec %r10
lea addresses_WT_ht+0x1a09b, %r10
nop
nop
nop
nop
cmp $33991, %rsi
movb $0x61, (%r10)
nop
nop
inc %r15
lea addresses_WC_ht+0x366b, %r15
clflush (%r15)
nop
nop
dec %rdi
movb $0x61, (%r15)
nop
nop
sub $15373, %rcx
lea addresses_UC_ht+0x177db, %r11
nop
nop
inc %rcx
and $0xffffffffffffffc0, %r11
movntdqa (%r11), %xmm7
vpextrq $1, %xmm7, %r10
nop
nop
cmp $61446, %r10
lea addresses_A_ht+0x1a6bb, %r13
nop
nop
cmp %rdi, %rdi
mov $0x6162636465666768, %r11
movq %r11, (%r13)
nop
nop
nop
nop
sub %r13, %r13
lea addresses_D_ht+0x1579b, %rsi
lea addresses_WT_ht+0x12cbb, %rdi
clflush (%rsi)
nop
sub $64675, %rbx
mov $80, %rcx
rep movsq
nop
nop
nop
nop
sub $26638, %r11
lea addresses_normal_ht+0xc97b, %rsi
lea addresses_WC_ht+0x6c9b, %rdi
inc %r11
mov $61, %rcx
rep movsq
nop
nop
add $17065, %r11
lea addresses_normal_ht+0x1b123, %rsi
lea addresses_A_ht+0x1749b, %rdi
dec %rbx
mov $73, %rcx
rep movsl
xor $59149, %r13
lea addresses_A_ht+0x1ec9b, %r10
nop
nop
dec %rdi
movw $0x6162, (%r10)
nop
nop
nop
nop
add %rdi, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r15
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r13
push %rax
push %rcx
push %rdi
// Store
lea addresses_PSE+0x19d9b, %rcx
nop
nop
inc %rdi
mov $0x5152535455565758, %r10
movq %r10, %xmm1
vmovups %ymm1, (%rcx)
nop
nop
nop
xor $40645, %r10
// Store
lea addresses_UC+0xa9b, %rax
and %r12, %r12
mov $0x5152535455565758, %r13
movq %r13, (%rax)
nop
nop
nop
nop
nop
xor %r10, %r10
// Faulty Load
lea addresses_US+0x1889b, %r11
nop
nop
nop
nop
cmp %rax, %rax
vmovups (%r11), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $1, %xmm5, %r13
lea oracles, %rcx
and $0xff, %r13
shlq $12, %r13
mov (%rcx,%r13,1), %r13
pop %rdi
pop %rcx
pop %rax
pop %r13
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_US', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_PSE', 'congruent': 3}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_UC', 'congruent': 8}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_US', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'congruent': 4, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_A_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_WC_ht', 'congruent': 3}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_D_ht', 'congruent': 1}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_WT_ht', 'congruent': 11}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_WC_ht', 'congruent': 1}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': True, 'AVXalign': False, 'size': 16, 'type': 'addresses_UC_ht', 'congruent': 5}}
{'dst': {'same': True, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_A_ht', 'congruent': 5}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 1, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_D_ht'}}
{'dst': {'same': False, 'congruent': 8, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_normal_ht'}}
{'dst': {'same': False, 'congruent': 10, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_normal_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_A_ht', 'congruent': 10}, 'OP': 'STOR'}
{'00': 13}
00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
programs/oeis/138/A138128.asm | neoneye/loda | 22 | 84831 | ; A138128: Powers of 127.
; 1,127,16129,2048383,260144641,33038369407,4195872914689,532875860165503,67675234241018881,8594754748609397887,1091533853073393531649,138624799340320978519423
mov $1,127
pow $1,$0
mov $0,$1
|
oeis/173/A173831.asm | neoneye/loda-programs | 11 | 25157 | ; A173831: Largest prime < n^4.
; Submitted by <NAME>
; 13,79,251,619,1291,2399,4093,6553,9973,14639,20731,28559,38393,50599,65521,83497,104971,130307,159979,194479,234239,279823,331769,390581,456959,531383,614639,707279,809993,923513,1048573,1185907,1336333
mov $2,$0
add $0,10
add $2,2
pow $2,4
lpb $2
mov $3,$2
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
mov $4,$0
max $4,0
cmp $4,$0
cmp $0,1
mul $2,$4
sub $2,1
lpe
mov $0,$2
add $0,1
|
alloy4fun_models/trainstlt/models/5/nQQGoyRnvNPckQKf9.als | Kaixi26/org.alloytools.alloy | 0 | 2378 | open main
pred idnQQGoyRnvNPckQKf9_prop6 {
always all s : Signal | s in Green => s not in Green' or s not in Green => s in Green'
}
pred __repair { idnQQGoyRnvNPckQKf9_prop6 }
check __repair { idnQQGoyRnvNPckQKf9_prop6 <=> prop6o } |
programs/oeis/115/A115293.asm | jmorken/loda | 1 | 105289 | ; A115293: Row sums of correlation triangle for (1+x)^3/(1-x).
; 1,8,31,80,160,272,416,592,800,1040,1312,1616,1952,2320,2720,3152,3616,4112,4640,5200,5792,6416,7072,7760,8480,9232,10016,10832,11680,12560,13472,14416,15392,16400,17440,18512,19616,20752,21920,23120,24352
mov $26,$0
mov $28,$0
add $28,1
lpb $28
clr $0,26
mov $0,$26
sub $28,1
sub $0,$28
mov $23,$0
mov $25,$0
add $25,1
lpb $25
clr $0,23
mov $0,$23
sub $25,1
sub $0,$25
mov $20,$0
mov $22,$0
add $22,1
lpb $22
mov $0,$20
sub $22,1
sub $0,$22
mov $6,5
bin $6,$0
mov $0,3
add $0,$6
mov $2,2401
add $2,$0
mov $5,7
add $5,$2
mov $1,$5
sub $1,2411
add $21,$1
lpe
add $24,$21
lpe
add $27,$24
lpe
mov $1,$27
|
allopy/generate_test_target.als | nishio/learning_alloy | 1 | 3965 | sig Person {
love: Person
}
run {
some x: Person {
x.love.love = x
}
} |
oeis/317/A317050.asm | neoneye/loda-programs | 11 | 176108 | <gh_stars>10-100
; A317050: a(0) = 0 and for any n >= 0, a(n+1) is obtained by changing the rightmost possible digit in the negabinary representation of a(n) so as to get a value not yet in the sequence.
; Submitted by <NAME>
; 0,1,-1,-2,2,3,5,4,-4,-3,-5,-6,-10,-9,-7,-8,8,9,7,6,10,11,13,12,20,21,19,18,14,15,17,16,-16,-15,-17,-18,-14,-13,-11,-12,-20,-19,-21,-22,-26,-25,-23,-24,-40,-39,-41,-42,-38,-37,-35,-36,-28,-27,-29,-30,-34,-33,-31,-32,32,33,31,30,34,35,37,36,28,29,27,26,22,23,25,24,40,41,39,38,42,43,45,44,52,53,51,50,46,47,49,48,80,81,79,78
seq $0,3188 ; Decimal equivalent of Gray code for n.
seq $0,53985 ; Replace 2^k with (-2)^k in binary expansion of n.
|
src/AdcHandler.asm | glen-mac/COMP2121-16s1 | 0 | 26020 | <gh_stars>0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;; ADC HANDLER ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;This file is for storing the MAIN code used to control the adc.
;this is the code that handles the ADC interrupts. The ADC is on free
;running mode which means it will run a new ADC interrupt whenver the
;last ADC conversion is complete
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
handleADC:
push temp
in temp, SREG
push temp
push rmask
push cmask
push temp2
push col
;read from ADC
lds temp2, ADCL
lds temp, ADCH
cpii screenStageFol, stage_pot_reset
brne checkIfPotFind
ldi rmask, high(pot_pos_min)
cpi temp2, low(pot_pos_min)
cpc temp, rmask ;are we less than the min?
brge clrRowPreEndADC
ldi row, 1 ; this means that RESET is being held
rjmp endHandleADC
clrRowPreEndADC:
clr row
rjmp endHandleADC
checkIfPotFind: ;since we arent on reset pot screen, check if we are on pot find screen
cpii screenStageFol, stage_pot_find ;cmask is LOW bits, rmask is HIGH bits
breq performPotFind
rjmp endHandleADC
performPotFind:
clr col ;boolean for 'adc is higher' to check bounds so we can lose game :(
cp temp2, cmask
cpc temp, rmask
brlo adcIsLower
rjmp adcIsHigher
adcIsLower: ;adc is higher than target
sub cmask, temp2
sbc rmask, temp
rjmp checkBelow16
adcIsHigher: ;adc is lower than target
sub temp2, cmask
sbc temp, rmask
mov cmask, temp2
mov rmask, temp
ldi col, 1
checkBelow16: ;check if within 16 adc counts
ldi temp, high(17)
cpi cmask, low(17)
cpc rmask, temp
brsh checkBelow32
ldi temp2, 0xFF
ldi temp, 0b11 ;for LED
ldi row, 1 ; this means that POSITION is being held
rjmp endCheckIfPotFind
checkBelow32: ;check if within 32 adc counts
clr row ; clear flag (which says we are within 16 ADC)
ldi temp, high(33)
cpi cmask, low(33)
cpc rmask, temp
brsh checkBelow48
ldi temp2, 0xFF
ldi temp, 0b01
rjmp endCheckIfPotFind
checkBelow48: ;check if within 48 adc counts
ldi temp, high(49)
cpi cmask, low(49)
cpc rmask, temp
brsh notWithinAnyBounds
ldi temp2, 0xFF
ldi temp, 0b00
rjmp endCheckIfPotFind
notWithinAnyBounds:
clr temp ;clear these values, as the LED values will be placed in them
clr temp2 ;but they will remain blank for within the set bounds
cpi col, 1
brne endCheckIfPotFind
ldii screenStage, stage_pot_reset
endCheckIfPotFind:
out PORTC, temp2 ;put LED lights on display
out PORTG, temp
endHandleADC:
pop col
pop temp2
pop cmask
pop rmask
pop temp
out SREG, temp
pop temp
reti
|
test/Succeed/Issue4122-yellow.agda | shlevy/agda | 1,989 | 13705 | {-# OPTIONS --prop #-}
data _≡_ {A : Set} (a : A) : A → Set where
refl : a ≡ a
postulate
funextP : {A : Prop} {B : A → Set} {f g : (a : A) → B a} (h : (x : A) → f x ≡ g x) → f ≡ g
test : {A : Prop} {B : A → Set} {f g : (a : A) → B a} (h : (x : A) → f x ≡ g x) → f ≡ g
test h = funextP h
|
programs/oeis/118/A118760.asm | neoneye/loda | 22 | 5553 | ; A118760: A118758(A118758(n)).
; 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72
mov $1,$0
|
base/mvdm/dos/v86/cmd/command/path1.asm | npocmaka/Windows-Server-2003 | 17 | 172557 | page ,132
;/*
; * Microsoft Confidential
; * Copyright (C) Microsoft Corporation 1991
; * All Rights Reserved.
; */
; SCCSID = @(#)path1.asm 1.1 85/05/14
; SCCSID = @(#)path1.asm 1.1 85/05/14
.sall
.xlist
.xcref
include dossym.inc
include syscall.inc
include comsw.asm
include comseg.asm
include comequ.asm
.list
.cref
break <Path.Asm>
;----------------------------------------------------------------------------
; PATH.ASM contains the routines to perform pathname incovation. Path and
; Parse share a temporary buffer and argv[] definitions. <Path_Search>,
; given a pathname, attempts to find a corresponding executable or batch
; file on disk. Directories specified in the user's search path will be
; searched for a matching file, if a match is not found in the current
; directory and if the pathname is actually only an MSDOS filename.
; <Path_Search> assumes that the parsed command name can be found in
; argv[0] -- in other words, <Parseline> should be executed prior to
; <Path_Search>. Alternatively, the command name and appropriate
; information could be placed in argv[0], or <Path_Search> could be
; (easily) modified to make no assumptions about where its input is found.
; Please find enclosed yet another important routine, <Save_Args>, which
; places the entire arg/argv[]/argbuf structure on a piece of newly
; allocated memory. This is handy for for-loop processing, and anything
; else that wants to save the whole shebang and then process other command
; lines.
;
; <NAME>, OS/MSDOS August 15, 1983
;
; ENTRY:
; <Path_Search>: argv[0].
; <Save_Args>: bytes to allocate in addition to arg structure
; EXIT:
; <Path_Search>: success flag, best pathname match in EXECPATH.
; <Save_Args>: success flag, segment address of new memory
; NOTE(S):
; * <Argv_calc> handily turns an array index into an absolute pointer.
; The computation depends on the size of an argv[] element (arg_ele).
; * <Parseline> calls <cparse> for chunks of the command line. <Cparse>
; does not function as specified; see <Parseline> for more details.
; * <Parseline> now knows about the flags the internals of COMMAND.COM
; need to know about. This extra information is stored in a switch_flag
; word with each command-line argument; the switches themselves will not
; appear in the resulting arg structure.
; * With the exception of CARRY, flags are generally preserved across calls.
;---------------
; CONSTANTS:
;---------------
DEBUGx equ FALSE ; prints out debug info
;---------------
; DATA:
;---------------
TRANDATA SEGMENT PUBLIC BYTE ;AC000;
EXTRN baddrv_ptr:word
TRANDATA ENDS
TRANSPACE SEGMENT PUBLIC BYTE ;AC000;
EXTRN arg:byte
EXTRN BADPMES_ptr:word
EXTRN curdrv:byte
EXTRN EXECPATH:byte
EXTRN search_best_buf:byte
EXTRN search_error:word
EXTRN string_ptr_2:word
EXTRN tpbuf:byte
TRANSPACE ENDS
TRANCODE SEGMENT PUBLIC BYTE ;AC000;
assume cs:trangroup, ds:trangroup, es:trangroup, ss:nothing
break <Path_Search>
;------------------------------------------------------------------------------
; PATH_SEARCH tries to find the file it's given, somewhere. An initial value
; of *argv[0].argstartel == 0 implies that there is no command (empty line
; or 'd:' or 'd:/'). This check is done in strip; otherwise, strip formats
; the filename/pathname into tpbuf. Search(tpbuf) is executed to see if we
; have a match, either in the current working directory if we were handed
; a filename, or in the specified directory, given a pathname. If this call
; fails, and we were given a pathname, then Path_Search fails. Otherwise,
; Path_Crunch is repeatedly invoked on tpbuf[STARTEL] (if there's a drive
; prefix, we want to skip it) for each pathstring in userpath. Success on
; either the first invocation of search or on one of the succeeding calls
; sets up the appropriate information for copying the successful pathname
; prefix (if any) into the result buffer, followed by the successful filename
; match (from [search_best_buf]). The result is returned in in EXECPATH.
; ENTRY:
; argv[0] -- command name and associated information
; EXIT:
; AX -- non-zero indicates type of file found
; EXECPATH -- successful pathname (AX non-zero)
; NOTE(S):
; 1) Uses the temporary buffer, tpbuf, from the parse routines.
; 2) Some files are more equal than others. See search: for rankings.
; 3) Path_Search terminates as soon as a call to search succeeds, even
; if search returns an .exe or .bat.
; 5) Clobbers dma address.
pbuflen equ EXECPATHLEN ; len EXECPATH - ntvdm extended
path_sep_char equ ';'
TRANSPACE SEGMENT PUBLIC BYTE ;AC000;
EXTRN fbuf:byte
EXTRN pathinfo:word
EXTRN psep_char:byte
TRANSPACE ENDS
Procedure Path_Search,NEAR
assume ds:trangroup, es:trangroup
push BX
push CX
push DX ; could use a "stack 'em" instruction
push SI
push DI
push BP
pushf
test DS:arg.argv[0].argflags, (MASK wildcard) + (MASK sw_flag)
jz path_search_ok
path_failure_jmp:
jmp path_failure ; ambiguous commands not allowed
path_search_ok:
call store_pchar ; figure out the pathname separator
mov DX, OFFSET TRANGROUP:fbuf ; clobber old dma value with
trap set_dma ; a pointer to our dma buffer
push ES
invoke find_path ; get a handle (ES:DI) on user path
mov DS:pathinfo[0], ES ; and squirrel it away
mov DS:pathinfo[2], DI ; "old" pathstring pointer
mov DS:pathinfo[4], DI ; "new" pathstring pointer
pop ES
mov BX, pbuflen ; copy/format argv[0] into temp buffer
mov SI, OFFSET TRANGROUP:EXECPATH
invoke strip
jc path_failure_jmp ; if possible, of course
mov DX, SI ; search(EXECPATH, error_message)
mov [search_error], OFFSET TRANGROUP:BADDRV_ptr
invoke search ; must do at least one search
or AX, AX ; find anything?
jz path_noinit ; failure ... search farther
mov BP, AX ; success... save filetype code
mov DI, OFFSET TRANGROUP:EXECPATH
mov SI, DS:arg.argv[0].argpointer
mov CX, DS:arg.argv[0].argstartel
sub CX, SI ; compute prefix bytes to copy
;
; We have the number of bytes in the prefix (up to the final component).
; We need to form the complete pathname including leading drive and current
; directory.
;
; Is there a drive letter present?
;
cmp word ptr [si], 05c5ch ; If a UNC name, copy straight in
je CopyPath
mov ah,':'
cmp cx,2 ; room for drive letter?
jb AddDrive ; no, stick it in
cmp [si+1],ah ; colon present?
jz MoveDrive ; yes, just move it
AddDrive:
mov al,curdrv ; get current drive
add al,"A" ; convert to uppercase letter
stosw ; store d:
jmp short CheckPath
MoveDrive:
lodsw ; move d:
stosw
sub cx,2 ; 2 bytes less to move
CheckPath:
or al,20h
mov dl,al
sub dl,"a"-1 ; convert to 1-based for current dir
;
; Stick in beginning path char
;
mov al,psep_char
stosb
;
; Is there a leading /? If so, then no current dir copy is necessary.
; Otherwise, get current dir for DL.
;
cmp cx,1 ; is there room for path char?
jb AddPath ; no, go add path
lodsb
dec cx
cmp al,psep_char ; is there a path separator?
jz MovePath ; yes, go move remainder of path
inc cx
dec si ; undo the lodsb
AddPath:
SaveReg <SI>
mov si,di ; remainder of buffer
trap Current_dir
;
; The previous current dir will succeed a previous find_first already worked.
;
; Find end of string.
;
mov di,si
RestoreReg <SI>
mov al,psep_char
cmp byte ptr [di],0 ; root (empty dir string)?
jz MovePath ; yes, no need for path char
ScanEnd:
cmp byte ptr [dI],0 ; end of string?
jz FoundEnd
inc di
jmp ScanEnd
;
; Stick in a trailing path char
;
FoundEnd:
stosb
;
; Move remaining part of path. Skip leading path char if present.
;
MovePath:
cmp [si],al ; first char a path char?
jnz CopyPath
inc si ; move past leading char
dec cx ; drop from count
CopyPath:
jcxz CopyDone ; no chars to move!
rep movsb
CopyDone:
jmp path_success ; run off and form complete pathname
path_noinit:
test DS:arg.argv[0].argflags, MASK path_sep
jnz path_failure ; complete pathname specified ==> fail
mov BH, path_sep_char ; semicolon terminates pathstring
mov DX, DS:arg.argv[0].argstartel ; this is where the last element starts
sub DX, DS:arg.argv[0].argpointer ; form pointer into EXECPATH,
add DX, OFFSET TRANGROUP:EXECPATH ; skipping over drive spec, if any
path_loop:
call path_crunch ; pcrunch(EXECPATH, pathinfo)
mov BP, AX ; save filetype code
lahf ; save flags, just in case
or BP, BP ; did path_crunch find anything?
jne path_found
sahf ; see? needed those flags, after all!
jnc path_loop ; is there anything left to the path?
path_failure:
xor AX, AX
;; jmp short path_exit ; 3/3/KK
jmp path_exit ;AC000; 3/3/KK
path_found: ; pathinfo[] points to winner
mov DI, OFFSET TRANGROUP:EXECPATH
mov CX, pathinfo[4] ; "new" pointer -- end of string
mov SI, pathinfo[2] ; "old" pointer -- beginning of string
;
; BAS Nov 20/84
; Look at the pathname and expand . and .. if they are the first element
; in the pathname (after the drive letter)
;
push ES
push pathinfo[0]
pop ES
;SR;
; Oops! Gets fooled if path= \;..
; We should also check if a drive letter is really present
;
cmp Byte Ptr ES:[SI+2],'.' ; Look for Current dir at start of path
jnz path_cpy
cmp byte ptr es:[si+1],':' ;does path have drive letter?
jnz path_cpy ;no, copy the path string
push CX ; Save pointer to end of string
mov AL, ES:[SI]
mov [DI],AL ; Copy drive letter, :, and root char
mov AL, ES:[SI+1] ; to EXECPATH
mov [DI+1],AL
mov AL,psep_char
mov [DI+2],AL
push SI ; Save pointer to begining of string
mov DL,ES:[SI] ; Convert device letter for cur dir
or DL,20h
sub DL,"a"-1
mov SI,DI ; pointer to EXECPATH
add SI, 3 ; Don't wipe out drive and root info
trap Current_dir
invoke DStrlen ; Determine length of present info
add SI,CX ; Don't copy over drive and root info
dec SI
mov DI,SI ; Point to end of target string
pop SI ; Restore pointer to begining of string
add SI, 3 ; Point past drive letter, :, .
pop CX ; Restore pointer to end of string
path_cpy:
pop ES
sub CX, SI ; yields character count
push DS ; time to switch segments
push pathinfo[0] ; string lives in this segment
pop DS
cld
;; rep movsb 3/3/KK ; copy the prefix path into EXECPATH
Kloop: ;AN000; 3/3/KK
lodsb ;AN000; 3/3/KK
stosb ;AN000; 3/3/KK
invoke testkanj ;AN000; 3/3/KK
jz NotKanj1 ;AN000; 3/3/KK
dec cx ;AN000; 3/3/KK
JCXZ PopDone ;AN000; Ignore boundary error 3/3/KK
movsb ;AN000; 3/3/KK
dec cx ;AN000; 3/3/KK
cmp cx,1 ;AN000; One char (the terminator) left ? 3/3/KK
ja Kloop ;AN000; no. 3/3/KK
PopDone: ;AN000; 3/3/KK
POP DS ;AN000; Yes ES:DI->terminator, last char is 3/3/KK
mov AL, psep_char ;AN000; KANJI 3/3/KK
jmp Short path_store ;AN000; 3/3/KK
NotKanj1:
loop Kloop
pop DS ; return to our segment
dec DI ; overwrite terminator
mov AL, psep_char ; with a pathname separator
cmp al,byte ptr [di-1]
jz path_success
path_store: ;AN000; 3/3/KK
stosb
path_success:
mov SI, OFFSET TRANGROUP:search_best_buf
xor CX, CX
path_succ_loop:
lodsb ; append winning filename to path
stosb ; (including terminating null)
or al,al
jnz path_succ_loop
mov AX, BP ; retrieve filetype code
path_exit:
popf
pop BP
pop DI
pop SI ; chill out...
pop DX
pop CX
pop BX
ret
EndProc Path_Search
break <Store_Pchar>
;----------------------------------------------------------------------------
; STORE_PCHAR determines the pathname-element separator and squirrels
; it away. In other words, must we say '/bin/ls' or '\bin\ls'?
; ENTRY:
; EXIT:
; NOTE(S):
; * Uses <psep_char>, defined in <path_search>.
;---------------
;---------------
Procedure Store_PChar,NEAR
;---------------
assume ds:trangroup, es:trangroup
push AX
mov AL, '/' ; is the pathname-element separator
invoke pathchrcmp ; a regular slash?
jz store_slash ; if yes, remember slash
mov al,'\'
mov [psep_char], al ; otherwise, remember back-slash
pop ax
ret
store_slash:
mov [psep_char], al
pop ax
return
;---------------
EndProc Store_Pchar
;----------------------------------------------------------------------------
break <Path_Crunch>
;----------------------------------------------------------------------------
; PATH_CRUNCH takes a prefix from a prefix string, and a suffix from
; EXECPATH, and smooshes them into tpbuf. The caller may supply an
; additional separator to use for breaking up the path-string. Null is the
; default. Once the user-string has been formed, search is invoked to see
; what's out there.
; ENTRY:
; BH -- additional terminator character
; SI -- pointer into pathstring to be dissected
; DX -- pointer to stripped filename
; EXIT:
; AX -- non-zero (file type), zero (nothing found)
; SI -- moves along pathstring from call to call
; [search_best_buf] -- name of best file (AX non-zero)
; [tpbuf] -- clobbered
; NOTE(S):
; * Implicit in this code is the ability to specify when to search
; the current directory (if at all) through the PATH defined by
; the user, a la UNIX (e.g., PATH=;c:\bin;c:\etc searches the
; current directory before the bin and etc directories of drive c).
;---------------
Procedure Path_Crunch,NEAR
;---------------
assume ds:trangroup, es:trangroup
push BX
push CX
push DX
push DI
push SI
pushf
call store_pchar ; figure out pathname separator
mov DI, OFFSET TRANGROUP:tpbuf ; destination of concatenated string
mov SI, pathinfo[4] ; "new" pointer to start with
mov pathinfo[2], SI ; becomes "old" pointer
push DS ; save old segment pointer
push pathinfo[0] ; replace with pointer to userpath's
pop DS ; segment
xor cl,cl ;AN000; clear flag for later use 3/3/KK
path_cr_copy:
lodsb ; get a pathname byte
or al,al ; check for terminator(s)
jz path_seg ; null terminates segment & pathstring
cmp AL, BH
jz path_seg ; BH terminates a pathstring segment
invoke testkanj ;AN000; 3/3/KK
jz NotKanj2 ;AN000; 3/3/KK
stosb ;AN000; 3/3/KK
movsb ;AN000; 3/3/KK
MOV CL,1 ;AN000; CL=1 means latest stored char is DBCS 3/3/KK
jmp path_cr_copy ;AN000; 3/3/KK
NotKanj2: ;AN000; 3/3/KK
xor cl,cl ;AN000; CL=0 means latest stored char is SBCS 3/3/KK
stosb ; save byte in concat buffer
jmp path_cr_copy ; loop until we see a terminator
path_seg:
pop DS ; restore old data segment
mov pathinfo[4], SI ; save "new" pointer for next time
mov BL, AL ; remember if we saw null or not...
;;; REMOVE NEXT 3 LINES FOR CURDIR SPEC
xor AX, AX ; in case nothing in pathstr...
cmp DI, OFFSET TRANGROUP:tpbuf ; was there really anything in pathstr?
je path_cr_leave ; if nothing was copied, pathstr empty
path_cr_look: ; form complete pathname
mov al, psep_char ; add pathname separator for suffix
or cl,cl ;AN000; 3/3/KK
jnz path_cr_store ;AN000; this is a trailing byte of ECS code 3/3/KK
cmp al,byte ptr [di-1]
jz path_cr_l1
path_cr_store: ;AN000; 3/3/KK
stosb
path_cr_l1:
mov SI, DX
path_cr_l2:
lodsb ; tack the stripped filename onto
stosb ; the end of the path, up to and
or AL, AL ; including the terminating null
jnz path_cr_l2
mov DX, OFFSET TRANGROUP:tpbuf ; and look for an appropriate file...
mov [search_error], OFFSET TRANGROUP:BADPMES_ptr
invoke search ; results are in AX & search_best_buf
path_cr_leave:
or BL, BL ; did we finish off the pathstring?
jz path_cr_empty ; null in BL means all gone...
popf ; otherwise, plenty left
clc
jmp short path_cr_exit
path_cr_empty:
popf
stc
path_cr_exit:
pop SI
pop DI
pop DX
pop CX
pop BX
ret
;---------------
EndProc Path_Crunch
;----------------------------------------------------------------------------
trancode ends
END
|
pwm led fade/PWM_LED_FADE.asm | magkopian/pic-assembly-examples | 22 | 81643 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Copyright (c) 2013 <NAME> ;
;See the file LICENCE for copying permission. ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; THE FOLLOWING STEPS SHOULD BE TAKEN WHEN CONFIGURING THE CCP MODULE FOR PWM OPERATION: ;
; ;
; 1. SET THE PWM PERIOD BY WRITING TO THE PR2 REGISTER. ;
; 2. SET THE PWM DUTY CYCLE BY WRITING TO THE CCPR1L REGISTER AND CCP1CON<5:4> BITS. ;
; 3. MAKE THE CCP1 PIN AN OUTPUT BY CLEARING THE TRISC<2> BIT. ;
; 4. SET THE TMR2 PRESCALE VALUE AND ENABLE TIMER2 BY WRITING TO T2CON. ;
; 5. CONFIGURE THE CCP1 MODULE FOR PWM OPERATION. ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PROCESSOR '16F876A'
INCLUDE <P16F876A.INC>
__CONFIG _XT_OSC & _WDT_OFF & _PWRTE_OFF & _CP_OFF & _LVP_OFF & _BODEN_OFF
CBLOCK 0x20
D1
D2
FADE_STATE ;IF = 0x00 INCREMENT CCPR1L ELSE DECREMENT CCPR1L
ENDC
ORG 0x0000
INIT:
;PWM PERIOD = [(PR2)+1] * 4 * TOSC * (TMR2 PRESCALE VALUE) ;PR2 = TMR2 PERIOD REGISTER, TOSC = PIC CLOCK PERIOD (FOSC = 1 / TOSC)
;PWM DUTY CYCLE = (CCPR1L:CCP1CON<5:4>) * TOSC * (TMR2 PRESCALE VALUE)
;;;SET PWM FREQUENCY;;;
BSF STATUS, RP0 ;SELECT BANK 01
MOVLW D'128' ;SET PR2 TO 128 DECIMAL SO THE PWM PERIOD = 2064uS => PWM FREQUENCY = 484Hz
MOVWF PR2
BCF STATUS, RP0 ;SELECT BANK 00
;;;SET PWM STARTING DUTY CYCLE;;;
CLRF CCPR1L
MOVLW B'00001100' ;SET PWM MODE, BITS 5 AND 4 ARE THE TWO LSBs OF THE 10BIT DUTY CYCLE REGISTER (CCPR1L:CCP1CON<5:4>)
MOVWF CCP1CON
;;;SET PWM PIN TO OUTPUT MODE;;;
BSF STATUS, RP0 ;SELECT BANK 01
BCF TRISC, 2 ;SET RC2 AS OUTPUT, TO USE FOR PWM
BCF STATUS, RP0 ;SELECT BANK 00
;;;SET TIMER 2 PRESCALE VALUE;;;
;PRESCALE = 16 SO THE PWM PERIOD = 2064uS => PWM FREQUENCY = 484Hz
MOVLW B'00000010'
MOVWF T2CON
;;;CLEAR TIMER 2 MODULE;;;
CLRF TMR2
;;;ENABLE TIMER 2 MODULE;;;
BSF T2CON, TMR2ON
CLRF FADE_STATE
MAIN:
CALL DELAY
MOVLW 0x00
IORWF FADE_STATE, W
BTFSS STATUS, Z ;IF FADE_STATE == 0 GOTO INC_CCPR1L
GOTO DEC_CCPR1L ;ELSE GOTO DEC_CCPR1L
INC_CCPR1L:
INCFSZ CCPR1L ;INCREMENT CCPR1L
GOTO MAIN
GOTO CHANGE_STATE_0 ;IF WE HAVE AN OVERFLOW GOTO CHANGE_STATE
DEC_CCPR1L:
DECFSZ CCPR1L ;DECREMENT CCPR1L
GOTO MAIN
;IF WE HAVE AN OVERFLOW GOTO CHANGE_STATE
CHANGE_STATE:
COMF FADE_STATE, F ;TOGLE FADE_STATE BITS
INCFSZ CCPR1L
GOTO MAIN
CHANGE_STATE_0:
COMF FADE_STATE, F ;TOGLE FADE_STATE BITS
DECFSZ CCPR1L
GOTO MAIN
DELAY
;9993 CYCLES
MOVLW 0xCE
MOVWF D1
MOVLW 0x08
MOVWF D2
DELAY_0
DECFSZ D1, F
GOTO $ + 2
DECFSZ D2, F
GOTO DELAY_0
;3 CYCLES
GOTO $ + 1
NOP
;4 CYCLES (INCLUDING CALL)
RETURN
END
|
oeis/077/A077966.asm | neoneye/loda-programs | 11 | 18295 | ; A077966: Expansion of 1/(1+2*x^2).
; 1,0,-2,0,4,0,-8,0,16,0,-32,0,64,0,-128,0,256,0,-512,0,1024,0,-2048,0,4096,0,-8192,0,16384,0,-32768,0,65536,0,-131072,0,262144,0,-524288,0,1048576,0,-2097152,0,4194304,0,-8388608,0,16777216,0,-33554432,0,67108864,0,-134217728,0,268435456,0,-536870912,0,1073741824,0,-2147483648,0,4294967296,0,-8589934592,0,17179869184,0,-34359738368,0,68719476736,0,-137438953472,0,274877906944,0,-549755813888,0,1099511627776,0,-2199023255552,0,4398046511104,0,-8796093022208,0,17592186044416,0,-35184372088832,0
sub $2,$0
add $0,2
sub $1,$0
sub $1,$2
dif $2,$1
pow $1,$2
mov $0,$1
|
Transynther/x86/_processed/NONE/_ht_/i3-7100_9_0x84_notsx.log_111_1264.asm | ljhsiun2/medusa | 9 | 87881 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r15
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x10bc2, %rcx
nop
nop
nop
nop
cmp $22539, %r14
movl $0x61626364, (%rcx)
xor $26390, %rbp
lea addresses_WT_ht+0x372, %rsi
lea addresses_normal_ht+0x12a72, %rdi
nop
nop
nop
cmp $59667, %r10
mov $105, %rcx
rep movsl
nop
xor %rcx, %rcx
lea addresses_D_ht+0x7252, %r14
nop
xor $5643, %r10
vmovups (%r14), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $1, %xmm5, %rbp
nop
sub $21219, %r10
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r15
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r8
push %rax
push %rbp
push %rcx
// Load
mov $0x52677a00000006ee, %r11
nop
nop
nop
nop
nop
xor $6346, %r12
mov (%r11), %r8
nop
nop
nop
nop
nop
xor $25355, %rax
// Faulty Load
lea addresses_A+0x12b72, %r11
nop
nop
nop
nop
dec %r12
vmovups (%r11), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $1, %xmm5, %rbp
lea oracles, %r11
and $0xff, %rbp
shlq $12, %rbp
mov (%r11,%rbp,1), %rbp
pop %rcx
pop %rbp
pop %rax
pop %r8
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_A', 'same': False, 'size': 16, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_NC', 'same': False, 'size': 8, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_A', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 4, 'congruent': 1, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'49': 106, '46': 5}
49 49 49 49 49 49 49 46 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 46 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 46 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 46 49 49 49 49 49 49 49 49 49 49 49 49 49 46 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49
*/
|
Structure/Operator/Monoid/Submonoid.agda | Lolirofle/stuff-in-agda | 6 | 14028 | module Structure.Operator.Monoid.Submonoid where
import Lvl
open import Logic
open import Logic.Predicate
open import Logic.Predicate.Equiv
open import Sets.PredicateSet renaming (_≡_ to _≡ₛ_)
open import Structure.Setoid
open import Structure.Operator.Monoid
open import Structure.Operator.Properties
open import Structure.Operator
open import Type
private variable ℓ ℓₑ : Lvl.Level
private variable T : Type{ℓ}
module _ {ℓₛ} ⦃ equiv : Equiv{ℓₑ}(T) ⦄ {_▫_ : T → T → T} (M : Monoid(_▫_)) where
record Submonoid (S : PredSet{ℓₛ}(T)) : Stmt{Lvl.of(T) Lvl.⊔ ℓₛ} where
constructor intro
open Monoid(M) using (id)
field
⦃ contains-identity ⦄ : (id ∈ S)
⦃ operator-closure ⦄ : ∀{x y} → ⦃ x ∈ S ⦄ → ⦃ y ∈ S ⦄ → ((x ▫ y) ∈ S)
Object = ∃(S)
_▫ₛ_ : Object → Object → Object
([∃]-intro x) ▫ₛ ([∃]-intro y) = [∃]-intro (x ▫ y)
instance
monoid : Monoid(_▫ₛ_)
BinaryOperator.congruence (Monoid.binary-operator monoid) = congruence₂(_▫_)
Associativity.proof (Monoid.associativity monoid) = associativity(_▫_)
∃.witness (Monoid.identity-existence monoid) = [∃]-intro id
Identityₗ.proof (Identity.left (∃.proof (Monoid.identity-existence monoid))) = identityₗ(_▫_)(id)
Identityᵣ.proof (Identity.right (∃.proof (Monoid.identity-existence monoid))) = identityᵣ(_▫_)(id)
|
src/main/antlr/org/linguamachina/klinguamachina/parser/antlr/LinguaMachina.g4 | 422404/KLinguaMachina | 0 | 3715 | grammar LinguaMachina;
WS: [ \r\t\n]+ -> channel(HIDDEN);
COMMENT: '#' (~'#')* '#' -> channel(HIDDEN);
fragment Digit: [0-9] ;
fragment Ident: [a-zA-Z_][a-zA-Z0-9_]* ;
IntegerLiteral: Digit+ ;
DoubleLiteral:
IntegerLiteral '.' IntegerLiteral 'e' IntegerLiteral
| IntegerLiteral '.' IntegerLiteral
| IntegerLiteral 'e' IntegerLiteral
;
StringLiteral: '"' (('\\' .) | ~'"')* '"';
CharLiteral: '$' ~[ \r\t\n] ;
SymbolLiteral: '\'' [a-zA-Z0-9_$.:/]+ ;
Identifier: Ident;
LowerOrEq: '<=';
GreaterOrEq: '>=';
Lower: '<';
Greater: '>';
Equal: '==';
NotEqual: '!=';
Plus: '+';
Minus: '-';
compOp: LowerOrEq | Lower | GreaterOrEq | Greater;
eqOp: Equal | NotEqual;
arithOp: Plus | Minus;
integerLiteral: IntegerLiteral;
doubleLiteral: DoubleLiteral;
stringLiteral: StringLiteral;
charLiteral: CharLiteral;
symbolLiteral: SymbolLiteral;
identifier: Identifier;
arrayLiteral: '[' (expression (',' expression)*)? ']';
blockLiteral: '{' ('|' params+=Identifier+ '|')? blockStatements? '}';
literal:
integerLiteral
| doubleLiteral
| stringLiteral
| charLiteral
| symbolLiteral
| identifier
| arrayLiteral
| blockLiteral
;
expression: orExpr;
paramExpression: unary;
orExpr: andExpr ('||' andExpr)* ;
andExpr: eqExpr ('&&' eqExpr)* ;
eqExpr: compExpr (eqOp compExpr)? ;
compExpr: arithExpr (compOp arithExpr)? ;
arithExpr: termExpr (arithOp termExpr)* ;
termExpr: factorExpr ('*' factorExpr)* ;
factorExpr: moduloExpr ('/' moduloExpr)* ;
moduloExpr: messageExpr ('%' messageExpr)? ;
parenExpression: '(' expression ')';
atom:
literal
| parenExpression
;
unaryMinus: '-' atom;
unaryNot: '!' atom;
unary:
unaryMinus
| unaryNot
| atom
;
messageExpr: unary messageCascadeOrChain? ;
messageSelector:
(identifier
(':' paramExpression
(identifier ':' paramExpression)*
)?
)
;
messageCascadeOrChain:
messageSelector
| messageChain
| messageCascade
;
messageCascade: messageSelector ('|' messageCascadeOrChainMember)+ ;
messageChain: messageSelector ('|>' messageCascadeOrChainMember)+ ;
messageCascadeOrChainMember:
messageSelector
| '(' messageCascadeOrChain ')'
;
varDeclaration: identifier ':=' expression;
varAssignment: identifier '=' expression;
methodParams:
(keywords+=identifier
(':' params+=identifier
(keywords+=identifier ':' params+=identifier)*
)?
)
;
compileStatement: expression '>>' methodParams '{' blockStatements? '}';
primitiveDeclStatement: expression '::' methodParams '=' symbolLiteral;
localReturn: '<' expression;
nonLocalReturn: '^' expression;
blockStatement:
statement
| localReturn
| nonLocalReturn
;
statement:
expression
| varDeclaration
| varAssignment
| compileStatement
| primitiveDeclStatement
;
blockStatements: blockStatement (';' blockStatement)* ';'? ;
statements: statement (';' statement)* ';'? ;
root: statements EOF;
|
user/initcode.asm | Asy-Tr/xv6-labs-2020 | 0 | 94887 |
user/initcode.o: 文件格式 elf64-littleriscv
Disassembly of section .text:
0000000000000000 <start>:
#include "syscall.h"
# exec(init, argv)
.globl start
start:
la a0, init
0: 00000517 auipc a0,0x0
4: 00050513 mv a0,a0
la a1, argv
8: 00000597 auipc a1,0x0
c: 00058593 mv a1,a1
li a7, SYS_exec
10: 00700893 li a7,7
ecall
14: 00000073 ecall
0000000000000018 <exit>:
# for(;;) exit();
exit:
li a7, SYS_exit
18: 00200893 li a7,2
ecall
1c: 00000073 ecall
jal exit
20: ff9ff0ef jal ra,18 <exit>
0000000000000024 <init>:
24: 696e692f 0x696e692f
28: 0074 addi a3,sp,12
...
000000000000002b <argv>:
...
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_1466.asm | ljhsiun2/medusa | 9 | 1551 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r8
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0xc566, %rsi
lea addresses_WC_ht+0x215e, %rdi
clflush (%rsi)
nop
add %rbp, %rbp
mov $59, %rcx
rep movsl
add %rbx, %rbx
lea addresses_WC_ht+0x16d84, %rsi
lea addresses_WT_ht+0xba86, %rdi
nop
nop
nop
nop
nop
and %r8, %r8
mov $111, %rcx
rep movsq
nop
nop
nop
nop
and $38049, %rbp
lea addresses_A_ht+0x1b0c8, %rbx
nop
nop
nop
nop
nop
add $57795, %rdx
mov (%rbx), %di
nop
nop
nop
nop
and $46490, %rcx
lea addresses_A_ht+0x6fe5, %rdi
nop
nop
nop
nop
add %rbx, %rbx
mov $0x6162636465666768, %r8
movq %r8, (%rdi)
nop
nop
dec %rbp
lea addresses_D_ht+0x10a1e, %rsi
lea addresses_A_ht+0x1899e, %rdi
nop
nop
nop
nop
nop
dec %r8
mov $119, %rcx
rep movsl
nop
sub $62771, %rdi
lea addresses_WT_ht+0x177de, %rbx
nop
xor %rsi, %rsi
mov $0x6162636465666768, %rcx
movq %rcx, (%rbx)
nop
nop
nop
nop
dec %rdx
lea addresses_D_ht+0x14bee, %r8
nop
nop
nop
nop
nop
cmp %rsi, %rsi
mov (%r8), %rdx
nop
nop
nop
nop
sub %r8, %r8
lea addresses_UC_ht+0x1e39e, %rbp
nop
mfence
movb (%rbp), %bl
nop
nop
nop
add %r8, %r8
lea addresses_WT_ht+0x1a19e, %rsi
nop
nop
sub $61115, %rbp
mov $0x6162636465666768, %rdx
movq %rdx, %xmm6
vmovups %ymm6, (%rsi)
nop
xor %r8, %r8
lea addresses_WC_ht+0x915e, %rsi
lea addresses_normal_ht+0x1b79e, %rdi
nop
nop
nop
nop
nop
xor $55969, %r8
mov $113, %rcx
rep movsb
nop
nop
sub $10311, %rdx
lea addresses_UC_ht+0x1c11e, %rsi
lea addresses_WC_ht+0x1eb9e, %rdi
nop
and %r12, %r12
mov $3, %rcx
rep movsw
nop
add $15093, %rdi
lea addresses_WT_ht+0x12b9e, %rdi
and %rbx, %rbx
movb $0x61, (%rdi)
nop
nop
xor $26935, %rbx
lea addresses_A_ht+0x1e59e, %rsi
lea addresses_normal_ht+0x1961e, %rdi
and $49265, %r8
mov $54, %rcx
rep movsl
nop
nop
add $56748, %rbx
lea addresses_normal_ht+0x699e, %rdi
nop
nop
nop
nop
nop
cmp %rbp, %rbp
mov $0x6162636465666768, %rsi
movq %rsi, (%rdi)
nop
nop
nop
add %rcx, %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r8
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r8
push %r9
push %rcx
push %rdi
push %rsi
// Store
lea addresses_WT+0xd99e, %r12
nop
nop
nop
cmp $57779, %r13
movl $0x51525354, (%r12)
add $58123, %r9
// Store
lea addresses_UC+0x19bbe, %r12
xor $19540, %r9
mov $0x5152535455565758, %r13
movq %r13, %xmm1
vmovups %ymm1, (%r12)
nop
nop
sub %r9, %r9
// Load
lea addresses_UC+0x1507e, %rdi
nop
inc %r8
vmovups (%rdi), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $0, %xmm0, %r9
nop
nop
nop
nop
nop
dec %rcx
// Store
lea addresses_A+0x1bbca, %r8
cmp %rcx, %rcx
mov $0x5152535455565758, %r9
movq %r9, %xmm3
movups %xmm3, (%r8)
nop
and $33696, %rsi
// Load
lea addresses_normal+0x17786, %r12
nop
nop
nop
nop
xor $31805, %r8
mov (%r12), %rsi
nop
nop
dec %r12
// Store
mov $0x13919b00000000da, %rcx
nop
nop
xor $48515, %r12
mov $0x5152535455565758, %rsi
movq %rsi, %xmm7
vmovups %ymm7, (%rcx)
nop
nop
xor %rsi, %rsi
// Store
lea addresses_normal+0x1319e, %r13
nop
nop
cmp $3297, %rdi
mov $0x5152535455565758, %rcx
movq %rcx, %xmm5
movaps %xmm5, (%r13)
nop
inc %r8
// Load
lea addresses_US+0x1509e, %r9
nop
nop
sub $42687, %rdi
movups (%r9), %xmm7
vpextrq $0, %xmm7, %rcx
nop
sub %rcx, %rcx
// Store
lea addresses_WT+0x13e2f, %r8
cmp %r9, %r9
movl $0x51525354, (%r8)
nop
nop
nop
nop
nop
sub $4971, %r8
// Faulty Load
lea addresses_RW+0xc99e, %r13
nop
add %r12, %r12
movb (%r13), %cl
lea oracles, %r8
and $0xff, %rcx
shlq $12, %rcx
mov (%r8,%rcx,1), %rcx
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_RW', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_WT', 'size': 4, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_UC', 'size': 32, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_UC', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_A', 'size': 16, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_normal', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_NC', 'size': 32, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_normal', 'size': 16, 'AVXalign': True}}
{'src': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_US', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_WT', 'size': 4, 'AVXalign': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_RW', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': True}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}}
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_A_ht', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False}}
{'src': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 3, 'NT': True, 'type': 'addresses_D_ht', 'size': 8, 'AVXalign': True}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}}
{'src': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'same': True, 'congruent': 8, 'NT': False, 'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': True}}
{'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False}}
{'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
*/
|
Cubical/ZCohomology/Groups/Connected.agda | ayberkt/cubical | 0 | 166 | <reponame>ayberkt/cubical
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.ZCohomology.Groups.Connected where
open import Cubical.ZCohomology.Base
open import Cubical.ZCohomology.Properties
open import Cubical.ZCohomology.Groups.Unit
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.GroupoidLaws
open import Cubical.HITs.SetTruncation renaming (rec to sRec ; elim to sElim ; elim2 to sElim2)
open import Cubical.HITs.PropositionalTruncation renaming (rec to pRec ; ∥_∥ to ∥_∥₁ ; ∣_∣ to ∣_∣₁)
open import Cubical.HITs.Nullification
open import Cubical.Data.Sigma hiding (_×_)
open import Cubical.Data.Int renaming (_+_ to _+ℤ_; +-comm to +ℤ-comm ; +-assoc to +ℤ-assoc)
open import Cubical.Data.Nat
open import Cubical.HITs.Truncation renaming (rec to trRec)
open import Cubical.Algebra.Group
open import Cubical.Homotopy.Connected
open import Cubical.Foundations.Equiv
private
H⁰-connected-type : ∀ {ℓ} {A : Type ℓ} (a : A) → isConnected 2 A → Iso (coHom 0 A) Int
Iso.fun (H⁰-connected-type a con) = sRec isSetInt λ f → f a
Iso.inv (H⁰-connected-type a con) b = ∣ (λ x → b) ∣₂
Iso.rightInv (H⁰-connected-type a con) b = refl
Iso.leftInv (H⁰-connected-type a con) =
sElim (λ _ → isOfHLevelPath 2 setTruncIsSet _ _)
λ f → cong ∣_∣₂ (funExt λ x → trRec (isSetInt _ _) (cong f) (isConnectedPath 1 con a x .fst))
H⁰-connected : ∀ {ℓ} {A : Type ℓ} (a : A) → ((x : A) → ∥ a ≡ x ∥₁) → GroupIso (coHomGr 0 A) intGroup
GroupHom.fun (GroupIso.map (H⁰-connected a con)) = sRec isSetInt (λ f → f a)
GroupHom.isHom (GroupIso.map (H⁰-connected a con)) =
sElim2 (λ _ _ → isProp→isSet (isSetInt _ _)) λ x y → addLemma (x a) (y a)
GroupIso.inv (H⁰-connected a con) b = ∣ (λ _ → b) ∣₂
GroupIso.rightInv (H⁰-connected a con) _ = refl
GroupIso.leftInv (H⁰-connected a con) =
sElim (λ _ → isProp→isSet (setTruncIsSet _ _))
(λ f → cong ∣_∣₂ (funExt λ x → pRec (isSetInt _ _) (cong f) (con x)))
|
src/firmware-tests/Ui/States/Boot/NextStateTest.asm | pete-restall/Cluck2Sesame-Prototype | 1 | 161363 | #include "Mcu.inc"
#include "FarCalls.inc"
#include "Ui.inc"
#include "../../UiStates.inc"
#include "TestFixture.inc"
radix decimal
NextStateTest code
global testArrange
testArrange:
fcall initialiseUi
testAct:
setUiState UI_STATE_BOOT
fcall pollUi
testAssert:
.aliasForAssert uiState, _a
.aliasLiteralForAssert UI_STATE_WAIT_LCDIDLE, _b
.assert "_a == _b, 'Expected uiState == UI_STATE_WAIT_LCDIDLE.'"
return
end
|
gamePlayer.asm | lvcabral/spaceshooter | 5 | 88886 | ;==============================================================================
; Constants
PlayerFrame = 1
PlayerHorizontalSpeed = 2
PlayerVerticalSpeed = 1
PlayerStartXHigh = 0
PlayerStartXLow = 175
PlayerStartY = 229
PlayerXMinHigh = 0 ; 0*256 + 24 = 24 minX
PlayerXMinLow = 24
PlayerXMaxHigh = 1 ; 1*256 + 64 = 320 maxX
PlayerXMaxLow = 64
PlayerYMin = 229 ;180
PlayerYMax = 229
;===============================================================================
; Variables
playerSprite byte 0
playerXHigh byte PlayerStartXHigh
playerXLow byte PlayerStartXLow
playerY byte PlayerStartY
playerXChar byte 0
playerXOffset byte 0
playerYChar byte 0
playerYOffset byte 0
playerActive byte False
;===============================================================================
; Macros/Subroutines
gamePlayerInit
LIBSPRITE_MULTICOLORENABLE_AV playerSprite, True
rts
;==============================================================================
gamePlayerReset
lda #True
sta playerActive
LIBSPRITE_SETFRAME_AV playerSprite, PlayerFrame
LIBSPRITE_SETCOLOR_AV playerSprite, LightGray
lda #PlayerStartXHigh
sta playerXHigh
lda #PlayerStartXLow
sta PlayerXLow
lda #PlayerStartY
sta PlayerY
LIBSPRITE_SETPOSITION_AAAA playerSprite, playerXHigh, playerXLow, playerY
rts
;===============================================================================
gamePlayerUpdate
lda playerActive
beq gPUSkip
jsr gamePlayerUpdatePosition
jsr gamePlayerUpdateFiring
jsr gamePlayerUpdateCollisions
gPUSkip
rts
;==============================================================================
gamePlayerUpdateCollisions
GAMEBULLETS_COLLIDED playerXChar, playerYChar, False
beq gPUCNocollision
lda #False
sta playerActive
; run explosion animation
LIBSPRITE_SETCOLOR_AV playerSprite, Yellow
LIBSPRITE_PLAYANIM_AVVVV playerSprite, 4, 15, 3, False
; play explosion sound
LIBSOUND_PLAY_VAA 1, soundExplosionHigh, soundExplosionLow
jsr gameFlowPlayerDied
gPUCNocollision
rts
;==============================================================================
gamePlayerUpdateFiring
; do fire after the ship has been clamped to position
; so that the bullet lines up
LIBINPUT_GETFIREPRESSED
bne gPUFNofire
; fire the bullet
GAMEBULLETS_FIRE_AAAVV playerXChar, playerXOffset, playerYChar, White, 1
; play the firing sound
LIBSOUND_PLAY_VAA 0, soundFiringHigh, soundFiringLow
gPUFNofire
rts
;===============================================================================
gamePlayerUpdatePosition
LIBINPUT_GETHELD GameportLeftMask
bne gPUPRight
LIBMATH_SUB16BIT_AAVVAA playerXHigh, PlayerXLow, 0, PlayerHorizontalSpeed, playerXHigh, PlayerXLow
gPUPRight
LIBINPUT_GETHELD GameportRightMask
bne gPUPUp
LIBMATH_ADD16BIT_AAVVAA playerXHigh, PlayerXLow, 0, PlayerHorizontalSpeed, playerXHigh, PlayerXLow
gPUPUp
LIBINPUT_GETHELD GameportUpMask
bne gPUPDown
LIBMATH_SUB8BIT_AVA PlayerY, PlayerVerticalSpeed, PlayerY
gPUPDown
LIBINPUT_GETHELD GameportDownMask
bne gPUPEndmove
LIBMATH_ADD8BIT_AVA PlayerY, PlayerVerticalSpeed, PlayerY
gPUPEndmove
; clamp the player x position
LIBMATH_MIN16BIT_AAVV playerXHigh, playerXLow, PlayerXMaxHigh, PLayerXMaxLow
LIBMATH_MAX16BIT_AAVV playerXHigh, playerXLow, PlayerXMinHigh, PLayerXMinLow
; clamp the player y position
LIBMATH_MIN8BIT_AV playerY, PlayerYMax
LIBMATH_MAX8BIT_AV playerY, PlayerYMin
; set the sprite position
LIBSPRITE_SETPOSITION_AAAA playerSprite, playerXHigh, PlayerXLow, PlayerY
; update the player char positions
LIBSCREEN_PIXELTOCHAR_AAVAVAAAA playerXHigh, playerXLow, 12, playerY, 40, playerXChar, playerXOffset, playerYChar, playerYOffset
rts
|
src/interrupt/interrupt.asm | Ericsii/Erics-OS | 2 | 103596 | <filename>src/interrupt/interrupt.asm
# 保存上下文
.altmacro
# 寄存器宽度
.set REG_SIZE, 8
# 上下文大小
.set CONTEXT_SIZE, 34
# 自定义宏
# 保存寄存器
.macro SAVE reg, offset
sd \reg, \offset * 8(sp)
.endm
.macro SAVE_N n
SAVE x\n, \n
.endm
# 栈中恢复寄存器
.macro LOAD reg, offset
ld \reg, \offset * 8(sp)
.endm
.macro LOAD_N n
LOAD x\n, \n
.endm
.section .text
.globl __interrupt # 定义 __interrupt 入口
__interrupt:
# 申请栈空间
addi sp, sp, -34 * 8
# 保存寄存器 x1 (先保存 x1 为了之后保存 sp 寄存器)
SAVE x1, 1
# 保存 sp 寄存器
addi x1, sp, 34 * 8
SAVE x1, 2
# 循环保存 x3-x31
.set n, 3
.rept 29
SAVE_N %n
.set n, n + 1
.endr
# 保存 CSR
csrr s1, sstatus
csrr s2, sepc
SAVE s1, 32
SAVE s2, 33
# 调用 handle_interrupt 函数
# context: $mut Context
mv a0, sp
# scause: Scause
csrr a1, scause
# stval: usize
csrr a2, stval
jal handle_interrupt
# 离开中断恢复现场
.globl __restore
__restore:
# 恢复 CSR
LOAD s1, 32
LOAD s2, 33
csrw sstatus, s1
csrw sepc, s2
# 恢复 universal 寄存器
LOAD x1, 1
.set n, 3
.rept 29
LOAD_N %n
.set n, n + 1
.endr
# 恢复 sp
LOAD sp, 2
sret
|
src/apsepp-generic_fixture-creator.adb | thierr26/ada-apsepp | 0 | 22276 | <gh_stars>0
-- Copyright (C) 2019 <NAME> <<EMAIL>>
-- MIT license. Please refer to the LICENSE file.
with Apsepp.Generic_Shared_Instance.Creator;
package body Apsepp.Generic_Fixture.Creator is
----------------------------------------------------------------------------
function Alloc return Shared_Instance.Instance_Type_Access
is (Shared_Instance.Instance_Type_Access (Allocate));
----------------------------------------------------------------------------
package Shared_Instance_Creator is new Shared_Instance.Creator
(Allocate => Alloc,
Just_Pretend => Just_Pretend);
----------------------------------------------------------------------------
function Has_Actually_Created return Boolean
is (Shared_Instance_Creator.Has_Actually_Created);
----------------------------------------------------------------------------
end Apsepp.Generic_Fixture.Creator;
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_382.asm | ljhsiun2/medusa | 9 | 91261 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r9
push %rax
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_D_ht+0x1199, %rsi
lea addresses_UC_ht+0xf45, %rdi
clflush (%rsi)
nop
nop
inc %rdx
mov $123, %rcx
rep movsw
nop
nop
nop
nop
nop
xor $911, %rax
lea addresses_normal_ht+0xdfb9, %r12
xor %rbx, %rbx
mov $0x6162636465666768, %rax
movq %rax, %xmm1
vmovups %ymm1, (%r12)
nop
nop
nop
and %rsi, %rsi
lea addresses_A_ht+0x15f6d, %rsi
add $49145, %rbx
mov (%rsi), %rdx
nop
mfence
lea addresses_WT_ht+0xe0d9, %rsi
nop
sub $26808, %rdi
mov (%rsi), %r12
nop
nop
nop
add %rdi, %rdi
lea addresses_normal_ht+0xc80a, %rsi
lea addresses_normal_ht+0x19a99, %rdi
nop
nop
nop
nop
nop
inc %r9
mov $3, %rcx
rep movsq
nop
nop
xor %r12, %r12
lea addresses_normal_ht+0xb1d9, %rsi
lea addresses_WC_ht+0x1cff1, %rdi
nop
nop
nop
nop
nop
sub $38667, %r12
mov $28, %rcx
rep movsq
nop
nop
nop
xor %rdx, %rdx
lea addresses_A_ht+0xb1b9, %rbx
nop
nop
sub %rsi, %rsi
mov $0x6162636465666768, %r12
movq %r12, %xmm7
vmovups %ymm7, (%rbx)
and %rax, %rax
lea addresses_WC_ht+0x1c3f9, %rsi
lea addresses_WC_ht+0x55d1, %rdi
clflush (%rsi)
nop
nop
nop
nop
inc %r12
mov $85, %rcx
rep movsw
nop
nop
nop
xor $15970, %r12
lea addresses_UC_ht+0xb199, %rdx
nop
nop
nop
nop
nop
cmp $7870, %rax
movl $0x61626364, (%rdx)
nop
nop
nop
and $29646, %r9
lea addresses_WT_ht+0x18699, %rcx
nop
nop
nop
nop
nop
xor $17836, %rdx
mov $0x6162636465666768, %rdi
movq %rdi, (%rcx)
xor $48893, %rsi
lea addresses_WC_ht+0xe1dd, %rbx
xor $7322, %rdi
movw $0x6162, (%rbx)
nop
nop
nop
cmp $24119, %rsi
lea addresses_normal_ht+0x17d99, %r12
nop
nop
nop
nop
dec %rdx
mov (%r12), %r9w
nop
nop
xor $25770, %r9
lea addresses_UC_ht+0x5999, %rsi
lea addresses_WT_ht+0x11599, %rdi
clflush (%rdi)
nop
nop
cmp $33536, %rbx
mov $108, %rcx
rep movsl
cmp %r12, %r12
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r9
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r14
push %rbp
push %rcx
push %rdi
push %rsi
// Store
lea addresses_A+0x14069, %rsi
nop
nop
inc %r10
mov $0x5152535455565758, %r14
movq %r14, %xmm5
vmovups %ymm5, (%rsi)
nop
nop
nop
nop
cmp $5459, %r14
// Load
lea addresses_WC+0x65f1, %r13
nop
and %rsi, %rsi
mov (%r13), %r10
nop
nop
nop
nop
nop
xor $7676, %rcx
// Store
lea addresses_PSE+0xfb99, %r10
nop
nop
nop
and %rdi, %rdi
mov $0x5152535455565758, %rcx
movq %rcx, (%r10)
add %r10, %r10
// Faulty Load
lea addresses_WC+0x3199, %r13
nop
nop
nop
nop
inc %rsi
movups (%r13), %xmm2
vpextrq $1, %xmm2, %rbp
lea oracles, %rsi
and $0xff, %rbp
shlq $12, %rbp
mov (%rsi,%rbp,1), %rbp
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r14
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_WC', 'same': False, 'size': 1, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_A', 'same': False, 'size': 32, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC', 'same': False, 'size': 8, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_PSE', 'same': False, 'size': 8, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_WC', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 32, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 8, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 8, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 4, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 8, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 2, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 2, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': True}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM'}
{'38': 21829}
38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38
*/
|
test.asm | Adsorion-Collection/As-Sorion | 0 | 103674 | no equ #x38
STORE $x100 no
SHL REG2h #39
JMPEQ REG1h
hello:
ADD $x100 #3320 |
word_parameters.ads | ddugovic/words | 4 | 8133 | <gh_stars>1-10
with TEXT_IO;
package WORD_PARAMETERS is
-- This package defines a number of parameters that areused in the program
-- The default values are set in the body, so that they may be changed easily
CHANGE_PARAMETERS_CHARACTER : CHARACTER := '#';
CHANGE_LANGUAGE_CHARACTER : CHARACTER := '~';
HELP_CHARACTER : CHARACTER := '?';
-- These files are used by the program if requested, but not necessary
-- They are all text files and human readable
-- MODE_FILE is used by the program to remember MODE values between runs
MODE_FILE : TEXT_IO.FILE_TYPE;
-- OUTPUT is used to write out and save the results of a run
OUTPUT : TEXT_IO.FILE_TYPE;
INPUT : TEXT_IO.FILE_TYPE;
-- UNKNOWNS is used to record the words that the program fails to find
UNKNOWNS : TEXT_IO.FILE_TYPE;
-- This is a flag to tell if there has been trimming for this word
TRIMMED : BOOLEAN := FALSE;
type MODE_TYPE is (
TRIM_OUTPUT,
HAVE_OUTPUT_FILE,
WRITE_OUTPUT_TO_FILE,
DO_UNKNOWNS_ONLY,
WRITE_UNKNOWNS_TO_FILE,
IGNORE_UNKNOWN_NAMES,
IGNORE_UNKNOWN_CAPS,
DO_COMPOUNDS,
DO_FIXES,
DO_TRICKS,
DO_DICTIONARY_FORMS,
SHOW_AGE,
SHOW_FREQUENCY,
DO_EXAMPLES,
DO_ONLY_MEANINGS,
DO_STEMS_FOR_UNKNOWN );
package MODE_TYPE_IO is new TEXT_IO.ENUMERATION_IO(MODE_TYPE);
type MODE_ARRAY is array (MODE_TYPE) of BOOLEAN;
WORDS_MODE : MODE_ARRAY; -- Initialized in body
procedure CHANGE_PARAMETERS;
procedure INITIALIZE_WORD_PARAMETERS;
end WORD_PARAMETERS;
|
oeis/341/A341885.asm | neoneye/loda-programs | 11 | 246153 | ; A341885: a(n) is the sum of A000217(p) over the prime factors p of n, counted with multiplicity.
; Submitted by <NAME>
; 0,3,6,6,15,9,28,9,12,18,66,12,91,31,21,12,153,15,190,21,34,69,276,15,30,94,18,34,435,24,496,15,72,156,43,18,703,193,97,24,861,37,946,72,27,279,1128,18,56,33,159,97,1431,21,81,37,196,438,1770,27,1891,499,40,18,106,75,2278,159,282,46,2556,21,2701,706,36,196,94,100,3160,27,24,864,3486,40,168,949,441,75,4005,30,119,282,502,1131,205,21,4753,59,78,36
lpb $0
mov $2,$0
seq $2,6530 ; Gpf(n): greatest prime dividing n, for n >= 2; a(1)=1.
div $0,$2
add $1,$2
pow $2,2
add $1,$2
lpe
mov $0,$1
div $0,2
|
programs/oeis/022/A022269.asm | karttu/loda | 1 | 105052 | <reponame>karttu/loda
; A022269: a(n) = n*(11*n+1)/2.
; 0,6,23,51,90,140,201,273,356,450,555,671,798,936,1085,1245,1416,1598,1791,1995,2210,2436,2673,2921,3180,3450,3731,4023,4326,4640,4965,5301,5648,6006,6375,6755,7146,7548,7961,8385,8820,9266,9723,10191,10670,11160,11661,12173,12696,13230,13775,14331,14898,15476,16065,16665,17276,17898,18531,19175,19830,20496,21173,21861,22560,23270,23991,24723,25466,26220,26985,27761,28548,29346,30155,30975,31806,32648,33501,34365,35240,36126,37023,37931,38850,39780,40721,41673,42636,43610,44595,45591,46598,47616,48645,49685,50736,51798,52871,53955,55050,56156,57273,58401,59540,60690,61851,63023,64206,65400,66605,67821,69048,70286,71535,72795,74066,75348,76641,77945,79260,80586,81923,83271,84630,86000,87381,88773,90176,91590,93015,94451,95898,97356,98825,100305,101796,103298,104811,106335,107870,109416,110973,112541,114120,115710,117311,118923,120546,122180,123825,125481,127148,128826,130515,132215,133926,135648,137381,139125,140880,142646,144423,146211,148010,149820,151641,153473,155316,157170,159035,160911,162798,164696,166605,168525,170456,172398,174351,176315,178290,180276,182273,184281,186300,188330,190371,192423,194486,196560,198645,200741,202848,204966,207095,209235,211386,213548,215721,217905,220100,222306,224523,226751,228990,231240,233501,235773,238056,240350,242655,244971,247298,249636,251985,254345,256716,259098,261491,263895,266310,268736,271173,273621,276080,278550,281031,283523,286026,288540,291065,293601,296148,298706,301275,303855,306446,309048,311661,314285,316920,319566,322223,324891,327570,330260,332961,335673,338396,341130
mul $0,-11
bin $0,2
mov $1,$0
div $1,11
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/iface_test.adb | best08618/asylo | 7 | 9464 | <gh_stars>1-10
-- { dg-do compile }
package body Iface_Test is
protected SQLite_Safe is
function Prepare_Select
(DB : DT_1;
Iter : Standard.Iface_Test.Iface_2'Class)
return Standard.Iface_Test.Iface_2'Class;
end;
overriding procedure Prepare_Select
(DB : DT_1;
Iter : in out Standard.Iface_Test.Iface_2'Class)
is
begin
Iter := SQLite_Safe.Prepare_Select (DB, Iter); -- test
end;
protected body SQLite_Safe is
function Prepare_Select
(DB : DT_1;
Iter : Standard.Iface_Test.Iface_2'Class)
return Standard.Iface_Test.Iface_2'Class
is
begin
return Iter;
end;
end;
end;
|
tests/glfw2/glfw_test.ads | Roldak/OpenGLAda | 0 | 22343 | <gh_stars>0
-- part of OpenGLAda, (c) 2017 <NAME>
-- released under the terms of the MIT license, see the file "COPYING"
with Glfw.Events.Keys;
package Glfw_Test is
procedure Key_To_Title (Subject : Glfw.Events.Keys.Key;
Action : Glfw.Events.Button_State);
end Glfw_Test;
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_3146.asm | ljhsiun2/medusa | 9 | 240236 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r14
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x1c6aa, %rsi
lea addresses_UC_ht+0xb15a, %rdi
nop
add %r9, %r9
mov $3, %rcx
rep movsl
nop
nop
nop
nop
cmp %r11, %r11
lea addresses_D_ht+0x365a, %rbp
nop
nop
nop
and $42192, %r14
vmovups (%rbp), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $0, %xmm3, %rdi
nop
cmp $12877, %r11
lea addresses_A_ht+0xee5a, %rdi
nop
inc %rbp
movb $0x61, (%rdi)
nop
and $65105, %rdi
lea addresses_normal_ht+0x1441a, %rsi
lea addresses_WT_ht+0x12d5a, %rdi
nop
nop
nop
nop
sub $33587, %r12
mov $122, %rcx
rep movsl
nop
nop
nop
cmp $46424, %r12
lea addresses_normal_ht+0x141ca, %rdi
nop
nop
nop
cmp $61321, %r14
mov (%rdi), %rcx
nop
nop
nop
nop
and %rsi, %rsi
lea addresses_WT_ht+0x634a, %r12
nop
nop
sub $50485, %r14
movb $0x61, (%r12)
nop
inc %rcx
lea addresses_WC_ht+0x1ce7a, %rsi
lea addresses_WT_ht+0x1bab7, %rdi
clflush (%rdi)
nop
nop
cmp %rbp, %rbp
mov $76, %rcx
rep movsb
nop
nop
nop
xor $65359, %rsi
lea addresses_WC_ht+0x19bda, %r11
clflush (%r11)
nop
cmp $19456, %r14
mov (%r11), %r9
nop
nop
nop
xor $35157, %r14
lea addresses_WT_ht+0xb25a, %r11
nop
nop
nop
nop
dec %rbp
mov (%r11), %rdi
nop
sub %rsi, %rsi
lea addresses_UC_ht+0x18c5a, %r9
nop
cmp $2285, %rcx
mov (%r9), %r12d
nop
nop
nop
add %rcx, %rcx
lea addresses_WC_ht+0xb8da, %rsi
lea addresses_UC_ht+0x12b5a, %rdi
nop
nop
nop
xor %r11, %r11
mov $32, %rcx
rep movsb
nop
nop
nop
sub $47014, %rbp
lea addresses_UC_ht+0x1ae5a, %rsi
lea addresses_WC_ht+0x10e5a, %rdi
nop
cmp $21272, %rbp
mov $35, %rcx
rep movsb
nop
add %rsi, %rsi
lea addresses_normal_ht+0x17f3a, %r14
nop
nop
nop
inc %r9
mov (%r14), %ecx
nop
nop
inc %rbp
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r14
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r15
push %r8
push %r9
push %rbx
push %rdx
// Faulty Load
lea addresses_normal+0xe5a, %r15
nop
nop
nop
nop
add %r9, %r9
mov (%r15), %bx
lea oracles, %rdx
and $0xff, %rbx
shlq $12, %rbx
mov (%rdx,%rbx,1), %rbx
pop %rdx
pop %rbx
pop %r9
pop %r8
pop %r15
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_normal', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_normal', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 1, 'congruent': 10, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 8, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 1, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 8, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 8, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 4, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': True}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
oeis/016/A016745.asm | neoneye/loda-programs | 11 | 168489 | ; A016745: a(n) = (2*n)^5.
; 0,32,1024,7776,32768,100000,248832,537824,1048576,1889568,3200000,5153632,7962624,11881376,17210368,24300000,33554432,45435424,60466176,79235168,102400000,130691232,164916224,205962976,254803968,312500000,380204032,459165024,550731776,656356768,777600000,916132832,1073741824,1252332576,1453933568,1680700000,1934917632,2219006624,2535525376,2887174368,3276800000,3707398432,4182119424,4704270176,5277319168,5904900000,6590815232,7339040224,8153726976,9039207968,10000000000,11040808032,12166529024
mul $0,2
pow $0,5
|
libsrc/stdio/__printf_handle_x.asm | Toysoft/z88dk | 8 | 174310 |
MODULE __printf_handle_x
SECTION code_clib
PUBLIC __printf_handle_x
PUBLIC __printf_handle_p
EXTERN __printf_number
__printf_handle_x:
__printf_handle_p:
ld c,0 ;unsigned
ld (ix-9),16
res 1,(ix-4) ;disable '+' flag
jp __printf_number
|
a/assembler_6502appleII.asm | venusing1998/hello-world | 3 | 19261 | STROUT EQU $DB3A ;OUTPUTS AY-POINTED NULL TERMINATED STRING
LDY #>HELLO
LDA #<HELLO
JMP STROUT
HELLO ASC "HELLO WORLD!",00
|
test/Fail/Issue278.agda | shlevy/agda | 1,989 | 8546 | {-# OPTIONS --warning=error #-}
module Issue278 where
open import Agda.Builtin.Equality
abstract
module A where
Foo : Set₁
Foo = Set
module B where
open A
Foo≡Set : Foo ≡ Set
Foo≡Set = refl
|
Universe/Trunc/TypeConstructors.agda | sattlerc/HoTT-Agda | 0 | 3535 | {-# OPTIONS --without-K #-}
{- In this module, we derive the truncations of
* a truncated type,
* the unit type,
* dependent sums (and product types),
* path spaces
given truncations of their components.
More commonly later on, we will be given a truncation operator Tr
that returns a truncation for any given input type (at a fixed level).
Instead of trying to show, say,
Tr (Σ A (B ∘ cons (Tr A))) ≃ Σ (Tr A) (Tr ∘ B),
directly, it turns out to be much easier to just *derive* the truncation on
the left-hand side from Tr A and Tr ∘ B and then use unicity of truncation to
deduce the above equivalence. Significant parts of the unicity proof would be
duplicated in any direct proof of equivalence, while this approach allows us
to avoid a number of manual elimination and propositional reduction steps. -}
module Universe.Trunc.TypeConstructors where
open import lib.Basics
open import lib.NType2
open import lib.Equivalences2
open import lib.types.Unit
open import lib.types.Nat hiding (_+_)
open import lib.types.Pi
open import lib.types.Sigma
open import lib.types.Paths
open import Universe.Utility.General
open import Universe.Utility.TruncUniverse
open import Universe.Trunc.Universal
open import Universe.Trunc.Basics
open trunc-ty
open trunc-props
module trunc-self {i} {n : ℕ₋₂} (A : n -Type i) where
trunc : ∀ {j} → trunc-ty n ⟦ A ⟧ j
trunc = record
{ type = A
; cons = idf _
; univ = λ _ → snd (ide _) }
module trunc-⊤ {n : ℕ₋₂} = trunc-self {n = n} ⊤-≤
-- *** Lemma 6.9 ***
{- The truncation of a dependent sum type (where the family depends
only on the truncation of the first component) is the dependent sums
of the truncations. -}
module trunc-Σ {ia ib j} {n : ℕ₋₂} {A : Type ia}
(TrA : trunc-ty n A (ia ⊔ ib ⊔ j))
{B : ⟦ type TrA ⟧ → Type ib}
(TrB : (ta : ⟦ type TrA ⟧) → trunc-ty n (B ta) (ib ⊔ j)) where
trunc : trunc-ty n (Σ A (B ∘ cons TrA)) (ib ⊔ j)
trunc = record
{ type = Σ-≤ (type TrA) (type ∘ TrB)
; cons = λ {(a , b) → (cons TrA a , cons (TrB (cons TrA a)) b)}
; univ = snd ∘ e } where
e : (U : n -Type _) → _
e U =
(⟦ Σ-≤ (type TrA) (type ∘ TrB) ⟧ → ⟦ U ⟧) ≃⟨ curry-equiv ⟩
((ta : ⟦ type TrA ⟧) → ⟦ type (TrB ta) ⟧ → ⟦ U ⟧) ≃⟨ equiv-Π-r eb ⟩
((ta : ⟦ type TrA ⟧) → B ta → ⟦ U ⟧) ≃⟨ ea ⟩
((a : A) → B (cons TrA a) → ⟦ U ⟧) ≃⟨ curry-equiv ⁻¹ ⟩
(Σ A (B ∘ cons TrA) → ⟦ U ⟧) ≃∎ where
ea = dup {j = ib ⊔ j} TrA (λ ta → B ta →-≤ U)
eb = λ ta → up {j = ib ⊔ j} (TrB ta) U
-- Products are a special case of dependent sums.
module trunc-× {ia ib j} {n : ℕ₋₂} {A : Type ia} {B : Type ib}
(TrA : trunc-ty n A (ia ⊔ ib ⊔ j))
(TrB : trunc-ty n B (ib ⊔ j)) =
trunc-Σ {j = j} TrA (λ _ → TrB)
-- *** Lemma 6.10 ***
{- The n-truncation of a path space is the path space of the (n+1)-truncation.
The use of the encode-decode method is the reason why we have to assume
elimination into Type (lsucc i): large recursion is used to define
the type of codes. -}
module trunc-path {i j} {n : ℕ₋₂} {A : Type i} (TrA : trunc-ty (S n) A (lsucc (i ⊔ j))) where
private
l : ULevel
l = i ⊔ j
TrAA : trunc-ty (S n) (A × A) (lsucc l)
TrAA = trunc-×.trunc {j = lsucc l} TrA TrA
module MA = trunc-props {j = lsucc l} {k = l} TrA
module MAA = trunc-props {j = lsucc l} {k = l} TrAA
-- module MAL = trunc-elim {j = _} TrAA
{- There is some Yoneda hidden here that would enable us to express the final
equivalence e neatly as a sequence of trivial steps like in trunc-Σ;
unfortunately we lack the necessary category theoretic framework
in this code base. -}
module code (U : n -Type l) where
abstract
{- Large recursion used here.
Since we cannot talk about the truncation of a₀ == a₁ yet,
we instead talk about the continuation type (a₀ == a₁ → U) → U
for any n-type U instead. -}
code : ⟦ type TrAA ⟧ → n -Type l
code = rec {j = lsucc l} TrAA (n -Type-≤ l)
(λ {(a₀ , a₁) → (a₀ == a₁ → ⟦ U ⟧) →-≤ U})
code-β : {a₀ a₁ : A} → ⟦ code (cons TrAA (a₀ , a₁)) ⟧
≃ ((a₀ == a₁ → ⟦ U ⟧) → ⟦ U ⟧)
code-β = coe-equiv (ap ⟦_⟧ (rec-β TrAA _))
-- We can encode a path in the truncation, ...
encode : {ta₀ ta₁ : ⟦ type TrA ⟧} → ta₀ == ta₁ → ⟦ code (ta₀ , ta₁) ⟧
encode idp = MA.elim (λ ta → raise (code (ta , ta)))
(λ _ → <– code-β (λ f → f idp)) _
--- ...reducing when coming from a path in the original type.
encode-β : {a₀ a₁ : A} (p : a₀ == a₁) (f : a₀ == a₁ → ⟦ U ⟧)
→ –> code-β (encode (ap (cons TrA) p)) f == f p
encode-β idp = app= (ap (–> code-β) (MA.elim-β _) ∙ <–-inv-r code-β _)
-- We can decode into the U-continuation of a path in the truncation, ...
decode : {ta₀ ta₁ : ⟦ type TrA ⟧}
→ ⟦ code (ta₀ , ta₁) ⟧ → (ta₀ == ta₁ → ⟦ U ⟧) → ⟦ U ⟧
decode = MAA.elim
(λ {(ta₀ , ta₁) → _ →-≤ (ta₀ == ta₁ → ⟦ U ⟧) →-≤ raise U})
(λ _ c g → –> code-β c (g ∘ ap (cons TrA))) _ where
-- ...reducing
decode-β : {a₀ a₁ : A} (c : ⟦ code (cons TrAA (a₀ , a₁)) ⟧)
(g : cons TrA a₀ == cons TrA a₁ → ⟦ U ⟧)
→ decode c g == –> code-β c (g ∘ ap (cons TrA))
decode-β = app= ∘ app= (MAA.elim-β _)
-- encoding followed by decoding produces the expected continuation
decode-encode : {ta₀ ta₁ : ⟦ type TrA ⟧} (q : ta₀ == ta₁)
(g : ta₀ == ta₁ → ⟦ U ⟧) → decode (encode q) g == g q
decode-encode idp = MA.elim
(λ ta → Π-≤ (ta == ta → ⟦ U ⟧)
(λ g → Path-≤ (raise U) (decode (encode idp) g) (g idp)))
(λ _ g → decode-β (encode idp) g ∙ encode-β idp (g ∘ ap (cons TrA))) _
trunc : (a₀ a₁ : A) → trunc-ty n (a₀ == a₁) l
trunc a₀ a₁ = record
{ type = Path-< (type TrA) (cons TrA a₀) (cons TrA a₁)
; cons = ap (cons TrA)
; univ = snd ∘ e } where
e : (U : _) → (cons TrA a₀ == cons TrA a₁ → ⟦ U ⟧) ≃ (a₀ == a₁ → ⟦ U ⟧)
e U = equiv u v u-v v-u where
open code U
u : (cons TrA a₀ == cons TrA a₁ → ⟦ U ⟧) → a₀ == a₁ → ⟦ U ⟧
u g = g ∘ ap (cons TrA)
v : (a₀ == a₁ → ⟦ U ⟧) → cons TrA a₀ == cons TrA a₁ → ⟦ U ⟧
v f q = –> code-β (encode q) f
u-v : (f : a₀ == a₁ → ⟦ U ⟧) → u (v f) == f
u-v f = λ= (λ p → encode-β p f)
v-u : (g : cons TrA a₀ == cons TrA a₁ → ⟦ U ⟧) → v (u g) == g
v-u g = λ= (λ q → ! (decode-β (encode q) g) ∙ decode-encode q g)
|
oeis/323/A323409.asm | neoneye/loda-programs | 11 | 87320 | ; A323409: Greatest common divisor of Product (p_i^e_i)-1 and n, when n = Product (p_i^e_i); a(n) = gcd(n, A047994(n)).
; Submitted by <NAME>
; 1,1,1,1,1,2,1,1,1,2,1,6,1,2,1,1,1,2,1,4,3,2,1,2,1,2,1,2,1,2,1,1,1,2,1,12,1,2,3,4,1,6,1,2,1,2,1,6,1,2,1,4,1,2,5,14,3,2,1,12,1,2,3,1,1,2,1,4,1,2,1,8,1,2,3,2,1,6,1,20,1,2,1,12,1,2,1,2,1,2,1,2,3,2,1,2,1,2,1,4
mov $2,$0
seq $0,47994 ; Unitary totient (or unitary phi) function uphi(n).
mov $1,$0
add $2,1
gcd $1,$2
mov $0,$1
|
libsrc/_DEVELOPMENT/arch/zx/display/c/sccz80/zx_saddrcright.asm | meesokim/z88dk | 0 | 3075 |
; void *zx_saddrcright(void *saddr)
SECTION code_arch
PUBLIC zx_saddrcright
zx_saddrcright:
INCLUDE "arch/zx/display/z80/asm_zx_saddrcright.asm"
|
platforms/m3/prc_v12/debug/FLSv1L_test2/FLSv1L_test2.asm | lab11/M-ulator | 19 | 99560 | <filename>platforms/m3/prc_v12/debug/FLSv1L_test2/FLSv1L_test2.asm
FLSv1L_test2/FLSv1L_test2.elf: file format elf32-littlearm
Disassembly of section .text:
00000000 <hang-0x80>:
0: 00002000 .word 0x00002000
4: 00000091 .word 0x00000091
...
10: 00000080 .word 0x00000080
14: 00000080 .word 0x00000080
18: 00000080 .word 0x00000080
1c: 00000080 .word 0x00000080
20: 00000080 .word 0x00000080
24: 00000080 .word 0x00000080
28: 00000080 .word 0x00000080
2c: 00000000 .word 0x00000000
30: 00000080 .word 0x00000080
34: 00000080 .word 0x00000080
...
00000080 <hang>:
80: e7fe b.n 80 <hang>
...
00000090 <_start>:
90: f000 f802 bl 98 <main>
94: e7fc b.n 90 <_start>
Disassembly of section .text.startup.main:
00000098 <main>:
98: b570 push {r4, r5, r6, lr}
9a: 4a08 ldr r2, [pc, #32] ; (bc <main+0x24>)
9c: 4908 ldr r1, [pc, #32] ; (c0 <main+0x28>)
9e: 4809 ldr r0, [pc, #36] ; (c4 <main+0x2c>)
a0: 4d09 ldr r5, [pc, #36] ; (c8 <main+0x30>)
a2: 2400 movs r4, #0
a4: 2623 movs r6, #35 ; 0x23
a6: 23fa movs r3, #250 ; 0xfa
a8: 6011 str r1, [r2, #0]
aa: 009b lsls r3, r3, #2
ac: 6004 str r4, [r0, #0]
ae: 602e str r6, [r5, #0]
b0: 46c0 nop ; (mov r8, r8)
b2: 3b01 subs r3, #1
b4: 2b00 cmp r3, #0
b6: d1fb bne.n b0 <main+0x18>
b8: e7f5 b.n a6 <main+0xe>
ba: 46c0 nop ; (mov r8, r8)
bc: a0002000 .word 0xa0002000
c0: aa000032 .word 0xaa000032
c4: a0002004 .word 0xa0002004
c8: a000200c .word 0xa000200c
|
libsrc/math/daimath32/c/sccz80/l_f32_yes.asm | ahjelm/z88dk | 640 | 171071 |
SECTION code_fp_dai32
PUBLIC l_f32_yes
l_f32_yes:
ld hl,1
scf
ret
|
Applications/iTunes/is_paused.applescript | looking-for-a-job/applescript-examples | 1 | 2361 | <reponame>looking-for-a-job/applescript-examples<filename>Applications/iTunes/is_paused.applescript
#!/usr/bin/osascript
on is_paused(state)
considering case
return (state is "paused") or ("kPSp" is in state)
end considering
end is_paused |
engine/gfx/sprite_anims.asm | Dev727/ancientplatinum | 28 | 80931 | <filename>engine/gfx/sprite_anims.asm
DoAnimFrame:
ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID
add hl, bc
ld e, [hl]
ld d, 0
ld hl, .Jumptable
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp hl
.Jumptable:
; entries correspond to SPRITE_ANIM_SEQ_* constants
dw .Null
dw .PartyMon
dw .PartyMonSwitch
dw .PartyMonSelected
dw .GSTitleTrail
dw .NamingScreenCursor
dw .GameFreakLogo
dw .GSIntroStar
dw .GSIntroSparkle
dw .SlotsGolem
dw .SlotsChansey
dw .SlotsChanseyEgg
dw .MailCursor
dw .UnusedCursor
dw .DummyGameCursor
dw .PokegearArrow
dw .TradePokeBall
dw .TradeTubeBulge
dw .TrademonInTube
dw .RevealNewMon
dw .RadioTuningKnob
dw .CutLeaves
dw .FlyFrom
dw .FlyLeaf
dw .FlyTo
dw .GSIntroHoOh
dw .EZChatCursor
dw .MobileTradeSentPulse
dw .MobileTradeOTPulse
dw .IntroSuicune
dw .IntroPichuWooper
dw .Celebi
dw .IntroUnown
dw .IntroUnownF
dw .IntroSuicuneAway
.Null:
ret
.PartyMon
ld a, [wMenuCursorY]
ld hl, SPRITEANIMSTRUCT_INDEX
add hl, bc
cp [hl]
jr z, .PartyMonSwitch
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld [hl], 8 * 2
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], $0
ret
.PartyMonSwitch
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld [hl], 8 * 3
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
ld d, a
inc [hl]
and $f
ret nz
ld hl, SPRITEANIMSTRUCT_0D
add hl, bc
ld e, [hl]
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld a, d
and $10 ; bit 4
jr z, .load_zero
ld a, e
and a
jr z, .load_minus_two
cp $1
jr z, .load_minus_one
.load_zero
xor a
ld [hl], a
ret
.load_minus_one
ld a, -1
ld [hl], a
ret
.load_minus_two
ld a, -2
ld [hl], a
ret
.PartyMonSelected
ld a, [wMenuCursorY]
ld hl, SPRITEANIMSTRUCT_INDEX
add hl, bc
cp [hl]
jr z, .three_offset_right
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld [hl], 8 * 2
ret
.three_offset_right
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld [hl], 8 * 3
ret
.GSTitleTrail
call .AnonymousJumptable
jp hl
; Anonymous dw (see .AnonymousJumptable)
dw .four_zero
dw .four_one
.four_zero
call .IncrementJumptableIndex
ld hl, SPRITEANIMSTRUCT_INDEX
add hl, bc
ld a, [hl]
ld hl, SPRITEANIMSTRUCT_0D
add hl, bc
and $3
ld [hl], a
inc [hl]
swap a
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld [hl], a
.four_one
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $a4
jr nc, .asm_8d356
ld hl, SPRITEANIMSTRUCT_0D
add hl, bc
add $4
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld [hl], a
ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
inc [hl]
ld hl, SPRITEANIMSTRUCT_0D
add hl, bc
ld a, [hl]
sla a
sla a
ld d, $2
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
add $3
ld [hl], a
call .Sprites_Sine
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
ret
.asm_8d356
call DeinitializeSprite
ret
.GSIntroHoOh
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
inc a
ld [hl], a
ld d, $2
call .Sprites_Sine
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
ret
.NamingScreenCursor
callfar NamingScreen_AnimateCursor
ret
.MailCursor
callfar ComposeMail_AnimateCursor
ret
.GameFreakLogo:
callfar GameFreakLogoJumper
ret
.GSIntroStar
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
and a
jr z, .asm_8d3ba
dec [hl]
dec [hl]
ld d, a
and $1f
jr nz, .asm_8d395
ld hl, SPRITEANIMSTRUCT_0D
add hl, bc
dec [hl]
.asm_8d395
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld a, [hl]
push af
push de
call .Sprites_Sine
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop de
pop af
call .Sprites_Cosine
ld hl, SPRITEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ld hl, SPRITEANIMSTRUCT_0D
add hl, bc
ld a, [hl]
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
add [hl]
ld [hl], a
ret
.asm_8d3ba
ld a, $1
ld [wcf64], a
call DeinitializeSprite
ret
.GSIntroSparkle
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hli]
or [hl]
jr z, .asm_8d41e
ld hl, SPRITEANIMSTRUCT_0F
add hl, bc
ld d, [hl]
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld a, [hl]
push af
push de
call .Sprites_Sine
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop de
pop af
call .Sprites_Cosine
ld hl, SPRITEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
ld hl, SPRITEANIMSTRUCT_0E
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
add hl, de
ld e, l
ld d, h
ld hl, SPRITEANIMSTRUCT_0E
add hl, bc
ld [hl], e
inc hl
ld [hl], d
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
ld de, -$10
add hl, de
ld e, l
ld d, h
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld [hl], e
inc hl
ld [hl], d
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld a, [hl]
xor $20
ld [hl], a
ret
.asm_8d41e
call DeinitializeSprite
ret
.SlotsGolem:
callfar Slots_AnimateGolem
ret
.SlotsChansey:
callfar Slots_AnimateChansey
ld hl, wcf64
ld a, [hl]
cp $2
ret nz
ld [hl], $3
ld a, SPRITE_ANIM_FRAMESET_SLOTS_CHANSEY_2
call _ReinitSpriteAnimFrame
ret
.SlotsChanseyEgg:
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld a, [hl]
dec [hl]
ld e, a
and $1
jr z, .move_vertical
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp 15 * 8
jr c, .move_right
call DeinitializeSprite
ld a, $4
ld [wcf64], a
ld de, SFX_PLACE_PUZZLE_PIECE_DOWN
call PlaySFX
ret
.move_right
inc [hl]
.move_vertical
ld a, e
ld d, $20
call .Sprites_Sine
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
ret
.UnusedCursor
callfar ret_e00ed
ret
.PokegearArrow
callfar AnimatePokegearModeIndicatorArrow
ret
.DummyGameCursor
callfar DummyGame_InterpretJoypad_AnimateCursor
ret
.TradePokeBall
call .AnonymousJumptable
jp hl
; Anonymous dw (see .AnonymousJumptable)
dw .TradePokeBall_zero
dw .TradePokeBall_one
dw .TradePokeBall_two
dw .TradePokeBall_three
dw .TradePokeBall_four
dw .TradePokeBall_five
.TradePokeBall_zero
ld a, SPRITE_ANIM_FRAMESET_TRADE_POKE_BALL_WOBBLE
call _ReinitSpriteAnimFrame
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld [hl], $2
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld [hl], $20
ret
.TradePokeBall_two
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
and a
jr z, .asm_8d4af
dec [hl]
ret
.asm_8d4af
call .IncrementJumptableIndex
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld [hl], $40
.TradePokeBall_three
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
cp $30
jr c, .asm_8d4cd
dec [hl]
ld d, $28
call .Sprites_Sine
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
ret
.asm_8d4cd
ld de, SFX_GOT_SAFARI_BALLS
call PlaySFX
jr .TradePokeBall_five
.TradePokeBall_one
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld [hl], $4
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld [hl], $30
ld hl, SPRITEANIMSTRUCT_0D
add hl, bc
ld [hl], $24
ret
.TradePokeBall_four
ld hl, SPRITEANIMSTRUCT_0D
add hl, bc
ld a, [hl]
and a
jr z, .asm_8d51c
ld d, a
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
call Sprites_Sine
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
inc [hl]
ld a, [hl]
and $3f
ret nz
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld [hl], $20
ld hl, SPRITEANIMSTRUCT_0D
add hl, bc
ld a, [hl]
sub $c
ld [hl], a
ld de, SFX_SWITCH_POKEMON
call PlaySFX
ret
.asm_8d51c
xor a
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
call .IncrementJumptableIndex
ret
.TradePokeBall_five
call DeinitializeSprite
ret
.TradeTubeBulge
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
inc [hl]
inc [hl]
cp $b0
jr nc, .delete
and $3
ret nz
ld de, SFX_POKEBALLS_PLACED_ON_TABLE
call PlaySFX
ret
.delete
call DeinitializeSprite
ret
.TrademonInTube
callfar TradeAnim_AnimateTrademonInTube
ret
.RevealNewMon:
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
cp $80
jr nc, .finish_EggShell
ld d, a
add $8
ld [hl], a
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld a, [hl]
xor $20
ld [hl], a
push af
push de
call .Sprites_Sine
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop de
pop af
call .Sprites_Cosine
ld hl, SPRITEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ret
.finish_EggShell
call DeinitializeSprite
ret
.RadioTuningKnob:
callfar AnimateTuningKnob
ret
.CutLeaves
ld hl, SPRITEANIMSTRUCT_0D
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
ld hl, $80
add hl, de
ld e, l
ld d, h
ld hl, SPRITEANIMSTRUCT_0D
add hl, bc
ld [hl], e
inc hl
ld [hl], d
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
inc [hl]
inc [hl]
inc [hl]
push af
push de
call .Sprites_Sine
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop de
pop af
call .Sprites_Cosine
ld hl, SPRITEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ret
.FlyFrom:
ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
ld a, [hl]
and a
ret z
ld hl, SPRITEANIMSTRUCT_0D
add hl, bc
ld a, [hl]
inc [hl]
cp $40
ret c
ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
dec [hl]
dec [hl]
ld hl, SPRITEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld d, a
cp $40
jr nc, .skip
add $8
ld [hl], a
.skip
ld hl, SPRITEANIMSTRUCT_0E
add hl, bc
ld a, [hl]
inc [hl]
call .Sprites_Cosine
ld hl, SPRITEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ret
.FlyLeaf:
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp -9 * 8
jr nc, .delete_leaf
inc [hl]
inc [hl]
ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
dec [hl]
ld d, $40
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
inc [hl]
call .Sprites_Cosine
ld hl, SPRITEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ret
.delete_leaf
call DeinitializeSprite
ret
.FlyTo:
ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
ld a, [hl]
cp 10 * 8 + 4
ret z
ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
inc [hl]
inc [hl]
ld hl, SPRITEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
ld d, a
and a
jr z, .asm_8d621
sub $2
ld [hl], a
.asm_8d621
ld hl, SPRITEANIMSTRUCT_0E
add hl, bc
ld a, [hl]
inc [hl]
call .Sprites_Cosine
ld hl, SPRITEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ret
.MobileTradeSentPulse
farcall Function108bc7
ret
.MobileTradeOTPulse
farcall Function108be0
ret
.IntroSuicune
ld a, [wIntroSceneTimer]
and a
jr nz, .asm_8d645
ret
.asm_8d645
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], $0
ld hl, SPRITEANIMSTRUCT_0D
add hl, bc
ld a, [hl]
add $2
ld [hl], a
xor $ff
inc a
ld d, $20
call .Sprites_Sine
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
ld a, SPRITE_ANIM_FRAMESET_INTRO_SUICUNE_2
call _ReinitSpriteAnimFrame
ret
.IntroPichuWooper
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
cp $14
jr nc, .asm_8d67f
add $2
ld [hl], a
xor $ff
inc a
ld d, $20
call .Sprites_Sine
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
.asm_8d67f
ret
.IntroUnown
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld d, [hl]
inc [hl]
inc [hl]
inc [hl]
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
push af
push de
call .Sprites_Sine
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop de
pop af
call .Sprites_Cosine
ld hl, SPRITEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ret
.IntroUnownF
ld a, [wcf64]
cp $40
ret nz
ld a, SPRITE_ANIM_FRAMESET_INTRO_UNOWN_F_2
call _ReinitSpriteAnimFrame
ret
.IntroSuicuneAway
ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
ld a, [hl]
add $10
ld [hl], a
ret
.EZChatCursor
farcall AnimateEZChatCursor
ret
.Celebi
farcall UpdateCelebiPosition
ret
.AnonymousJumptable:
ld hl, sp+$0
ld e, [hl]
inc hl
ld d, [hl]
inc de
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld l, [hl]
ld h, $0
add hl, hl
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ret
.IncrementJumptableIndex:
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
inc [hl]
ret
.Sprites_Sine:
call Sprites_Sine
ret
.Sprites_Cosine:
call Sprites_Cosine
ret
|
src/helios-tools-files.adb | stcarrez/helios | 1 | 11094 | <gh_stars>1-10
-----------------------------------------------------------------------
-- helios-tools-files -- File parsing utilities for Helios
-- Copyright (C) 2017 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Log.Loggers;
package body Helios.Tools.Files is
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Helios.Tools.Files");
-- ------------------------------
-- Open the file and prepare for the extraction.
-- ------------------------------
procedure Open (File : in out File_Extractor;
Path : in String) is
begin
Log.Info ("Open file {0}", Path);
Ada.Text_IO.Open (File => File.File,
Mode => Ada.Text_IO.In_File,
Name => Path);
File.Is_Opened := True;
end Open;
-- ------------------------------
-- Returns True if we are at end of the file.
-- ------------------------------
function Is_Eof (File : in File_Extractor) return Boolean is
begin
return Ada.Text_IO.End_Of_File (File.File);
end Is_Eof;
-- ------------------------------
-- Returns true if the line named field matches the given name.
-- ------------------------------
function Is_Field (File : in File_Extractor;
Name : in String) return Boolean is
Pos : constant Natural := File.Name_Pos;
begin
if File.Field_Count < Pos then
return False;
else
return File.Line (File.Field_Start (Pos) .. File.Field_End (Pos)) = Name;
end if;
end Is_Field;
-- ------------------------------
-- Get the value of the field at the given position.
-- ------------------------------
function Get_Value (File : in File_Extractor;
Pos : in Positive) return Uint64 is
begin
return Uint64'Value (File.Line (File.Field_Start (Pos) .. File.Field_End (Pos)));
end Get_Value;
-- ------------------------------
-- Get the value of the field at the given position.
-- ------------------------------
function Get_Value (File : in File_Extractor;
Pos : in Positive) return String is
begin
return File.Line (File.Field_Start (Pos) .. File.Field_End (Pos));
end Get_Value;
-- ------------------------------
-- Read one line and prepare for extraction.
-- ------------------------------
procedure Read (File : in out File_Extractor) is
Pos : Positive := 1;
Last : Natural := 0;
Field_Pos : Natural := 0;
Line : constant String := Ada.Text_IO.Get_Line (File.File);
begin
Last := (if Line'Last > File.Line'Last then File.Line'Last else Line'Last);
File.Line (1 .. Last) := Line (1 .. Last);
while Pos <= Last and Field_Pos < File.Count loop
while Pos <= Last and then Line (Pos) in ' ' | ASCII.HT loop
Pos := Pos + 1;
end loop;
exit when Pos > Last;
Field_Pos := Field_Pos + 1;
File.Field_Start (Field_Pos) := Pos;
while Pos <= Last and then not (Line (Pos) in ' ' | ASCII.HT) loop
Pos := Pos + 1;
end loop;
if Line (Pos - 1) = ':' then
File.Field_End (Field_Pos) := Pos - 2;
else
File.Field_End (Field_Pos) := Pos - 1;
end if;
end loop;
File.Field_Count := Field_Pos;
end Read;
-- ------------------------------
-- Close the file.
-- ------------------------------
overriding
procedure Finalize (File : in out File_Extractor) is
begin
if File.Is_Opened then
Ada.Text_IO.Close (File.File);
end if;
end Finalize;
end Helios.Tools.Files;
|
tests/parsing/numeric_constants_invalid.asm | cizo2000/sjasmplus | 220 | 91472 | ;; invalid numeric literals errors
;; missing digits
DD #
;DD $ => is actual valid syntax for current address pointer
DD 0x
DD %
;; hard 32b overflow
DD 0xFFFFFFFF ; OK
DD 0x100000000 ; overflow error
DD %11111111111111111111111111111111 ; OK
DD %100000000000000000000000000000000 ; overflow error
DD 37777777777o ; OK
DD 40000000000o ; overflow error
DD 4294967295 ; OK
DD 4294967296 ; overflow error
;; digit out of base
DD 12A0
DD 12A0d
DD 0FFGFh
DD 0xFFGF
DD $FFGF
DD #FFGF
DD 1002001b
DD 01002001b
DD %1002001
DD %01002001
DD 12834q
DD 12834o
|
sources/ada_pretty.ads | reznikmm/adaside | 4 | 1857 | -- Copyright (c) 2017 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with League.String_Vectors;
with League.Strings;
private with League.Pretty_Printers;
package Ada_Pretty is
type Node is abstract tagged private;
type Node_Access is access constant Node'Class;
type Node_Access_Array is array (Positive range <>) of not null Node_Access;
type Factory is tagged private;
not overriding function To_Text
(Self : access Factory;
Unit : not null Node_Access)
return League.String_Vectors.Universal_String_Vector;
-- Compilation units
not overriding function New_Compilation_Unit
(Self : access Factory;
Root : not null Node_Access;
Clauses : Node_Access := null;
License : League.Strings.Universal_String :=
League.Strings.Empty_Universal_String) return not null Node_Access;
not overriding function New_Subunit
(Self : access Factory;
Parent_Name : not null Node_Access;
Proper_Body : not null Node_Access) return not null Node_Access;
-- Node lists
not overriding function New_List
(Self : access Factory;
List : Node_Access_Array) return not null Node_Access;
not overriding function New_List
(Self : access Factory;
Head : Node_Access;
Tail : not null Node_Access) return not null Node_Access;
-- Add a Tail item to a Head list. Head could be
-- * a null value, that means an empty list. Result is Tail then.
-- * a non-list node, that means a list with single node inside.
-- * a list of items.
-- Clauses, Pragmas and Aspects
not overriding function New_Aspect
(Self : access Factory;
Name : not null Node_Access;
Value : Node_Access := null) return not null Node_Access;
not overriding function New_Pragma
(Self : access Factory;
Name : not null Node_Access;
Arguments : Node_Access := null;
Comment : League.Strings.Universal_String :=
League.Strings.Empty_Universal_String) return not null Node_Access;
not overriding function New_Use
(Self : access Factory;
Name : not null Node_Access;
Use_Type : Boolean := False) return not null Node_Access;
not overriding function New_With
(Self : access Factory;
Name : not null Node_Access;
Is_Limited : Boolean := False;
Is_Private : Boolean := False) return not null Node_Access;
-- Declarations
not overriding function New_Package
(Self : access Factory;
Name : not null Node_Access;
Public_Part : Node_Access := null;
Private_Part : Node_Access := null;
Comment : League.Strings.Universal_String :=
League.Strings.Empty_Universal_String) return not null Node_Access;
not overriding function New_Package_Body
(Self : access Factory;
Name : not null Node_Access;
List : Node_Access := null) return not null Node_Access;
not overriding function New_Package_Instantiation
(Self : access Factory;
Name : not null Node_Access;
Template : not null Node_Access;
Actual_Part : Node_Access := null;
Comment : League.Strings.Universal_String :=
League.Strings.Empty_Universal_String) return not null Node_Access;
not overriding function New_Parameter
(Self : access Factory;
Name : not null Node_Access;
Type_Definition : not null Node_Access;
Initialization : Node_Access := null;
Is_In : Boolean := False;
Is_Out : Boolean := False;
Is_Aliased : Boolean := False;
Comment : League.Strings.Universal_String :=
League.Strings.Empty_Universal_String) return not null Node_Access;
not overriding function New_Subprogram_Body
(Self : access Factory;
Specification : not null Node_Access;
Declarations : Node_Access := null;
Statements : Node_Access := null;
Exceptions : Node_Access := null) return not null Node_Access;
not overriding function New_Subprogram_Declaration
(Self : access Factory;
Specification : not null Node_Access;
Aspects : Node_Access := null;
Is_Abstract : Boolean := False;
Is_Null : Boolean := False;
Expression : Node_Access := null;
Renamed : Node_Access := null;
Comment : League.Strings.Universal_String :=
League.Strings.Empty_Universal_String) return not null Node_Access;
not overriding function New_Subtype
(Self : access Factory;
Name : not null Node_Access;
Definition : not null Node_Access;
Constrain : Node_Access := null;
Comment : League.Strings.Universal_String :=
League.Strings.Empty_Universal_String) return not null Node_Access;
not overriding function New_Type
(Self : access Factory;
Name : not null Node_Access;
Discriminants : Node_Access := null;
Definition : Node_Access := null;
Aspects : Node_Access := null;
Comment : League.Strings.Universal_String :=
League.Strings.Empty_Universal_String) return not null Node_Access;
not overriding function New_Variable
(Self : access Factory;
Name : not null Node_Access;
Type_Definition : Node_Access := null;
Initialization : Node_Access := null;
Rename : Node_Access := null;
Is_Constant : Boolean := False;
Is_Aliased : Boolean := False;
Aspects : Node_Access := null;
Comment : League.Strings.Universal_String :=
League.Strings.Empty_Universal_String) return not null Node_Access;
-- Definitions
type Access_Modifier is (Access_All, Access_Constant, Unspecified);
not overriding function New_Access
(Self : access Factory;
Modifier : Access_Modifier := Unspecified;
Target : not null Node_Access) return not null Node_Access;
not overriding function New_Derived
(Self : access Factory;
Parent : not null Node_Access) return not null Node_Access;
not overriding function New_Null_Exclusion
(Self : access Factory;
Definition : not null Node_Access;
Exclude : Boolean := True) return not null Node_Access;
not overriding function New_Interface
(Self : access Factory;
Is_Limited : Boolean := False;
Parents : Node_Access := null) return not null Node_Access;
not overriding function New_Private_Record
(Self : access Factory;
Is_Tagged : Boolean := False;
Is_Limited : Boolean := False;
Parents : Node_Access := null) return not null Node_Access;
not overriding function New_Record
(Self : access Factory;
Parent : Node_Access := null;
Components : Node_Access := null;
Is_Abstract : Boolean := False;
Is_Tagged : Boolean := False;
Is_Limited : Boolean := False) return not null Node_Access;
not overriding function New_Array
(Self : access Factory;
Indexes : not null Node_Access;
Component : not null Node_Access) return not null Node_Access;
type Trilean is (False, True, Unspecified);
not overriding function New_Subprogram_Specification
(Self : access Factory;
Is_Overriding : Trilean := Unspecified;
Name : Node_Access := null;
Parameters : Node_Access := null;
Result : Node_Access := null) return not null Node_Access;
-- Expressions and Names
not overriding function New_Apply
(Self : access Factory;
Prefix : not null Node_Access;
Arguments : not null Node_Access) return not null Node_Access;
-- This node represent construction in form 'prefix (arguments)'
-- This includes function_call, indexed_component, slice,
-- subtype_indication, etc
not overriding function New_Qualified_Expession
(Self : access Factory;
Prefix : not null Node_Access;
Argument : not null Node_Access) return not null Node_Access;
not overriding function New_Infix
(Self : access Factory;
Operator : League.Strings.Universal_String;
Left : not null Node_Access) return not null Node_Access;
not overriding function New_Literal
(Self : access Factory;
Value : Natural;
Base : Positive := 10) return not null Node_Access;
not overriding function New_Name
(Self : access Factory;
Name : League.Strings.Universal_String) return not null Node_Access;
-- Identifier, character literal ('X'), operator ("<")
not overriding function New_Selected_Name
(Self : access Factory;
Name : League.Strings.Universal_String) return not null Node_Access;
not overriding function New_Selected_Name
(Self : access Factory;
Prefix : not null Node_Access;
Selector : not null Node_Access) return not null Node_Access;
not overriding function New_String_Literal
(Self : access Factory;
Text : League.Strings.Universal_String) return not null Node_Access;
not overriding function New_Parentheses
(Self : access Factory;
Child : not null Node_Access) return not null Node_Access;
not overriding function New_Argument_Association
(Self : access Factory;
Value : not null Node_Access;
Choice : Node_Access := null) return not null Node_Access;
not overriding function New_Component_Association
(Self : access Factory;
Value : not null Node_Access;
Choices : Node_Access := null) return not null Node_Access;
not overriding function New_If_Expression
(Self : access Factory;
Condition : not null Node_Access;
Then_Path : not null Node_Access;
Elsif_List : Node_Access := null;
Else_Path : Node_Access := null) return not null Node_Access;
-- Statements and Paths
not overriding function New_Assignment
(Self : access Factory;
Left : not null Node_Access;
Right : not null Node_Access) return not null Node_Access;
not overriding function New_Case
(Self : access Factory;
Expression : not null Node_Access;
List : not null Node_Access) return not null Node_Access;
not overriding function New_Case_Path
(Self : access Factory;
Choice : not null Node_Access;
List : not null Node_Access) return not null Node_Access;
not overriding function New_Elsif
(Self : access Factory;
Condition : not null Node_Access;
List : not null Node_Access) return not null Node_Access;
not overriding function New_If
(Self : access Factory;
Condition : not null Node_Access;
Then_Path : not null Node_Access;
Elsif_List : Node_Access := null;
Else_Path : Node_Access := null) return not null Node_Access;
not overriding function New_For
(Self : access Factory;
Name : not null Node_Access;
Iterator : not null Node_Access;
Statements : not null Node_Access) return not null Node_Access;
not overriding function New_Loop
(Self : access Factory;
Condition : Node_Access;
Statements : not null Node_Access) return not null Node_Access;
not overriding function New_Return
(Self : access Factory;
Expression : Node_Access := null) return not null Node_Access;
not overriding function New_Extended_Return
(Self : access Factory;
Name : not null Node_Access;
Type_Definition : not null Node_Access;
Initialization : Node_Access := null;
Statements : not null Node_Access) return not null Node_Access;
not overriding function New_Statement
(Self : access Factory;
Expression : Node_Access := null) return not null Node_Access;
not overriding function New_Block
(Self : access Factory;
Declarations : Node_Access := null;
Statements : Node_Access := null;
Exceptions : Node_Access := null) return not null Node_Access;
private
type Node is abstract tagged null record;
not overriding function Document
(Self : Node;
Printer : not null access League.Pretty_Printers.Printer'Class;
Pad : Natural)
return League.Pretty_Printers.Document;
not overriding function Max_Pad (Self : Node) return Natural is (0);
-- Return maximum lengh of name in Node
not overriding function Join
(Self : Node;
List : Node_Access_Array;
Pad : Natural;
Printer : not null access League.Pretty_Printers.Printer'Class)
return League.Pretty_Printers.Document;
-- Join documents of several nodes in a list
type Expression is abstract new Node with null record;
overriding function Join
(Self : Expression;
List : Node_Access_Array;
Pad : Natural;
Printer : not null access League.Pretty_Printers.Printer'Class)
return League.Pretty_Printers.Document;
type Declaration is abstract new Node with null record;
overriding function Join
(Self : Declaration;
List : Node_Access_Array;
Pad : Natural;
Printer : not null access League.Pretty_Printers.Printer'Class)
return League.Pretty_Printers.Document;
-- Declarations are separated by an extra new line
type Factory is tagged null record;
function Print_Aspect
(Aspect : Node_Access;
Printer : not null access League.Pretty_Printers.Printer'Class)
return League.Pretty_Printers.Document;
end Ada_Pretty;
|
programs/oeis/199/A199421.asm | karttu/loda | 1 | 178345 | ; A199421: (5*7^n+1)/2.
; 3,18,123,858,6003,42018,294123,2058858,14412003,100884018,706188123,4943316858,34603218003,242222526018,1695557682123,11868903774858,83082326424003,581576284968018,4071033994776123,28497237963432858
mov $1,7
pow $1,$0
div $1,6
mul $1,15
add $1,3
|
programs/oeis/111/A111601.asm | neoneye/loda | 22 | 8476 | ; A111601: Exponential (binomial) convolution of A001818 (with interspersed zeros) and A000142 (factorials).
; 1,2,9,36,225,1350,11025,88200,893025,8930250,108056025,1296672300,18261468225,255660555150,4108830350625,65741285610000,1187451971330625,21374135483951250,428670161650355625,8573403233007112500
add $0,1
mov $1,$0
lpb $0
mov $2,$0
sub $0,1
mod $2,2
add $2,$0
mul $1,$2
lpe
mov $0,$1
|
programs/oeis/048/A048496.asm | neoneye/loda | 22 | 21226 | <reponame>neoneye/loda
; A048496: a(n) = 2^(n-1)*(3*n-4) + 3.
; 1,2,7,23,67,179,451,1091,2563,5891,13315,29699,65539,143363,311299,671747,1441795,3080195,6553603,13893635,29360131,61865987,130023427,272629763,570425347,1191182339,2483027971,5167382531,10737418243,22280142851,46170898435,95563022339,197568495619,408021893123,841813590019,1735166787587,3573412790275,7352984010755,15118284881923,31061203484675,63771674411011,130841883705347,268280837177347,549755813888003,1125899906842627,2304576371818499,4714705859903491,9640517952339971,19703248369745923,40250921669623811,82190693199511555,167759086119550979,342273571680157699,698057942242426883,1423137482249076739,2900318160026599427,5908722711110090755,12033618204333965315,24499581972895498243,49863855074246131715,101457092405402533891,206372949324625608707,419663427676892299267,853161913409066762243,1733993942928697851907,3523328118078524358659,7157336700599306027011,14536034330083126673411,29514790517935282585603,59915024751408623648771,121600936933893364252675,246743648729938962415619,500570847184182392651779,1015308793816973720944643,2058951786531165313171459,4174571970856766368907267,8462480737302404222943235,17151635065782551416143875,34756617313920588772802563,70419928992552149426634755,142653246714526242615328771,288933270887896372754776067,585120096693480520557789187,1184747303222336591212052483,2398508826115424282617053187,4855046091572350765620002819,9826149061827705932011798531,19884411881021420665567182851,40233051276774858934221537283,81394557583013753074617417731,164646025224955576561583521795,333005870567767293947864416259,673439381371246869545123577859,1361734043213918302389036646403,2753178647370685731375652274179,5565778416627069715946462511107,11250399077025535938283240947715,22738482641593864889347113746435,45952334258273315804255491194883,92855406466717803659633509793795
mov $1,$0
lpb $1
sub $1,1
add $0,$1
mul $0,2
lpe
div $0,2
add $0,1
|
libsrc/_DEVELOPMENT/drivers/terminal/console_01/input/console_01_input_terminal/console_01_input_stdio_msg_getc.asm | jpoikela/z88dk | 640 | 177382 | <gh_stars>100-1000
SECTION code_driver
SECTION code_driver_terminal_input
PUBLIC console_01_input_stdio_msg_getc
EXTERN console_01_input_proc_getc
defc console_01_input_stdio_msg_getc = console_01_input_proc_getc
; enter : ix = & FDSTRUCT.JP
;
; exit : success
;
; a = hl = char
; carry reset
;
; fail
;
; hl = 0 on stream error, -1 on eof
; carry set
;
; uses : af, hl
|
src/base/log/util-log-loggers.adb | RREE/ada-util | 60 | 20054 | -----------------------------------------------------------------------
-- util-log-loggers -- Utility Log Package
-- Copyright (C) 2001 - 2019, 2021 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Strings;
with Ada.Strings.Fixed;
with Ada.Calendar;
with Ada.Unchecked_Deallocation;
with Ada.IO_Exceptions;
with Util.Strings;
with Util.Strings.Builders;
with Util.Strings.Formats;
with Util.Log.Appenders.Factories;
with Util.Log.Appenders.Consoles;
with Util.Log.Appenders.Files;
package body Util.Log.Loggers is
use Ada.Strings;
use Ada.Strings.Fixed;
use Log.Appenders;
function Traceback (E : in Exception_Occurrence) return String is separate;
package File_Factory is
new Util.Log.Appenders.Factories (Name => "File",
Create => Files.Create'Access);
package Console_Factory is
new Util.Log.Appenders.Factories (Name => "Console",
Create => Consoles.Create'Access);
-- The log manager controls the configuration of loggers.
-- The log appenders are shared by loggers and they are created by
-- the log manager when a logger is created.
--
protected type Log_Manager is
-- Initialize the log environment with the property file.
procedure Initialize (Name : in String);
-- Initialize the log environment with the property file.
procedure Initialize (Properties : in Util.Properties.Manager);
-- Create and initialize the logger
procedure Create (Name : in String;
Log : out Logger_Info_Access);
-- Remove the logger from the list
procedure Remove (Log : in out Logger_Info_Access);
private
-- Initialize the logger by reading the configuration, setting its level
-- and creating the appender
procedure Initialize (Log : in out Logger_Info);
-- Re-initializes the loggers after the configuration is changed.
procedure Initialize_Again;
-- Find the appender to be used for the given logger.
-- Create the appender if necessary.
procedure Find_Appender (Property : in String;
Appender : out Appender_Access);
-- Obtain an appender given its name. If the appender does not exist, it is created.
procedure Build_Appender (Name : in String;
Appender : out Appender_Access);
procedure Create_Default_Appender;
Config : Properties.Manager;
Appenders : Log.Appenders.Appender_List;
Default_Level : Level_Type := WARN_LEVEL;
Default_Appender : Log.Appenders.Appender_Access := null;
First_Logger : Logger_Info_Access := null;
end Log_Manager;
Manager : Log_Manager;
function Get_Appender (Value : in String) return String with Inline_Always;
-- Get the logger property associated with a given logger
function Get_Logger_Property (Properties : in Util.Properties.Manager;
Name : in String) return String;
-- ------------------------------
-- Get the log appender name from the property value
-- ------------------------------
function Get_Appender (Value : in String) return String is
Pos : constant Natural := Index (Value, ",");
begin
if Pos <= Value'First or Pos >= Value'Last then
return "";
else
return Trim (Value (Pos + 1 .. Value'Last), Both);
end if;
end Get_Appender;
-- ------------------------------
-- Get the logger property associated with a given logger
-- ------------------------------
function Get_Logger_Property (Properties : in Util.Properties.Manager;
Name : in String) return String is
Prop_Name : constant String := "logger." & Name;
Pos : Natural := Prop_Name'Last;
begin
while Pos > Prop_Name'First loop
if Properties.Exists (Prop_Name (Prop_Name'First .. Pos)) then
return Trim (Properties.Get (Prop_Name (Prop_Name'First .. Pos)), Both);
end if;
Pos := Util.Strings.Rindex (Prop_Name, '.', Pos);
if Pos > 0 then
Pos := Pos - 1;
end if;
end loop;
return "";
end Get_Logger_Property;
-- ------------------------------
-- Initialize the log environment with the property file.
-- ------------------------------
procedure Initialize (Name : in String) is
begin
Manager.Initialize (Name);
end Initialize;
-- ------------------------------
-- Initialize the log environment with the properties.
-- ------------------------------
procedure Initialize (Properties : in Util.Properties.Manager) is
begin
Manager.Initialize (Properties);
end Initialize;
protected body Log_Manager is
-- ------------------------------
-- Initialize the log environment with the property file.
-- ------------------------------
procedure Initialize (Name : in String) is
begin
Util.Properties.Load_Properties (Config, Path => Name, Prefix => "log4j.", Strip => True);
Initialize_Again;
exception
when Ada.IO_Exceptions.Name_Error =>
declare
Message : Util.Strings.Builders.Builder (256);
Date : constant Ada.Calendar.Time := Ada.Calendar.Clock;
begin
Strings.Formats.Format (Message, "Log configuration file {0} not found", Name);
if Default_Appender = null then
Create_Default_Appender;
end if;
Default_Appender.Append (Message, Date, WARN_LEVEL, "Util.Log");
end;
end Initialize;
-- ------------------------------
-- Re-initializes the loggers after the configuration is changed.
-- ------------------------------
procedure Initialize_Again is
L : Logger_Info_Access := First_Logger;
begin
Util.Log.Appenders.Clear (Appenders);
Default_Appender := null;
-- Initialize the default category.
if Config.Exists ("rootCategory") then
declare
Value : constant String := Config.Get ("rootCategory");
begin
Default_Level := Get_Level (Value, Default_Level);
Find_Appender (Property => Value, Appender => Default_Appender);
end;
end if;
if Default_Appender = null then
Create_Default_Appender;
end if;
-- Re-initialize the existing loggers. Note that there is no concurrency
-- protection if a thread calls 'Initialize' while another thread is using
-- an already initialized logger.
while L /= null loop
Initialize (L.all);
L := L.Next_Logger;
end loop;
end Initialize_Again;
-- ------------------------------
-- Initialize the log environment with the properties.
-- ------------------------------
procedure Initialize (Properties : in Util.Properties.Manager) is
New_Config : Util.Properties.Manager;
begin
New_Config.Copy (From => Properties, Prefix => "log4j.", Strip => True);
Config := New_Config;
Initialize_Again;
end Initialize;
-- ------------------------------
-- Initialize the logger by reading the configuration, setting its level
-- and creating the appender
-- ------------------------------
procedure Initialize (Log : in out Logger_Info) is
Prop : constant String := Get_Logger_Property (Config, Log.Name);
Appender : Appender_Access;
begin
Log.Level := Get_Level (Prop, Default_Level);
Find_Appender (Prop, Appender);
if Appender /= null then
Log.Appender := Appender.all'Access;
end if;
end Initialize;
-- ------------------------------
-- Create and initialize the logger
-- ------------------------------
procedure Create (Name : in String;
Log : out Logger_Info_Access) is
begin
Log := new Logger_Info (Len => Name'Length);
Log.Name := Name;
Initialize (Log.all);
Log.Next_Logger := First_Logger;
Log.Prev_Logger := null;
if First_Logger /= null then
First_Logger.Prev_Logger := Log;
end if;
First_Logger := Log;
end Create;
-- ------------------------------
-- Remove the logger from the list
-- ------------------------------
procedure Remove (Log : in out Logger_Info_Access) is
procedure Free is new Ada.Unchecked_Deallocation (Object => Logger_Info,
Name => Logger_Info_Access);
begin
-- Remove first logger
if Log = First_Logger then
First_Logger := First_Logger.Next_Logger;
if First_Logger /= null then
First_Logger.Prev_Logger := null;
end if;
-- Remove last logger
elsif Log.Next_Logger = null then
Log.Prev_Logger.Next_Logger := null;
else
Log.Next_Logger.Prev_Logger := Log.Prev_Logger;
Log.Prev_Logger.Next_Logger := Log.Next_Logger;
end if;
Free (Log);
end Remove;
-- ------------------------------
-- Obtain an appender given its name. If the appender does not exist, it is created.
-- ------------------------------
procedure Build_Appender (Name : in String;
Appender : out Appender_Access) is
begin
Appender := Util.Log.Appenders.Find_Appender (Appenders, Name);
if Appender /= null then
return;
end if;
if Name'Length > 0 then
Appender := Util.Log.Appenders.Create (Name, Config, Default_Level);
if Appender /= null then
Util.Log.Appenders.Add_Appender (Appenders, Appender);
end if;
end if;
end Build_Appender;
procedure Create_Default_Appender is
begin
if Default_Appender = null then
Default_Appender := Consoles.Create ("root", Config, ERROR_LEVEL);
Set_Layout (Default_Appender.all, MESSAGE);
Util.Log.Appenders.Add_Appender (Appenders, Default_Appender);
end if;
end Create_Default_Appender;
-- ------------------------------
-- Find an appender given the property value
-- ------------------------------
procedure Find_Appender (Property : in String;
Appender : out Appender_Access) is
Appender_Name : constant String := Get_Appender (Property);
begin
if Appender_Name'Length = 0 then
Appender := Default_Appender;
if Appender = null then
Create_Default_Appender;
Appender := Default_Appender;
end if;
return;
end if;
Appender := Util.Log.Appenders.Find_Appender (Appenders, Appender_Name);
if Appender /= null then
return;
end if;
declare
N : Natural := Index (Appender_Name, ",");
Last_Pos : Natural := Appender_Name'First;
List : List_Appender_Access;
A : Appender_Access;
begin
-- The appender configuration refers to a list of appenders.
-- Example: DEBUG, out1, console
if N > 0 then
List := Create_List_Appender (Appender_Name);
loop
Build_Appender (Trim (Appender_Name (Last_Pos .. N - 1), Both), A);
exit when A = null;
List.Add_Appender (A);
exit when N > Appender_Name'Last;
Last_Pos := N + 1;
N := Ada.Strings.Fixed.Index (Appender_Name, ",", Last_Pos);
if N = 0 then
N := Appender_Name'Last + 1;
end if;
end loop;
Appender := List.all'Access;
Util.Log.Appenders.Add_Appender (Appenders, Appender);
else
Build_Appender (Appender_Name, Appender);
end if;
end;
end Find_Appender;
end Log_Manager;
-- ------------------------------
-- Create a logger with the given name.
-- ------------------------------
function Create (Name : in String) return Logger is
Log : Logger_Info_Access;
begin
Manager.Create (Name, Log);
return Logger '(Ada.Finalization.Limited_Controlled with
Instance => Log);
end Create;
-- ------------------------------
-- Create a logger with the given name and use the specified level.
-- ------------------------------
function Create (Name : in String;
Level : in Level_Type) return Logger is
Log : Logger_Info_Access;
begin
Manager.Create (Name, Log);
Log.Level := Level;
return Logger '(Ada.Finalization.Limited_Controlled with
Instance => Log);
end Create;
-- ------------------------------
-- Change the log level
-- ------------------------------
procedure Set_Level (Log : in out Logger;
Level : in Level_Type) is
begin
Log.Instance.Level := Level;
end Set_Level;
-- ------------------------------
-- Get the log level.
-- ------------------------------
function Get_Level (Log : in Logger) return Level_Type is
begin
return Log.Instance.Level;
end Get_Level;
-- ------------------------------
-- Get the log level name.
-- ------------------------------
function Get_Level_Name (Log : in Logger) return String is
begin
return Get_Level_Name (Log.Instance.Level);
end Get_Level_Name;
procedure Print (Log : in Logger;
Level : in Level_Type;
Message : in String;
Arg1 : in String := "";
Arg2 : in String := "";
Arg3 : in String := "";
Arg4 : in String := "") is
Instance : constant Logger_Info_Access := Log.Instance;
begin
if Instance /= null and then Instance.Level >= Level then
declare
Result : Util.Strings.Builders.Builder (256);
Date : constant Ada.Calendar.Time := Ada.Calendar.Clock;
begin
Strings.Formats.Format (Result, Message, Arg1, Arg2, Arg3, Arg4);
Instance.Appender.Append (Result, Date, Level, Instance.Name);
end;
end if;
end Print;
procedure Debug (Log : in Logger'Class;
Message : in String;
Arg1 : in String := "";
Arg2 : in String := "";
Arg3 : in String := "") is
begin
Print (Log, DEBUG_LEVEL, Message, Arg1, Arg2, Arg3);
end Debug;
procedure Debug (Log : in Logger'Class;
Message : in String;
Arg1 : in String;
Arg2 : in String;
Arg3 : in String;
Arg4 : in String) is
begin
Print (Log, DEBUG_LEVEL, Message, Arg1, Arg2, Arg3, Arg4);
end Debug;
procedure Debug (Log : in Logger'Class;
Message : in String;
Arg1 : in Unbounded_String;
Arg2 : in String := "";
Arg3 : in String := "") is
begin
if Log.Instance /= null and then Log.Instance.Level >= DEBUG_LEVEL then
Print (Log, DEBUG_LEVEL, Message, To_String (Arg1), Arg2, Arg3);
end if;
end Debug;
procedure Debug (Log : in Logger'Class;
Message : in String;
Arg1 : in Unbounded_String;
Arg2 : in Unbounded_String;
Arg3 : in String := "") is
begin
if Log.Instance /= null and then Log.Instance.Level >= DEBUG_LEVEL then
Print (Log, DEBUG_LEVEL, Message, To_String (Arg1), To_String (Arg2), Arg3);
end if;
end Debug;
procedure Info (Log : in Logger'Class;
Message : in String;
Arg1 : in String := "";
Arg2 : in String := "";
Arg3 : in String := "") is
begin
Print (Log, INFO_LEVEL, Message, Arg1, Arg2, Arg3);
end Info;
procedure Info (Log : in Logger'Class;
Message : in String;
Arg1 : in String;
Arg2 : in String;
Arg3 : in String;
Arg4 : in String) is
begin
Print (Log, INFO_LEVEL, Message, Arg1, Arg2, Arg3, Arg4);
end Info;
procedure Info (Log : in Logger'Class;
Message : in String;
Arg1 : in Unbounded_String;
Arg2 : in String := "";
Arg3 : in String := "") is
begin
if Log.Instance /= null and then Log.Instance.Level >= INFO_LEVEL then
Print (Log, INFO_LEVEL, Message, To_String (Arg1), Arg2, Arg3);
end if;
end Info;
procedure Warn (Log : in Logger'Class;
Message : in String;
Arg1 : in String := "";
Arg2 : in String := "";
Arg3 : in String := "") is
begin
if Log.Instance /= null and then Log.Instance.Level >= WARN_LEVEL then
Print (Log, WARN_LEVEL, Message, Arg1, Arg2, Arg3);
end if;
end Warn;
procedure Error (Log : in Logger'Class;
Message : in String;
Arg1 : in String := "";
Arg2 : in String := "";
Arg3 : in String := "") is
begin
Print (Log, ERROR_LEVEL, Message, Arg1, Arg2, Arg3);
end Error;
procedure Error (Log : in Logger'Class;
Message : in String;
E : in Exception_Occurrence;
Trace : in Boolean := False) is
begin
if Trace then
Print (Log, ERROR_LEVEL,
"{0}: Exception {1}: {2} at {3}",
Message,
Exception_Name (E),
Exception_Message (E),
Traceback (E));
else
Print (Log, ERROR_LEVEL,
"{0}: Exception {1}: {2}",
Message,
Exception_Name (E),
Exception_Message (E));
end if;
end Error;
-- ------------------------------
-- Finalize the logger and flush the associated appender
-- ------------------------------
procedure Finalize (Log : in out Logger) is
begin
if Log.Instance.Appender /= null then
Log.Instance.Appender.Flush;
end if;
Manager.Remove (Log.Instance);
end Finalize;
begin
Console_Factory.Register;
File_Factory.Register;
end Util.Log.Loggers;
|
programs/oeis/133/A133337.asm | karttu/loda | 0 | 16577 | <gh_stars>0
; A133337: a(3n) = 0, a(3n+1) = a(3n+2) = 5^n.
; 0,1,1,0,5,5,0,25,25,0,125,125,0,625,625,0,3125,3125,0,15625,15625,0,78125,78125,0,390625,390625,0,1953125,1953125,0,9765625,9765625,0,48828125,48828125,0,244140625,244140625,0,1220703125,1220703125,0
mov $3,1
mov $5,1
lpb $0,1
sub $0,1
trn $0,1
mov $4,2
add $4,$0
trn $0,$3
mov $2,1
add $5,$3
lpe
mov $0,6
sub $0,$3
pow $0,$5
mul $0,2
pow $4,$2
sub $4,$2
div $2,$4
mul $0,$2
mov $1,$0
div $1,50
|
inc/base.asm | gb-archive/mealybug-tearoom-tests | 37 | 16653 | ; Copyright (C) 2020 <NAME> <<EMAIL>>
;
; Permission is hereby granted, free of charge, to any person obtaining a copy
; of this software and associated documentation files (the "Software"), to deal
; in the Software without restriction, including without limitation the rights
; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
; copies of the Software, and to permit persons to whom the Software is
; furnished to do so, subject to the following conditions:
;
; The above copyright notice and this permission notice shall be included in
; all copies or substantial portions of the Software.
;
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
; SOFTWARE.
SECTION "lib", ROMX
INCLUDE "mgblib/src/hardware.inc"
INCLUDE "mgblib/src/macros.asm"
IF DEF(REQUIRES_CGB) | ! DEF(USE_DMG_MODE)
enable_cgb_mode
ENDC
INCLUDE "mgblib/src/old_skool_outline_thick.asm"
INCLUDE "mgblib/src/display.asm"
INCLUDE "mgblib/src/print.asm"
INCLUDE "mgblib/src/misc/delay.asm"
INCLUDE "mgblib/src/serial/SerialSendByte.asm"
PUSHS
SECTION "results", WRAM0, ALIGN[8]
Results::
DS 254
ResultCounter::
DS 1
TestResult::
DS 1
POPS
; Writes byte in register `a` to [de] and increases
; the result counter
;
; @param a the value to store
; @param de the address to store the value
; @return de + 1
; @destroys af
store_result: MACRO
ld [de], a
inc de
ld a, [ResultCounter]
inc a
ld [ResultCounter], a
ENDM
SECTION "boot", ROM0[$100]
nop
jp Main
SECTION "header-remainder", ROM0[$14a]
ds $150-@, $0
SECTION "main", ROMX
Main::
di
ld sp, $fffe
push af
call ResetDisplay
call ResetCursor
pop af
IF DEF(REQUIRES_CGB)
cp $11
jp nz, NotCGB
ENDC
xor a
ld [ResultCounter], a
ld de, Results
call RunTest
call ResetDisplay
call LoadFont
call GeneratePaleHexDigits
ld de, TestTitle
call PrintString
ld a, [wPrintCursorAddress]
and $1f
jr z, .skip_extra_new_line
print_string_literal "\\n"
.skip_extra_new_line::
print_string_literal "\\n"
IF DEF(DISPLAY_RESULTS_ONLY)
call DisplayResults
ELSE
call CompareResults
jp Quit
ENDC
NotCGB::
call LoadFont
print_string_literal "CGB Required"
ld a, "F"
ld [TestResult], a
jp Quit
; Displays and compares Results to CorrectResults
;
; @param [Results] results recorded from test
; @param [CorrectResults] the correct results
; @param [ResultCounter] number of results to compare
CompareResults::
ld a, "P"
ld [TestResult], a
ld hl, Results
ld de, CorrectResults
ld a, [ResultCounter]
ld c, a
.loop
ld a, [de]
ld b, a ; b = correct result
ld a, [hl] ; a = result
push hl
push de
push bc
; print the result
push bc
push af
call PrintHexU8NoDollar
pop af
pop bc
cp b
jr z, .matched
; record the failure
ld a, "F"
ld [TestResult], a
; print the correct result and a space
ld a, b
call PrintPaleHexU8NoDollar
ld a, " "
call PrintCharacter
jr .continue
.matched:
print_string_literal " "
.continue:
pop bc
pop de
pop hl
inc hl
inc de
dec c
jr nz, .loop
inc a
; print a new line if not already on the first character of the line
call PrintNewLine
ld a, [wPrintCursorAddress]
and 31
jr z, .noExtraLine
call PrintNewLine
.noExtraLine::
ld a, [TestResult]
cp "P"
jr nz, .failed
print_string_literal "Passed"
ret
.failed
print_string_literal "Failed"
ret
; Display the results only without comparing
; to any values
DisplayResults::
ld hl, Results
ld a, [ResultCounter]
ld c, a
.loop
ld a, [hl]
push hl
push bc
call PrintHexU8NoDollar
print_string_literal " "
pop bc
pop hl
inc hl
dec c
jr nz, .loop
; turn lcd on and loop forever
lcd_on
wait_ly 145
wait_ly 144
ld b, b
.forever:
jr .forever
; Set magic register values, sends result via serial
; output, and loops forever
;
; @param [TestResult] if "P" then reports a passed result, otherwise failed
Quit::
lcd_on
wait_ly 145
ld a, [TestResult]
cp "P"
jr nz, .failed
ld b, 3
ld c, 5
ld d, 8
ld e, 13
ld h, 21
ld l, 34
jr .sendSerialResult
.failed
ld b, $42
ld c, b
ld d, b
ld e, b
ld h, b
ld l, b
.sendSerialResult:
ld a, b
call SerialSendByte
ld a, c
call SerialSendByte
ld a, d
call SerialSendByte
ld a, e
call SerialSendByte
ld a, h
call SerialSendByte
ld a, l
call SerialSendByte
wait_ly 144
xor a
ld b, b
.forever:
jr .forever
; Print a 8-bit value in hexidecimal with pale colours, 2 digits only
;
; @param a number to print
; @destroys af, bc, hl
PrintPaleHexU8NoDollar::
push af
swap a
call PrintPaleHexNibble
pop af
call PrintPaleHexNibble
ret
; Print a 4-bit value in hexidecimal with pale colours
;
; @param a number to print (low nibble)
; @destroys af, bc, hl
PrintPaleHexNibble::
and $0f
add 128 ; pale hex digits start at $9000
jp PrintCharacter
; Generates pale versions of the hex digits at $8800 based
; on the tile data from the ASCII font located at $9000
;
; @destroys af, c, de, hl
GeneratePaleHexDigits::
; generate numbers
ld hl, $9000 + ("0" * 16)
ld de, $8800
ld c, 10 * 8
.numbersLoop::
; read bitplane 1
inc hl
ld a, [hl-]
; write it as bitplane 0
ld [de], a
; zero out bitplane 1
inc de
xor a
ld [de], a
; advance to next row
inc de
inc hl
inc hl
dec c
jr nz, .numbersLoop
; generate letters
ld hl, $9000 + ("A" * 16)
ld de, $8800 + 10 * 16
ld c, 6 * 8
.lettersLoop::
; read bitplane 1
inc hl
ld a, [hl-]
; write it as bitplane 0
ld [de], a
; zero out bitplane 1
inc de
xor a
ld [de], a
; advance to next row
inc de
inc hl
inc hl
dec c
jr nz, .lettersLoop
ret
SwitchSpeed:
xor a
ldh [rIE], a
ld a, $30
ldh [rP1], a
ld a, $01
ldh [rKEY1], a
stop
ret
PUSHS
SECTION "header_title", ROM0[$134]
IF STRLEN("{TITLE}") > 15
DB STRUPR(STRSUB("{TITLE}", 0, 15))
ELSE
DB STRUPR("{TITLE}")
ENDC
SECTION "title", ROM0
TestTitle::
DB "{TITLE}", $00
POPS
|
oeis/111/A111874.asm | neoneye/loda-programs | 11 | 175808 | <reponame>neoneye/loda-programs
; A111874: The work performed by a partial function f:{1,...,n}->{1,...,n} is defined to be work(f)=sum(|i-f(i)|,i in dom(f)); a(n) is equal to sum(work(f)) where the sum is over all injective partial functions f:{1,...,n}->{1,...,n}.
; Submitted by <NAME>
; 0,4,56,680,8360,108220,1492624,21994896,346014960,5798797620,103251381640,1947864594104,38827482815576,815655120856940,18013584786712480,417284952377904160,10117859730525070944
mov $1,$0
seq $0,123510 ; Arises in the normal ordering of functions of a*(a+)*a, where a and a+ are the boson annihilation and creation operators, respectively.
mul $0,$1
div $0,6
mul $0,4
|
ch6.asm | ChanJLee/easy-asm | 0 | 85623 | assume cs: codeseg
codeseg segment
mov ax, 1000H
mov ds, ax
mov cx, 3H
mov bx, 0H
s: mov ds:[bx], bx
inc bx
loop s
a: mov al, ds:[bx]
mov ah, 0H
add dx, ax
inc bx
loop a
mov ax, 4200h
int 21h
codeseg ends
end |
tools/configure/configure-tests-oci.adb | svn2github/matreshka | 24 | 6491 | <reponame>svn2github/matreshka
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-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 Ada.Environment_Variables;
with GNAT.OS_Lib;
with GNAT.Strings;
with Configure.Builder;
package body Configure.Tests.OCI is
Has_OCI : constant Unbounded_String := +"HAS_OCI";
OCI_Library_Options : constant Unbounded_String := +"OCI_LIBRARY_OPTIONS";
-------------
-- Execute --
-------------
overriding procedure Execute
(Self : in out OCI_Test;
Arguments : in out Unbounded_String_Vector)
is
use all type Configure.Tests.Operating_System.Operating_Systems;
function OCI_Library_Name return String;
-- Returns platform dependent name of OCI library.
----------------------
-- OCI_Library_Name --
----------------------
function OCI_Library_Name return String is
begin
if Self.Operating_System_Test.Get_Operating_System = Windows then
return "oci";
else
return "clntsh";
end if;
end OCI_Library_Name;
use type GNAT.Strings.String_Access;
OCI_DLL_Name : constant String := "oci.dll";
OCI_DLL_Path : constant GNAT.Strings.String_Access
:= GNAT.OS_Lib.Locate_Exec_On_Path (OCI_DLL_Name);
begin
-- Command line parameter has preference other automatic detection.
Self.Switches.Parse_Switches (Arguments);
Self.Report_Check ("checking whether to build Oracle module");
if Self.Switches.Is_Enabled then
if Self.Switches.Is_Libdir_Specified then
Substitutions.Insert
(OCI_Library_Options,
"""-L"
& Self.Switches.Libdir
& """, ""-l" & OCI_Library_Name & '"');
Self.Report_Status ("yes (command line)");
elsif Ada.Environment_Variables.Exists ("ORACLE_HOME") then
Substitutions.Insert
(OCI_Library_Options,
+"""-L"
& Ada.Environment_Variables.Value ("ORACLE_HOME")
& "/lib"", ""-l" & OCI_Library_Name & '"');
Self.Report_Status ("yes (environment variable)");
elsif Self.Operating_System_Test.Get_Operating_System = Windows
and OCI_DLL_Path /= null
then
Substitutions.Insert
(OCI_Library_Options,
+"""-L"
& OCI_DLL_Path
(OCI_DLL_Path'First .. OCI_DLL_Path'Last - OCI_DLL_Name'Length)
& """, ""-l" & OCI_Library_Name & '"');
Self.Report_Status ("yes (" & OCI_DLL_Name & " in PATH)");
else
Self.Report_Status ("no (not found)");
end if;
else
Self.Report_Status ("no (command line)");
end if;
-- Check that OCI application can be linked with specified/detected set
-- of options.
if Substitutions.Contains (OCI_Library_Options) then
Self.Report_Check
("checking whether OCI library is usable");
if Configure.Builder.Build (Self, "config.tests/oci/") then
Self.Report_Status ("yes");
else
Self.Report_Status ("no");
-- Switches don't allow to build application, remove them.
Substitutions.Delete (OCI_Library_Options);
end if;
end if;
-- Insert empty value for substitution variable when OCI driver module
-- is disabled.
if not Substitutions.Contains (OCI_Library_Options) then
Substitutions.Insert (OCI_Library_Options, Null_Unbounded_String);
Substitutions.Insert (Has_OCI, Null_Unbounded_String);
if Self.Switches.Is_Enabled
and Self.Switches.Is_Enable_Specified
then
Fatal_Error ("OCI library is not found but support is requested");
else
Information ("Oracle driver module is disabled");
end if;
else
Substitutions.Insert (Has_OCI, To_Unbounded_String ("true"));
end if;
end Execute;
----------
-- Help --
----------
overriding function Help (Self : OCI_Test) return Unbounded_String_Vector is
begin
return Self.Switches.Help;
end Help;
----------
-- Name --
----------
overriding function Name (Self : OCI_Test) return String is
begin
return "oci";
end Name;
end Configure.Tests.OCI;
|
L.agda | andmkent/misc-HoTT | 1 | 14946 | <reponame>andmkent/misc-HoTT
module L where
open import Data.Nat using (ℕ; suc) -- ; _*_)
open import Relation.Binary.PropositionalEquality using (_≡_; refl; cong; sym; trans)
open import Data.Product
open import Data.Empty
-- Recursion principle
recℕ : (C : Set) → C → (ℕ → C → C) → ℕ → C
recℕ C c f 0 = c
recℕ C c f (suc n) = f n (recℕ C c f n)
double : ℕ → ℕ
double = recℕ ℕ 0 (λ n r → suc (suc r))
add : ℕ → ℕ → ℕ
add = recℕ (ℕ → ℕ) (λ n → n) (λ m r → λ n → suc (r n))
-- fact : ℕ → ℕ
-- fact = recℕ ℕ 1 (λ n r → suc n * r)
-- Induction principle
indℕ : (C : ℕ → Set) → C 0 → ((n : ℕ) → C n → C (suc n)) → (n : ℕ) → C n
indℕ C c f 0 = c
indℕ C c f (suc n) = f n (indℕ C c f n)
add-assoc : (i j k : ℕ) → add i (add j k) ≡ add (add i j) k
add-assoc = indℕ
(λ i → (j k : ℕ) → add i (add j k) ≡ add (add i j) k)
(λ j k → refl)
(λ i i+[j+k]≡[i+j]+k j k → cong suc (i+[j+k]≡[i+j]+k j k))
add-right-unit : (i : ℕ) → add i 0 ≡ i
add-right-unit = indℕ (λ i → add i 0 ≡ i) refl (λ i i+0≡i → cong suc i+0≡i)
add-suc : (i j : ℕ) → suc (add i j) ≡ add i (suc j)
add-suc = indℕ (λ i → (j : ℕ) → suc (add i j) ≡ add i (suc j))
(λ j → refl)
(λ i s[i+j]≡i+s[j] j → cong suc (s[i+j]≡i+s[j] j))
add-comm : (i j : ℕ) → add i j ≡ add j i
add-comm = indℕ
(λ i → (j : ℕ) → add i j ≡ add j i)
(λ j → sym (add-right-unit j))
(λ i i+j≡j+i j → trans (cong suc (i+j≡j+i j)) (add-suc j i))
-- Some type definitions
_≤_ : (i j : ℕ) → Set
i ≤ j = Σ[ k ∈ ℕ ] (add i k ≡ j)
i≤i+j : (i j : ℕ) → i ≤ add i j
i≤i+j = indℕ
(λ i → (j : ℕ) → i ≤ add i j)
(λ j → (j , refl))
(λ i i≤i+j j → (j , refl))
¬ : Set → Set
¬ A = A → ⊥
_<_ : (i j : ℕ) → Set
i < j = (i ≤ j) × ¬ (i ≡ j)
0≠si : (i : ℕ) → ¬ (0 ≡ suc i)
0≠si i = λ ()
0< : (i : ℕ) → (0 < suc i)
0< = indℕ (λ i → 0 < suc i)
{!!}
{!!}
|
Appl/Calendar/Repeat/repeatDynamic.asm | steakknife/pcgeos | 504 | 245988 | COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1989 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Calendar/Repeat
FILE: repeatDynamic.asm
AUTHOR: <NAME>, February 10, 1990
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 2/10/90 Initial revision
DESCRIPTION:
Respond to all actions involving the RepeatDynamicList.
$Id: repeatDynamic.asm,v 1.1 97/04/04 14:48:47 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
idata segment
RDCurrentSelect word -1 ; the current select item
idata ends
udata segment
repeatChangeIndex word ; the current index value
repeatEvents byte ; true if there are any events
udata ends
RepeatCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RepeatGetEventMoniker
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Creates & returns a moniker to represent a RepeatEvent
CALLED BY: UI (MSG_LIST_REQUEST_ENTRY_MONIKER)
PASS: DS = DGroup
CX:DX = RepeatDynamicList block:handle
BP = Entry # of requested moniker
RETURN: Nothing
DESTROYED: AX, BX, CX, DX, DI, SI, BP, ES
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 2/9/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RepeatGetEventMoniker proc far
; Access the requested RepeatStruct
;
mov si, dx ; GenDynamicList chunk => SI
mov ax, ds:[repeatMapGroup] ; get the RepeatMap group #
mov di, ds:[repeatMapItem] ; get the RepeatMap item #
tst ax ; a repeat map group ??
jz emptyMoniker ; no, so display emtpy moniker
call GP_DBLockDerefDI ; lock the map
tst es:[di].RMH_numItems ; any events ??
jnz regularMoniker ; create a regular moniker
call DBUnlock ; else unlock RepeatMap
; Create a "No Repeat Events" moniker
emptyMoniker:
mov bx, handle DataBlock ; string resource handle => BX
call MemLock ; segment => AX
mov es, ax
assume es:DataBlock
mov dx, es:[noRepeats] ; string => ES:DX
assume es:nothing
clr ax ; know what to unlock...
jmp sendMoniker ; send of the moniker
; Access the correct block
regularMoniker:
EC < cmp bp, es:[di].RMH_numItems ; check number of items >
EC < ERROR_GE GET_REPEAT_EVENT_MONIKER_BAD_EVENT_NUM >
mov bx, bp ; Entry number => BX
shl bx, 1
shl bx, 1 ; Size RMS = 4 bytes
add bx, size RepeatMapHeader ; total offset => BX
EC < cmp bx, es:[di].RMH_size >
EC < ERROR_GE GET_REPEAT_EVENT_MONIKER_BAD_SIZE >
mov di, es:[di][bx].RMS_item ; RepeatStruct item => DI
call DBUnlock ; Unlock the RepeatMap
call GP_DBLockDerefDI ; lock the RepeatStruct
mov dx, di ; dereference the handle
add dx, offset RES_data ; string => ES:DX
; Now set the moniker
sendMoniker:
push ax ; save clean-up flag
mov ax, MSG_GEN_DYNAMIC_LIST_REPLACE_ITEM_TEXT
mov cx, es ; string => CX:DX
call ObjMessage_repeat_call ; send message to list
pop cx ; unlock "boolean" => CX
; Now clean up and exit. If CX=0, unlock DB block. Else unlock strings.
;
jcxz noRepeatDone ; if none, unlock string block
call DBUnlock ; unlock database segment
jmp done ; and exit...
noRepeatDone:
mov bx, handle DataBlock ; string resource handle => BX
call MemUnlock ; unlock the block
done:
ret
RepeatGetEventMoniker endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RepeatSelectEvent
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Respond to different RepeatEvents (List Entries) being
selected, and enabling/disabling the Change & Delete triggers
CALLED BY: UI (MSG_REPEAT_SELECT_EVENT)
PASS: DS, ES = DGroup
CX = New entry number
RETURN: Nothing
DESTROYED: AX, BX, CX, DX, DI, SI, BP, ES
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 2/10/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RepeatSelectEvent proc far
; Store the new entry number, and disable/enable the triggers
;
mov ax, MSG_GEN_SET_NOT_ENABLED ; assumme disable triggers
cmp ds:[repeatEvents], FALSE ; are there any events??
je setState ; if not, do nothing
mov bx, cx ; new entry to BX
xchg cx, ds:[RDCurrentSelect] ; swap old/new selections
cmp bx, -1 ; now nothing selected?
je setState ; if so, must disable all
mov ax, MSG_GEN_SET_ENABLED ; else must enable everything
; Now set the triggers either enabled or disabled
setState:
mov si, offset RepeatBlock:RepeatChangeTrigger
call RepeatSetState ; set state of CHANGE trigger
mov si, offset RepeatBlock:RepeatDeleteTrigger
call RepeatSetState ; set state of DELETE trigger
ret
RepeatSelectEvent endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RepeatChangeEvent
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Respond to the CHANGE button action
CALLED BY: UI (MSG_REPEAT_CHANGE_EVENT)
PASS: DS, ES = DGroup
RETURN: Nothing
DESTROYED: AX, BX, CX, DX, DI, SI, BP, ES
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 2/10/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RepeatChangeEvent proc far
; Obtain the current RepeatStruct
;
call RepeatMapIndexToStruct
mov ds:[repeatChangeIndex], bx ; store the index value
GOTO RepeatChangeEventLow ; open the dialog box
RepeatChangeEvent endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RepeatDeleteEvent
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Remove the currently selected RepeatEvent
CALLED BY: UI (MSG_REPEAT_DELETE_EVENT)
PASS: DS, ES = DGroup
RETURN: Nothing
DESTROYED: TBD
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 2/11/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RepeatDeleteEvent proc far
; Obtain the correct repeat ID
;
call RepeatMapIndexToStruct
mov cx, bx ; repeat ID => CX
call RepeatDelete ; remove the sucker
; Disable the triggers to prevent spurious delete/change requests
;
mov cx, -1 ; select the -1th entry
clr bp ; pass no flags
GOTO RepeatSelectEvent ; send the "method"
RepeatDeleteEvent endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RepeatMapIndexToStruct
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Return the RepeatStruct corresponding to RDCurrentSelect
CALLED BY: RepeatChangeEvent, RepeatSelectEvent
PASS: DS = DGroup
RETURN: AX = Selected RepeatStruct : group #
DI = Selected RepeatStruct : item #
BX = Selected RepeatStruct : index value
DESTROYED: BP, ES
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 2/11/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RepeatMapIndexToStruct proc near
.enter
; Obtain the current RepeatStruct
;
mov ax, ds:[repeatMapGroup] ; get the RepeatMap group #
mov di, ds:[repeatMapItem] ; get the RepeatMap item #
call GP_DBLockDerefDI ; lock the map
mov bp, ds:[RDCurrentSelect] ; Entry number => BP
shl bp, 1
shl bp, 1 ; Size RMS = 4 bytes
add bp, size RepeatMapHeader ; total offset => BP
EC < cmp bp, es:[di].RMH_size >
EC < ERROR_GE REPEAT_DYNAMIC_COMMON_BAD_SIZE >
mov bx, es:[di][bp].RMS_indexValue ; Index value => BX
mov di, es:[di][bp].RMS_item ; RepeatStruct item => DI
call DBUnlock ; Unlock the RepeatMap
.leave
ret
RepeatMapIndexToStruct endp
RepeatCode ends
CommonCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RepeatGetNumEvents
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Returns the numbers of repeat event entries
CALLED BY: UTILITY
PASS: DS = DGroup
RETURN: CX = Number of events
DESTROYED: AX, DI, ES
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 6/26/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RepeatGetNumEvents proc far
.enter
EC < VerifyDGroupDS ; verify DGroup >
mov ax, ds:[repeatMapGroup] ; get the RepeatMap group #
mov di, ds:[repeatMapItem] ; get the RepeatMap item #
tst ax ; no map group ??
jz noEvents
call GP_DBLockDerefDI ; lock the map item
mov cx, es:[di].RMH_numItems
call DBUnlock ; unlock the map item
mov ds:[repeatEvents], TRUE ; assume we have some events
tst cx ; are there any repeat events?
jnz done
noEvents:
mov ds:[repeatEvents], FALSE ; no events at all
mov cx, 1 ; use the "No Event" moniker
done:
.leave
ret
RepeatGetNumEvents endp
CommonCode ends
|
alloy4fun_models/trashltl/models/11/qb5jZvoc7BTNDhwx7.als | Kaixi26/org.alloytools.alloy | 0 | 230 | <filename>alloy4fun_models/trashltl/models/11/qb5jZvoc7BTNDhwx7.als<gh_stars>0
open main
pred idqb5jZvoc7BTNDhwx7_prop12 {
eventually some f : File | f in Trash => after (eventually f not in Trash or f in Trash)
}
pred __repair { idqb5jZvoc7BTNDhwx7_prop12 }
check __repair { idqb5jZvoc7BTNDhwx7_prop12 <=> prop12o } |
programs/oeis/047/A047392.asm | neoneye/loda | 22 | 240529 | <reponame>neoneye/loda
; A047392: Numbers that are congruent to {0, 1, 3, 5} mod 7.
; 0,1,3,5,7,8,10,12,14,15,17,19,21,22,24,26,28,29,31,33,35,36,38,40,42,43,45,47,49,50,52,54,56,57,59,61,63,64,66,68,70,71,73,75,77,78,80,82,84,85,87,89,91,92,94,96,98,99,101,103,105,106,108,110
mul $0,7
div $0,4
|
compiler/lexer_test.asm | OverclockedSanic/MicroTuring | 1 | 105500 | ;this is not a valid program, just a lexer test
copy:
test 1 [2] > +
micro
.variable 1
:goto |
video/VideoSprite.asm | puzzud/puzl6502 | 0 | 13333 | ;------------------------------------------------------------------
!zone SetXVelocity
SetXVelocity
sta SpriteXVelocity,x
rts
;------------------------------------------------------------------
!zone SetYVelocity
SetYVelocity
sta SpriteYVelocity,x
rts
;------------------------------------------------------------------
!zone GetDeltaFromVelocity
GetDeltaFromVelocity
pha
and #%01111000
lsr
lsr
lsr
sta PARAM2
pla
and #%00000111
asl
asl
clc
adc FrameCounterMod8CounterMod3
tax
lda FloatTable,x
ldx FrameCounterMod8
and BitTable,x
beq +
inc PARAM2
+
rts
;------------------------------------------------------------------
!zone SetXAcceleration
SetXAcceleration
sta SpriteXAcceleration,x
rts
;------------------------------------------------------------------
!zone SetYAcceleration
SetYAcceleration
sta SpriteYAcceleration,x
rts
;------------------------------------------------------------------
!zone SetAnimation
SetAnimation
pha
sty SpriteAnimation,x
tya
pha
clc
asl
tay
txa
pha
clc
asl
tax
lda #<ANIMATION_TABLE
sta ZEROPAGE_POINTER_1
lda #>ANIMATION_TABLE
sta ZEROPAGE_POINTER_1+1
lda (ZEROPAGE_POINTER_1),y
sta SpriteAnimationPointer,x
iny
lda (ZEROPAGE_POINTER_1),y
sta SpriteAnimationPointer+1,x
pla
tax
lda SpriteAnimationDelay,x ;reset counter.
sta SpriteAnimationCounter,x
ldy #0 ;reset animation frame index
jsr SetAnimationFrame
pla
tay
pla
rts
!if SYSTEM = SYSTEM_COMMODORE_64 {
!src "puzl/video/c64/VideoSprite.asm"
}
!if SYSTEM = SYSTEM_NES {
!src "puzl/video/nes/VideoSprite.asm"
}
!if SYSTEM = SYSTEM_APPLE_II {
!src "puzl/video/apple/VideoSprite.asm"
}
|
.emacs.d/elpa/wisi-2.1.1/wisitoken_grammar_runtime.adb | caqg/linux-home | 0 | 10510 | -- Abstract :
--
-- See spec.
--
-- Copyright (C) 2018 - 2019 Free Software Foundation, Inc.
--
-- This library is free software; you can redistribute it and/or modify it
-- under terms of the GNU General Public License as published by the Free
-- Software Foundation; either version 3, or (at your option) any later
-- version. This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-- As a special exception under Section 7 of GPL version 3, you are granted
-- additional permissions described in the GCC Runtime Library Exception,
-- version 3.1, as published by the Free Software Foundation.
pragma License (Modified_GPL);
with Ada.Characters.Handling;
with Ada.Exceptions;
with Ada.Strings.Unbounded;
with Ada.Text_IO;
with GNAT.Regexp;
with SAL.Generic_Decimal_Image;
with System.Assertions;
with WisiToken.Generate; use WisiToken.Generate;
with Wisitoken_Grammar_Actions; use Wisitoken_Grammar_Actions;
package body WisiToken_Grammar_Runtime is
use WisiToken;
----------
-- Body subprograms, misc order
procedure Raise_Programmer_Error
(Label : in String;
Tree : in WisiToken.Syntax_Trees.Tree;
Node : in WisiToken.Syntax_Trees.Node_Index);
pragma No_Return (Raise_Programmer_Error);
procedure Raise_Programmer_Error
(Label : in String;
Tree : in WisiToken.Syntax_Trees.Tree;
Node : in WisiToken.Syntax_Trees.Node_Index)
is begin
raise SAL.Programmer_Error with Label & WisiToken.Syntax_Trees.Node_Index'Image (Node) &
":" & Tree.Image (Node, Wisitoken_Grammar_Actions.Descriptor, Include_Children => True);
end Raise_Programmer_Error;
function Get_Line
(Data : in User_Data_Type;
Tree : in Syntax_Trees.Tree;
Node : in WisiToken.Syntax_Trees.Valid_Node_Index)
return WisiToken.Line_Number_Type
is
-- Find a source line for Node.
use WisiToken.Syntax_Trees;
Temp : Node_Index := Node;
begin
loop
if Tree.Min_Terminal_Index (Temp) = Invalid_Token_Index then
-- Node is empty or all virtual_identifiers; try parents.
Temp := Tree.Parent (Temp);
exit when Temp = Invalid_Node_Index;
else
return Data.Terminals.all (Tree.Min_Terminal_Index (Temp)).Line;
end if;
end loop;
return Invalid_Line_Number;
end Get_Line;
function Get_Text
(Data : in User_Data_Type;
Tree : in Syntax_Trees.Tree;
Tree_Index : in Syntax_Trees.Valid_Node_Index;
Strip_Quotes : in Boolean := False)
return String
is
use all type Syntax_Trees.Node_Label;
function Strip_Delimiters (Tree_Index : in Syntax_Trees.Valid_Node_Index) return String
is
Region : Buffer_Region renames Data.Terminals.all (Tree.Terminal (Tree_Index)).Byte_Region;
begin
if -Tree.ID (Tree_Index) in RAW_CODE_ID | REGEXP_ID | ACTION_ID then
-- Strip delimiters. We don't strip leading/trailing spaces to preserve indent.
return Data.Grammar_Lexer.Buffer_Text ((Region.First + 2, Region.Last - 2));
elsif -Tree.ID (Tree_Index) in STRING_LITERAL_1_ID | STRING_LITERAL_2_ID and Strip_Quotes then
return Data.Grammar_Lexer.Buffer_Text ((Region.First + 1, Region.Last - 1));
else
return Data.Grammar_Lexer.Buffer_Text (Region);
end if;
end Strip_Delimiters;
begin
case Tree.Label (Tree_Index) is
when Shared_Terminal =>
return Strip_Delimiters (Tree_Index);
when Virtual_Terminal =>
-- Terminal keyword inserted during tree edit. We could check for
-- Identifier, but that will be caught later.
return Image (Tree.ID (Tree_Index), Wisitoken_Grammar_Actions.Descriptor);
when Virtual_Identifier =>
if Strip_Quotes then
declare
Quoted : constant String := -Data.Tokens.Virtual_Identifiers (Tree.Identifier (Tree_Index));
begin
return Quoted (Quoted'First + 1 .. Quoted'Last - 1);
end;
else
return -Data.Tokens.Virtual_Identifiers (Tree.Identifier (Tree_Index));
end if;
when Nonterm =>
declare
use all type Ada.Strings.Unbounded.Unbounded_String;
Result : Ada.Strings.Unbounded.Unbounded_String;
Tree_Indices : constant Syntax_Trees.Valid_Node_Index_Array := Tree.Get_Terminals (Tree_Index);
Need_Space : Boolean := False;
begin
for Tree_Index of Tree_Indices loop
Result := Result & (if Need_Space then " " else "") &
Get_Text (Data, Tree, Tree_Index, Strip_Quotes);
Need_Space := True;
end loop;
return -Result;
end;
end case;
end Get_Text;
function Get_Child_Text
(Data : in User_Data_Type;
Tree : in Syntax_Trees.Tree;
Parent : in Syntax_Trees.Valid_Node_Index;
Child : in SAL.Peek_Type;
Strip_Quotes : in Boolean := False)
return String
is
Tree_Indices : constant Syntax_Trees.Valid_Node_Index_Array := Tree.Get_Terminals (Parent);
begin
return Get_Text (Data, Tree, Tree_Indices (Child), Strip_Quotes);
end Get_Child_Text;
procedure Start_If_1
(Data : in out User_Data_Type;
Tree : in Syntax_Trees.Tree;
A_Index : in Syntax_Trees.Valid_Node_Index;
B_Index : in Syntax_Trees.Valid_Node_Index)
is
use all type WisiToken.BNF.Generate_Algorithm;
use all type WisiToken.BNF.Lexer_Type;
begin
if "lexer" = Get_Text (Data, Tree, A_Index) then
Data.If_Lexer_Present := True;
Data.Ignore_Lines := Data.User_Lexer /= WisiToken.BNF.To_Lexer (Get_Text (Data, Tree, B_Index));
elsif "parser" = Get_Text (Data, Tree, A_Index) then
Data.If_Parser_Present := True;
Data.Ignore_Lines := Data.User_Parser /= WisiToken.BNF.Generate_Algorithm'Value
(Get_Text (Data, Tree, B_Index));
else
raise Grammar_Error with
Error_Message
(Data.Grammar_Lexer.File_Name, Data.Terminals.all (Tree.Min_Terminal_Index (A_Index)).Line,
"invalid '%if'; must be one of {lexer | parser}");
end if;
end Start_If_1;
function Get_RHS
(Data : in out User_Data_Type;
Tree : in Syntax_Trees.Tree;
Labels : in out WisiToken.BNF.String_Arrays.Vector;
Token : in Syntax_Trees.Valid_Node_Index)
return WisiToken.BNF.RHS_Type
is
use all type WisiToken.Syntax_Trees.Node_Index;
use all type SAL.Base_Peek_Type;
Children : constant Syntax_Trees.Valid_Node_Index_Array := Tree.Children (Token);
begin
pragma Assert (-Tree.ID (Token) = rhs_ID);
return RHS : WisiToken.BNF.RHS_Type do
RHS.Source_Line := Get_Line (Data, Tree, Token);
if Children'Length > 0 then
for I of Tree.Get_IDs (Children (1), +rhs_element_ID) loop
case Tree.RHS_Index (I) is
when 0 =>
-- rhs_item
RHS.Tokens.Append
((Label => +"",
Identifier => +Get_Text (Data, Tree, Tree.Child (I, 1))));
when 1 =>
-- IDENTIFIER = rhs_item
declare
Label : constant String := Get_Text (Data, Tree, Tree.Child (I, 1));
begin
RHS.Tokens.Append
((Label => +Label,
Identifier => +Get_Text (Data, Tree, Tree.Child (I, 3))));
if (for all L of Labels => -L /= Label) then
Labels.Append (+Label);
end if;
end;
when others =>
Raise_Programmer_Error ("Get_RHS; unimplimented token", Tree, I);
end case;
end loop;
if Children'Last >= 2 then
declare
Text : constant String := Get_Text (Data, Tree, Children (2));
begin
if Text'Length > 0 and (for some C of Text => C /= ' ') then
RHS.Action := +Text;
Data.Action_Count := Data.Action_Count + 1;
end if;
end;
end if;
if Children'Last >= 3 then
RHS.Check := +Get_Text (Data, Tree, Children (3));
Data.Check_Count := Data.Check_Count + 1;
end if;
end if;
end return;
exception
when SAL.Programmer_Error =>
raise;
when E : others =>
declare
use Ada.Exceptions;
begin
Raise_Programmer_Error ("Get_RHS: " & Exception_Name (E) & ": " & Exception_Message (E), Tree, Token);
end;
end Get_RHS;
procedure Get_Right_Hand_Sides
(Data : in out User_Data_Type;
Tree : in WisiToken.Syntax_Trees.Tree;
Right_Hand_Sides : in out WisiToken.BNF.RHS_Lists.List;
Labels : in out WisiToken.BNF.String_Arrays.Vector;
Token : in WisiToken.Syntax_Trees.Valid_Node_Index)
is
Tokens : constant Syntax_Trees.Valid_Node_Index_Array := Tree.Children (Token);
begin
pragma Assert (-Tree.ID (Token) = rhs_list_ID);
case Tree.RHS_Index (Token) is
when 0 =>
-- | rhs
if not Data.Ignore_Lines then
Right_Hand_Sides.Append (Get_RHS (Data, Tree, Labels, Tokens (1)));
end if;
when 1 =>
-- | rhs_list BAR rhs
Get_Right_Hand_Sides (Data, Tree, Right_Hand_Sides, Labels, Tokens (1));
if not Data.Ignore_Lines then
Right_Hand_Sides.Append (Get_RHS (Data, Tree, Labels, Tokens (3)));
end if;
when 2 =>
-- | rhs_list PERCENT IF IDENTIFIER EQUAL IDENTIFIER
Get_Right_Hand_Sides (Data, Tree, Right_Hand_Sides, Labels, Tokens (1));
Start_If_1 (Data, Tree, Tokens (4), Tokens (6));
when 3 =>
-- | rhs_list PERCENT END IF
Get_Right_Hand_Sides (Data, Tree, Right_Hand_Sides, Labels, Tokens (1));
Data.Ignore_Lines := False;
when others =>
Raise_Programmer_Error ("Get_Right_Hand_Sides", Tree, Token);
end case;
end Get_Right_Hand_Sides;
----------
-- Public subprograms, declaration order
overriding
procedure Set_Lexer_Terminals
(User_Data : in out User_Data_Type;
Lexer : in WisiToken.Lexer.Handle;
Terminals : in Base_Token_Array_Access)
is begin
User_Data.Grammar_Lexer := Lexer;
User_Data.Terminals := Terminals;
end Set_Lexer_Terminals;
overriding procedure Reset (Data : in out User_Data_Type)
is begin
-- Preserve data set in Phase Meta, or by Set_Lexer_Terminals, or by
-- wisitoken-bnf-generate.
-- Preserve Grammar_Lexer
-- Preserve User_Lexer
-- Preserve User_Parser
-- Perserve Generate_Set
-- Preserve Meta_Syntax
-- Preserve Phase
-- Preserve Terminals
-- Preserve Non_Grammar
-- EBNF_Nodes handled in Initialize_Actions
Data.Raw_Code := (others => <>);
Data.Language_Params :=
(Case_Insensitive => Data.Language_Params.Case_Insensitive,
others => <>);
Data.Tokens :=
(Virtual_Identifiers => Data.Tokens.Virtual_Identifiers,
others => <>);
Data.Conflicts.Clear;
Data.McKenzie_Recover := (others => <>);
Data.Rule_Count := 0;
Data.Action_Count := 0;
Data.Check_Count := 0;
Data.Label_Count := 0;
Data.If_Lexer_Present := False;
Data.If_Parser_Present := False;
Data.Ignore_Lines := False;
end Reset;
overriding procedure Initialize_Actions
(Data : in out User_Data_Type;
Tree : in WisiToken.Syntax_Trees.Tree'Class)
is begin
Data.EBNF_Nodes.Clear;
Data.EBNF_Nodes.Set_First_Last (Tree.First_Index, Tree.Last_Index);
end Initialize_Actions;
overriding
procedure Lexer_To_Augmented
(Data : in out User_Data_Type;
Token : in WisiToken.Base_Token;
Lexer : not null access WisiToken.Lexer.Instance'Class)
is
pragma Unreferenced (Lexer);
use all type Ada.Containers.Count_Type;
begin
if Token.ID < Wisitoken_Grammar_Actions.Descriptor.First_Terminal then
-- Non-grammar token
if Data.Non_Grammar.Length = 0 then
Data.Non_Grammar.Set_First_Last (0, 0);
end if;
if Data.Terminals.Length = 0 then
Data.Non_Grammar (0).Append (Token);
else
Data.Non_Grammar.Set_Last (Data.Terminals.Last_Index);
Data.Non_Grammar (Data.Terminals.Last_Index).Append (Token);
end if;
end if;
end Lexer_To_Augmented;
procedure Start_If
(User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class;
Tree : in WisiToken.Syntax_Trees.Tree;
Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array)
is begin
-- all phases
Start_If_1 (User_Data_Type (User_Data), Tree, Tokens (3), Tokens (5));
end Start_If;
procedure End_If (User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class)
is
Data : User_Data_Type renames User_Data_Type (User_Data);
begin
-- all phases
Data.Ignore_Lines := False;
end End_If;
procedure Add_Declaration
(User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class;
Tree : in WisiToken.Syntax_Trees.Tree;
Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array)
is
use all type WisiToken.Syntax_Trees.Node_Label;
use all type Ada.Strings.Unbounded.Unbounded_String;
Data : User_Data_Type renames User_Data_Type (User_Data);
function Token (Index : in SAL.Peek_Type) return Base_Token
is
use all type SAL.Base_Peek_Type;
begin
if Tokens'Last < Index then
raise SAL.Programmer_Error;
elsif Tree.Label (Tokens (Index)) /= WisiToken.Syntax_Trees.Shared_Terminal then
raise SAL.Programmer_Error with "token at " & Image (Tree.Byte_Region (Tokens (Index))) &
" is a " & WisiToken.Syntax_Trees.Node_Label'Image (Tree.Label (Tokens (Index))) &
", expecting Shared_Terminal";
else
return Data.Terminals.all (Tree.Terminal (Tokens (Index)));
end if;
end Token;
function Enum_ID (Index : in SAL.Peek_Type) return Token_Enum_ID
is (To_Token_Enum (Token (Index).ID));
begin
if Data.Phase = Meta then
if Tree.Label (Tokens (2)) = WisiToken.Syntax_Trees.Shared_Terminal then
case Enum_ID (2) is
when IDENTIFIER_ID =>
declare
Kind : constant String := Data.Grammar_Lexer.Buffer_Text (Token (2).Byte_Region);
begin
if Kind = "case_insensitive" then
Data.Language_Params.Case_Insensitive := True;
elsif Kind = "generate" then
declare
use all type SAL.Base_Peek_Type;
Children : constant Syntax_Trees.Valid_Node_Index_Array := Tree.Get_Terminals (Tokens (3));
Tuple : WisiToken.BNF.Generate_Tuple;
begin
Tuple.Gen_Alg := WisiToken.BNF.To_Generate_Algorithm (Get_Text (Data, Tree, Children (1)));
if Children'Last >= 2 then
Tuple.Out_Lang := WisiToken.BNF.To_Output_Language (Get_Text (Data, Tree, Children (2)));
end if;
for I in 3 .. SAL.Base_Peek_Type (Children'Length) loop
declare
Text : constant String := Get_Text (Data, Tree, Children (I));
begin
if Text = "text_rep" then
Tuple.Text_Rep := True;
elsif (for some I of WisiToken.BNF.Lexer_Image => Text = I.all) then
Tuple.Lexer := WisiToken.BNF.To_Lexer (Text);
elsif (for some I in WisiToken.BNF.Valid_Interface =>
WisiToken.BNF.To_Lower (Text) = WisiToken.BNF.To_Lower
(WisiToken.BNF.Valid_Interface'Image (I)))
then
Tuple.Interface_Kind := WisiToken.BNF.Valid_Interface'Value (Text);
else
declare
Token : Base_Token renames Data.Terminals.all (Tree.Terminal (Children (I)));
begin
raise Grammar_Error with Error_Message
(Data.Grammar_Lexer.File_Name, Token.Line, Token.Column,
"invalid generate param '" & Text & "'");
end;
end if;
end;
end loop;
WisiToken.BNF.Add (Data.Generate_Set, Tuple);
end;
elsif Kind = "meta_syntax" then
if Data.Meta_Syntax = Unknown then
-- Don't overwrite; somebody set it for a reason.
declare
Value_Str : constant String := WisiToken.BNF.To_Lower (Get_Text (Data, Tree, Tokens (3)));
begin
if Value_Str = "bnf" then
Data.Meta_Syntax := BNF_Syntax;
elsif Value_Str = "ebnf" then
Data.Meta_Syntax := EBNF_Syntax;
Data.EBNF_Nodes (Tree.Find_Ancestor (Tokens (2), +declaration_ID)) := True;
else
Put_Error ("invalid value for %meta_syntax; must be BNF | EBNF.");
end if;
end;
end if;
end if;
end;
when others =>
null;
end case;
end if;
return;
end if;
-- Add declaration to User_Data.Generate_Set, Language_Params,
-- Tokens, Conflicts, or McKenzie_Recover.
if Data.Ignore_Lines then
return;
end if;
case Tree.Label (Tokens (2)) is
when Syntax_Trees.Nonterm =>
-- must be token_keyword_non_grammar
declare
Children : Syntax_Trees.Valid_Node_Index_Array renames Tree.Children (Tokens (2));
Child_1_ID : constant Token_Enum_ID := To_Token_Enum (Tree.ID (Children (1)));
begin
case Child_1_ID is
when Wisitoken_Grammar_Actions.TOKEN_ID =>
WisiToken.BNF.Add_Token
(Data.Tokens.Tokens,
Kind => Get_Text (Data, Tree, Children (3)),
Name => Get_Text (Data, Tree, Tokens (3)),
Value => Get_Text (Data, Tree, Tokens (4)));
when KEYWORD_ID =>
Data.Tokens.Keywords.Append
((Name => +Get_Text (Data, Tree, Tokens (3)),
Value => +Get_Text (Data, Tree, Tokens (4))));
when NON_GRAMMAR_ID =>
WisiToken.BNF.Add_Token
(Data.Tokens.Non_Grammar,
Kind => Get_Text (Data, Tree, Children (3)),
Name => Get_Text (Data, Tree, Tokens (3)),
Value => Get_Text (Data, Tree, Tokens (4)));
when others =>
raise SAL.Programmer_Error;
end case;
end;
when Syntax_Trees.Shared_Terminal =>
case Enum_ID (2) is
when CODE_ID =>
declare
Location : WisiToken.BNF.Raw_Code_Location;
-- % code identifier_list raw_code
-- 1 2 3 4
--
-- identifier_list = "action spec context"
-- identifier_list children = identifier_list IDENTIFIER_ID
-- children = identifier_list IDENTIFIER_ID
-- children = IDENTIFIER_ID
function Get_Loc_List return Base_Token_Array
is
use all type SAL.Base_Peek_Type;
use WisiToken.Syntax_Trees;
Node : Valid_Node_Index := Tokens (3);
Result : Base_Token_Array (1 .. 3);
First : SAL.Peek_Type := Result'Last + 1;
begin
loop
pragma Assert (-Tree.ID (Node) = identifier_list_ID);
exit when not Tree.Has_Children (Node);
declare
Children : constant Valid_Node_Index_Array := Tree.Children (Node);
begin
if Children'Length = 1 then
-- identifier_list : IDENTIFIER
First := First - 1;
Result (First) := Data.Terminals.all (Tree.Terminal (Children (1)));
exit;
elsif Children'Length = 2 then
-- identifier_list : identifier_list IDENTIFIER
First := First - 1;
Result (First) := Data.Terminals.all (Tree.Terminal (Children (2)));
Node := Children (1);
else
raise SAL.Programmer_Error;
end if;
end;
end loop;
return Result (First .. Result'Last);
end Get_Loc_List;
Loc_List : constant Base_Token_Array := Get_Loc_List;
function Get_Loc (Index : in SAL.Peek_Type) return String
is (Data.Grammar_Lexer.Buffer_Text (Loc_List (Index).Byte_Region));
begin
if Get_Loc (Loc_List'First) = "actions" then
Location :=
(if Get_Loc (2) = "spec" then
(if Get_Loc (3) = "context" then WisiToken.BNF.Actions_Spec_Context
elsif Get_Loc (3) = "pre" then WisiToken.BNF.Actions_Spec_Pre
elsif Get_Loc (3) = "post" then WisiToken.BNF.Actions_Spec_Post
else raise Grammar_Error with
Error_Message
(Data.Grammar_Lexer.File_Name, Loc_List (2).Line,
"expecting {context | pre | post}"))
elsif Get_Loc (2) = "body" then
(if Get_Loc (3) = "context" then WisiToken.BNF.Actions_Body_Context
elsif Get_Loc (3) = "pre" then WisiToken.BNF.Actions_Body_Pre
elsif Get_Loc (3) = "post" then WisiToken.BNF.Actions_Body_Post
else raise Grammar_Error with
Error_Message
(Data.Grammar_Lexer.File_Name, Loc_List (2).Line,
"expecting {context | pre | post}"))
else raise Grammar_Error);
elsif Get_Loc (Loc_List'First) = "copyright_license" then
Location := WisiToken.BNF.Copyright_License;
else
raise Grammar_Error with
Error_Message
(Data.Grammar_Lexer.File_Name, Loc_List (Loc_List'First).Line,
"expecting {actions | copyright_license}");
end if;
Data.Raw_Code (Location) := WisiToken.BNF.Split_Lines (Get_Text (Data, Tree, Tokens (4)));
exception
when Grammar_Error =>
Put_Error
(Error_Message
(Data.Grammar_Lexer.File_Name, Token (2).Line, Token (2).Column,
"invalid raw code location; actions {spec | body} {context | pre | post}"));
end;
when IDENTIFIER_ID =>
declare
Kind : constant String := Data.Grammar_Lexer.Buffer_Text (Token (2).Byte_Region);
begin
-- Alphabetical by Kind
if Kind = "case_insensitive" then
-- Not in phase Other
null;
elsif Kind = "conflict" then
declare
Tree_Indices : constant Syntax_Trees.Valid_Node_Index_Array := Tree.Get_Terminals
(Tokens (3));
-- %conflict <action_a>/<action_b> in state <LHS_A>, <LHS_B> on token <on>
-- 1 2 3 4 5 6 7 8 9 10 11
begin
Data.Conflicts.Append
((Source_Line => Data.Terminals.all (Tree.Terminal (Tree_Indices (1))).Line,
Action_A => +Get_Text (Data, Tree, Tree_Indices (1)),
LHS_A => +Get_Text (Data, Tree, Tree_Indices (6)),
Action_B => +Get_Text (Data, Tree, Tree_Indices (3)),
LHS_B => +Get_Text (Data, Tree, Tree_Indices (8)),
On => +Get_Text (Data, Tree, Tree_Indices (11))));
end;
elsif Kind = "end" then
-- matching '%if' specified current lexer.
null;
elsif Kind = "elisp_face" then
Data.Tokens.Faces.Append (Get_Text (Data, Tree, Tokens (3), Strip_Quotes => True));
elsif Kind = "elisp_indent" then
Data.Tokens.Indents.Append
((Name => +Get_Child_Text (Data, Tree, Tokens (3), 1, Strip_Quotes => True),
Value => +Get_Child_Text (Data, Tree, Tokens (3), 2)));
elsif Kind = "elisp_action" then
Data.Tokens.Actions.Insert
(Key => +Get_Child_Text (Data, Tree, Tokens (3), 2),
New_Item =>
(Action_Label => +Get_Child_Text (Data, Tree, Tokens (3), 1),
Ada_Name => +Get_Child_Text (Data, Tree, Tokens (3), 3)));
elsif Kind = "end_names_optional_option" then
Data.Language_Params.End_Names_Optional_Option := +Get_Text (Data, Tree, Tokens (3));
elsif Kind = "generate" then
-- Not in Other phase
null;
elsif Kind = "language_runtime" then
Data.Language_Params.Language_Runtime_Name :=
+Get_Text (Data, Tree, Tokens (3), Strip_Quotes => True);
elsif Kind = "mckenzie_check_limit" then
Data.Language_Params.Error_Recover := True;
Data.McKenzie_Recover.Check_Limit := Token_Index'Value (Get_Text (Data, Tree, Tokens (3)));
elsif Kind = "mckenzie_check_delta_limit" then
Data.Language_Params.Error_Recover := True;
Data.McKenzie_Recover.Check_Delta_Limit := Integer'Value (Get_Text (Data, Tree, Tokens (3)));
elsif Kind = "mckenzie_cost_default" then
if Tree.Get_Terminals (Tokens (3))'Length /= 4 then
raise Grammar_Error with
Error_Message
(Data.Grammar_Lexer.File_Name, Data.Terminals.all (Tree.Min_Terminal_Index (Tokens (3))).Line,
"too " & (if Tree.Get_Terminals (Tokens (3))'Length > 4 then "many" else "few") &
" default costs; should be 'insert, delete, push back, ignore check fail'.");
end if;
Data.Language_Params.Error_Recover := True;
Data.McKenzie_Recover.Source_Line := Data.Terminals.all (Tree.Min_Terminal_Index (Tokens (1))).Line;
Data.McKenzie_Recover.Default_Insert := Natural'Value
(Get_Child_Text (Data, Tree, Tokens (3), 1));
Data.McKenzie_Recover.Default_Delete_Terminal := Natural'Value
(Get_Child_Text (Data, Tree, Tokens (3), 2));
Data.McKenzie_Recover.Default_Push_Back := Natural'Value
(Get_Child_Text (Data, Tree, Tokens (3), 3));
Data.McKenzie_Recover.Ignore_Check_Fail := Natural'Value
(Get_Child_Text (Data, Tree, Tokens (3), 4));
elsif Kind = "mckenzie_cost_delete" then
Data.Language_Params.Error_Recover := True;
Data.McKenzie_Recover.Delete.Append
((+Get_Child_Text (Data, Tree, Tokens (3), 1),
+Get_Child_Text (Data, Tree, Tokens (3), 2)));
elsif Kind = "mckenzie_cost_fast_forward" then
Data.Language_Params.Error_Recover := True;
Data.McKenzie_Recover.Fast_Forward :=
Integer'Value (Get_Text (Data, Tree, Tokens (3)));
elsif Kind = "mckenzie_cost_insert" then
Data.Language_Params.Error_Recover := True;
Data.McKenzie_Recover.Insert.Append
((+Get_Child_Text (Data, Tree, Tokens (3), 1),
+Get_Child_Text (Data, Tree, Tokens (3), 2)));
elsif Kind = "mckenzie_cost_matching_begin" then
Data.Language_Params.Error_Recover := True;
Data.McKenzie_Recover.Matching_Begin :=
Integer'Value (Get_Text (Data, Tree, Tokens (3)));
elsif Kind = "mckenzie_cost_push_back" then
Data.Language_Params.Error_Recover := True;
Data.McKenzie_Recover.Push_Back.Append
((+Get_Child_Text (Data, Tree, Tokens (3), 1),
+Get_Child_Text (Data, Tree, Tokens (3), 2)));
elsif Kind = "mckenzie_cost_undo_reduce" then
Data.Language_Params.Error_Recover := True;
Data.McKenzie_Recover.Undo_Reduce.Append
((+Get_Child_Text (Data, Tree, Tokens (3), 1),
+Get_Child_Text (Data, Tree, Tokens (3), 2)));
elsif Kind = "mckenzie_enqueue_limit" then
Data.Language_Params.Error_Recover := True;
Data.McKenzie_Recover.Enqueue_Limit := Natural'Value (Get_Text (Data, Tree, Tokens (3)));
elsif Kind = "mckenzie_minimal_complete_cost_delta" then
Data.Language_Params.Error_Recover := True;
Data.McKenzie_Recover.Minimal_Complete_Cost_Delta :=
Integer'Value (Get_Text (Data, Tree, Tokens (3)));
elsif Kind = "meta_syntax" then
-- not in Other phase
null;
elsif Kind = "no_enum" then
Data.Language_Params.Declare_Enums := False;
elsif Kind = "no_language_runtime" then
Data.Language_Params.Use_Language_Runtime := False;
elsif Kind = "partial_recursion" then
Data.Language_Params.Partial_Recursion := True;
elsif Kind = "start" then
Data.Language_Params.Start_Token := +Get_Text (Data, Tree, Tokens (3));
elsif Kind = "re2c_regexp" then
Data.Tokens.re2c_Regexps.Append
((+Get_Child_Text (Data, Tree, Tokens (3), 1),
+Get_Child_Text (Data, Tree, Tokens (3), 2)));
else
raise Grammar_Error with Error_Message
(Data.Grammar_Lexer.File_Name, Token (2).Line, Token (2).Column, "unexpected syntax");
end if;
end;
when others =>
raise Grammar_Error with Error_Message
(Data.Grammar_Lexer.File_Name, Token (2).Line, Token (2).Column, "unexpected syntax");
end case;
when Syntax_Trees.Virtual_Terminal | Syntax_Trees.Virtual_Identifier =>
raise SAL.Programmer_Error;
end case;
end Add_Declaration;
procedure Add_Nonterminal
(User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class;
Tree : in WisiToken.Syntax_Trees.Tree;
Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array)
is
use all type Ada.Containers.Count_Type;
use WisiToken.Syntax_Trees;
Data : User_Data_Type renames User_Data_Type (User_Data);
LHS_Node : constant Valid_Node_Index := Tokens (1);
LHS_String : constant String := Get_Text (Data, Tree, LHS_Node);
Right_Hand_Sides : WisiToken.BNF.RHS_Lists.List;
Labels : WisiToken.BNF.String_Arrays.Vector;
begin
if Data.Phase = Meta or Data.Ignore_Lines then
return;
end if;
Data.Rule_Count := Data.Rule_Count + 1;
Get_Right_Hand_Sides (Data, Tree, Right_Hand_Sides, Labels, Tokens (3));
if WisiToken.BNF.Is_Present (Data.Tokens.Rules, LHS_String) then
case Tree.Label (LHS_Node) is
when Shared_Terminal =>
declare
LHS_Token : Base_Token renames Data.Terminals.all (Tree.Terminal (LHS_Node));
begin
raise Grammar_Error with Error_Message
(Data.Grammar_Lexer.File_Name, LHS_Token.Line, LHS_Token.Column, "duplicate nonterm");
end;
when Virtual_Identifier =>
raise Grammar_Error with Error_Message
(Data.Grammar_Lexer.File_Name, 1, 1, "duplicate virtual nonterm '" & LHS_String & "'");
when others =>
Raise_Programmer_Error ("Add_Nonterminal", Tree, LHS_Node);
end case;
else
Data.Label_Count := Data.Label_Count + Labels.Length;
Data.Tokens.Rules.Append
((+LHS_String, Right_Hand_Sides, Labels,
Source_Line =>
(case Tree.Label (LHS_Node) is
when Shared_Terminal => Data.Terminals.all (Tree.Min_Terminal_Index (LHS_Node)).Line,
when Virtual_Identifier => Invalid_Line_Number, -- IMPROVEME: get line from Right_Hand_Sides
when others => raise SAL.Programmer_Error)));
end if;
end Add_Nonterminal;
procedure Check_EBNF
(User_Data : in out WisiToken.Syntax_Trees.User_Data_Type'Class;
Tree : in WisiToken.Syntax_Trees.Tree;
Tokens : in WisiToken.Syntax_Trees.Valid_Node_Index_Array;
Token : in WisiToken.Positive_Index_Type)
is
Data : User_Data_Type renames User_Data_Type (User_Data);
begin
case Data.Phase is
when Meta =>
Data.EBNF_Nodes (Tokens (Token)) := True;
if Data.Meta_Syntax /= EBNF_Syntax then
declare
Tok : Base_Token renames Data.Terminals.all (Tree.Min_Terminal_Index (Tokens (Token)));
begin
raise Grammar_Error with Error_Message
(Data.Grammar_Lexer.File_Name, Tok.Line, Tok.Column,
"EBNF syntax used, but BNF specified; set '%meta_syntax EBNF'");
end;
end if;
when Other =>
Raise_Programmer_Error ("untranslated EBNF node", Tree, Tree.Parent (Tokens (Token)));
end case;
end Check_EBNF;
procedure Translate_EBNF_To_BNF
(Tree : in out WisiToken.Syntax_Trees.Tree;
Data : in out User_Data_Type)
is
use WisiToken.Syntax_Trees;
Copied_EBNF_Nodes : WisiToken.Syntax_Trees.Valid_Node_Index_Arrays.Vector;
Symbol_Regexp : constant GNAT.Regexp.Regexp := GNAT.Regexp.Compile
((if Data.Language_Params.Case_Insensitive
then "[A-Z0-9_]+"
else "[a-zA-Z0-9_]+"),
Case_Sensitive => not Data.Language_Params.Case_Insensitive);
procedure Clear_EBNF_Node (Node : in Valid_Node_Index)
is begin
if Node in Data.EBNF_Nodes.First_Index .. Data.EBNF_Nodes.Last_Index then
Data.EBNF_Nodes (Node) := False;
-- else in Copied_EBNF_Nodes; don't need to delete from there.
end if;
end Clear_EBNF_Node;
function New_Identifier (Text : in String) return Identifier_Index
is
ID : constant Identifier_Index := Base_Identifier_Index (Data.Tokens.Virtual_Identifiers.Length) + 1;
begin
Data.Tokens.Virtual_Identifiers.Append (+Text);
return ID;
end New_Identifier;
Keyword_Ident : constant Identifier_Index := New_Identifier ("keyword");
Percent_Ident : constant Identifier_Index := New_Identifier ("percent");
function Next_Nonterm_Name (Suffix : in String := "") return Identifier_Index
is
function Image is new SAL.Generic_Decimal_Image (Identifier_Index);
ID : constant Identifier_Index := Identifier_Index (Data.Tokens.Virtual_Identifiers.Length) + 1;
begin
if ID > 999 then
-- We assume 3 digits below
raise SAL.Programmer_Error with "more than 3 digits needed for virtual identifiers in EBNF translate";
end if;
Data.Tokens.Virtual_Identifiers.Append (+("nonterminal_" & Image (ID, Width => 3) & Suffix));
return ID;
end Next_Nonterm_Name;
function Tree_Add_Nonterminal
(Child_1 : in Valid_Node_Index;
Child_2 : in Valid_Node_Index;
Child_3 : in Valid_Node_Index;
Child_4 : in Valid_Node_Index)
return Valid_Node_Index
is begin
-- Work around GNAT error about arbitrary evaluation order in
-- aggregates (no error about the arbitrary order in subprogram
-- parameter_assocation_lists!).
return Tree.Add_Nonterm
(Production => (+nonterminal_ID, 0),
Children => (Child_1, Child_2, Child_3, Child_4),
Action => Wisitoken_Grammar_Actions.nonterminal_0'Access);
end Tree_Add_Nonterminal;
function List_Root (Item : in Valid_Node_Index) return Valid_Node_Index
is
List_ID : constant WisiToken.Token_ID := Tree.ID (Item);
Node : Valid_Node_Index := Item;
begin
loop
exit when Tree.ID (Tree.Parent (Node)) /= List_ID;
Node := Tree.Parent (Node);
end loop;
return Node;
end List_Root;
function List_Singleton (Root : in Valid_Node_Index) return Boolean
is begin
return Tree.RHS_Index (Root) = 0;
end List_Singleton;
function First_List_Element (Root : in Valid_Node_Index; Element_ID : in WisiToken.Token_ID) return Node_Index
is
List_ID : constant WisiToken.Token_ID := Tree.ID (Root);
-- Return the first child with Element_ID in list of List_IDs. This
-- is not the same as Find_Descendant, because we check the children
-- first, and only the first child.
Node : Node_Index := Root;
begin
loop
declare
Children : constant Valid_Node_Index_Array := Tree.Children (Node);
begin
if Tree.ID (Children (1)) = List_ID then
Node := Children (1);
elsif Tree.ID (Children (1)) = Element_ID then
Node := Children (1);
exit;
else
Raise_Programmer_Error ("first_list_element", Tree, Node);
end if;
end;
end loop;
return Node;
end First_List_Element;
function Last_List_Element (Root : in Valid_Node_Index) return Node_Index
is
-- Tree is one of:
--
-- case a: single element list
-- element_list : root
-- | element: Last
--
-- case c: no next
-- element_list: root
-- | element_list
-- | | element:
-- | element: Last
Children : constant Valid_Node_Index_Array := Tree.Children (Root);
begin
return Children (Children'Last);
end Last_List_Element;
function Next_List_Element
(Element : in Valid_Node_Index;
List_ID : in WisiToken.Token_ID)
return Node_Index
with Pre => Tree.Parent (Element, 2) /= Invalid_Node_Index and then
Tree.ID (Tree.Parent (Element)) = List_ID
is
use all type SAL.Base_Peek_Type;
-- Tree is one of:
--
-- case a: first element, no next
-- rhs
-- | rhs_item_list
-- | | rhs_item: Element
-- | action
--
-- case b: first element, next
-- rhs_item_list
-- | rhs_item_list
-- | | rhs_item: Element
-- | rhs_item: next element
--
-- case c: non-first element, no next
-- rhs
-- | rhs_item_list
-- | | rhs_item_list
-- | | | rhs_item:
-- | | rhs_item: Element
-- | action
--
-- case d: non-first element, next
-- rhs_item_list
-- | rhs_item_list
-- | | rhs_item_list
-- | | | rhs_item:
-- | | rhs_item: Element
-- | rhs_item: next element
Element_ID : constant WisiToken.Token_ID := Tree.ID (Element);
Grand_Parent : constant Valid_Node_Index := Tree.Parent (Element, 2);
Aunts : constant Valid_Node_Index_Array := Tree.Children (Grand_Parent);
Last_List_Child : SAL.Base_Peek_Type := Aunts'First - 1;
begin
if Tree.ID (Grand_Parent) /= List_ID then
-- No next
return Invalid_Node_Index;
end if;
-- Children may be non-list items; ACTION in an rhs_list, for example.
for I in Aunts'Range loop
if Tree.ID (Aunts (I)) in List_ID | Element_ID then
Last_List_Child := I;
end if;
end loop;
if Last_List_Child = 1 then
-- No next
return Invalid_Node_Index;
else
return Aunts (2);
end if;
end Next_List_Element;
function Prev_List_Element
(Element : in Valid_Node_Index;
List_ID : in WisiToken.Token_ID)
return Node_Index
with Pre => Tree.Parent (Element) /= Invalid_Node_Index and then
Tree.ID (Tree.Parent (Element)) = List_ID
is
-- Tree is one of:
--
-- case a: first element, no prev
-- ?
-- | rhs_item_list
-- | | rhs_item: Element
--
-- case b: second element
-- ?
-- | rhs_item_list
-- | | rhs_item: prev item
-- | rhs_item: Element
--
-- case c: nth element
-- ?
-- | rhs_item_list
-- | | rhs_item_list
-- | | | rhs_item:
-- | | rhs_item: prev element
-- | rhs_item: Element
Parent : constant Valid_Node_Index := Tree.Parent (Element);
begin
if Element = Tree.Child (Parent, 1) then
-- No prev
return Invalid_Node_Index;
else
declare
Prev_Children : constant Valid_Node_Index_Array := Tree.Children (Tree.Child (Parent, 1));
begin
return Prev_Children (Prev_Children'Last);
end;
end if;
end Prev_List_Element;
procedure Append_Element
(Tail_List : in Valid_Node_Index;
New_Element : in Valid_Node_Index;
Separator_ID : in WisiToken.Token_ID := Invalid_Token_ID)
is
-- Tail_List is preserved.
-- Current tree is one of:
--
-- case a:
-- rhs_list: Tail_List
-- | rhs: Orig_Element_1
--
-- case b:
-- rhs_list: Tail_List
-- | rhs_list: Orig_List_1
-- | | rhs: Orig_Element_1
-- | BAR
-- | rhs: Orig_Element_2
-- New tree:
--
-- case a:
-- rhs_list: keep Tail_List
-- | rhs_list: new
-- | | rhs: keep; Orig_Element_1
-- | BAR
-- | rhs: New_Element
--
-- case b:
-- rhs_list: keep Tail_List
-- | rhs_list: new;
-- | | rhs_list: keep Orig_List_1
-- | | | rhs: keep Orig_Element_1
-- | | BAR: keep
-- | | rhs: keep Orig_Element_2
-- | BAR: new
-- | rhs: New_Element
List_ID : constant WisiToken.Token_ID := Tree.ID (Tail_List);
Children : constant Valid_Node_Index_Array := Tree.Children (Tail_List);
New_List_Item : constant Valid_Node_Index := Tree.Add_Nonterm
((List_ID, (if Children'Length = 1 then 0 else 1)), Children);
begin
if Separator_ID = Invalid_Token_ID then
Tree.Set_Children (Tail_List, (List_ID, 1), (New_List_Item, New_Element));
else
Tree.Set_Children
(Tail_List, (List_ID, 1), (New_List_Item, Tree.Add_Terminal (Separator_ID), New_Element));
end if;
end Append_Element;
procedure Insert_Optional_RHS (B : in Valid_Node_Index)
is
-- B is an optional item in an rhs_item_list :
-- | a b? c
--
-- Insert a second rhs_item_list without B
--
-- The containing elment may be rhs or rhs_alternative_list
Container : constant Valid_Node_Index := Tree.Find_Ancestor
(B, (+rhs_ID, +rhs_alternative_list_ID));
Orig_RHS_Element_C_Head : constant Node_Index := Next_List_Element
(Tree.Parent (B, 2), +rhs_item_list_ID);
Orig_RHS_Item_List_C_Root : constant Valid_Node_Index := List_Root (Tree.Parent (B, 3));
Orig_RHS_Item_List_A_Root : constant Valid_Node_Index := Tree.Child (Tree.Parent (B, 3), 1);
Orig_RHS_Element_A_Head : constant Node_Index :=
(if Orig_RHS_Item_List_A_Root = Tree.Parent (B, 2)
then Invalid_Node_Index -- a is empty
else First_List_Element (Orig_RHS_Item_List_A_Root, +rhs_element_ID));
Container_List : constant Valid_Node_Index :=
(if Tree.ID (Container) = +rhs_ID then Tree.Parent (Container) else Container);
New_RHS_Item_List_A : Node_Index := Invalid_Node_Index;
New_RHS_Item_List_C : Node_Index := Invalid_Node_Index;
New_RHS_AC : Valid_Node_Index;
function Add_Actions (RHS_Item_List : Valid_Node_Index) return Valid_Node_Index
with Pre => Tree.ID (Container) = +rhs_ID
is
Orig_RHS_Children : constant Valid_Node_Index_Array := Tree.Children (Container);
begin
case Tree.RHS_Index (Container) is
when 1 =>
return Tree.Add_Nonterm ((+rhs_ID, 1), (1 => RHS_Item_List));
when 2 =>
return Tree.Add_Nonterm
((+rhs_ID, 2),
(1 => RHS_Item_List,
2 => Tree.Add_Terminal
(Tree.Min_Terminal_Index (Orig_RHS_Children (2)),
Data.Terminals.all)));
when 3 =>
return Tree.Add_Nonterm
((+rhs_ID, 3),
(1 => RHS_Item_List,
2 => Tree.Add_Terminal
(Tree.Min_Terminal_Index (Orig_RHS_Children (2)),
Data.Terminals.all),
3 => Tree.Add_Terminal
(Tree.Min_Terminal_Index (Orig_RHS_Children (3)),
Data.Terminals.all)));
when others =>
Raise_Programmer_Error
("translate_ebnf_to_bnf insert_optional_rhs unimplemented RHS", Tree, Container);
end case;
end Add_Actions;
begin
if Orig_RHS_Element_A_Head /= Invalid_Node_Index then
-- a is not empty
New_RHS_Item_List_A := Tree.Copy_Subtree
(Last => Orig_RHS_Element_A_Head,
Root => Orig_RHS_Item_List_A_Root);
if Trace_Generate > Extra then
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("new a:");
Tree.Print_Tree (Wisitoken_Grammar_Actions.Descriptor, New_RHS_Item_List_A);
end if;
end if;
if Orig_RHS_Element_C_Head /= Invalid_Node_Index then
-- c is not empty
New_RHS_Item_List_C := Tree.Copy_Subtree
(Last => Orig_RHS_Element_C_Head,
Root => Orig_RHS_Item_List_C_Root);
if Trace_Generate > Extra then
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("new c:");
Tree.Print_Tree (Wisitoken_Grammar_Actions.Descriptor, New_RHS_Item_List_C);
end if;
end if;
if New_RHS_Item_List_C = Invalid_Node_Index then
if New_RHS_Item_List_A = Invalid_Node_Index then
-- a c is empty; there cannot be any actions.
New_RHS_AC :=
(if Tree.ID (Container) = +rhs_ID
then Tree.Add_Nonterm ((+rhs_ID, 0), (1 .. 0 => Invalid_Node_Index))
else Tree.Add_Nonterm ((+rhs_item_list_ID, 0), (1 .. 0 => Invalid_Node_Index)));
else
-- c is empty
New_RHS_AC :=
(if Tree.ID (Container) = +rhs_ID
then Add_Actions (New_RHS_Item_List_A)
else New_RHS_Item_List_A);
end if;
else
-- c is not empty
if New_RHS_Item_List_A = Invalid_Node_Index then
-- a is empty
New_RHS_AC :=
(if Tree.ID (Container) = +rhs_ID
then Add_Actions (New_RHS_Item_List_C)
else New_RHS_Item_List_C);
else
declare
Tail_Element_A : constant Valid_Node_Index := Last_List_Element (New_RHS_Item_List_A);
Head_Element_B : constant Valid_Node_Index := First_List_Element
(New_RHS_Item_List_C, +rhs_element_ID);
begin
Tree.Set_Children
(Tree.Parent (Head_Element_B),
(+rhs_item_list_ID, 1),
(Tree.Parent (Tail_Element_A), Head_Element_B));
end;
New_RHS_AC :=
(if Tree.ID (Container) = +rhs_ID
then Add_Actions (New_RHS_Item_List_C)
else New_RHS_Item_List_C);
end if;
end if;
if Trace_Generate > Extra then
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("new ac:");
Tree.Print_Tree (Wisitoken_Grammar_Actions.Descriptor, New_RHS_AC);
end if;
-- Record copied EBNF nodes
declare
procedure Record_Copied_Node
(Tree : in out WisiToken.Syntax_Trees.Tree;
Node : in WisiToken.Syntax_Trees.Valid_Node_Index)
is begin
if To_Token_Enum (Tree.ID (Node)) in
rhs_optional_item_ID |
rhs_multiple_item_ID |
rhs_group_item_ID |
rhs_attribute_ID |
STRING_LITERAL_2_ID
then
Copied_EBNF_Nodes.Append (Node);
end if;
end Record_Copied_Node;
begin
Tree.Process_Tree (Record_Copied_Node'Access, New_RHS_AC);
end;
Append_Element (Container_List, New_RHS_AC, +BAR_ID);
end Insert_Optional_RHS;
Compilation_Unit_List_Tail : constant Valid_Node_Index := Tree.Child (Tree.Root, 1);
procedure Add_Compilation_Unit (Unit : in Valid_Node_Index; Prepend : in Boolean := False)
is
Comp_Unit : constant Valid_Node_Index := Tree.Add_Nonterm
((+compilation_unit_ID, (if Tree.ID (Unit) = +declaration_ID then 0 else 1)),
(1 => Unit));
begin
if Prepend then
Append_Element
(Tree.Parent (First_List_Element (Compilation_Unit_List_Tail, +compilation_unit_ID)), Comp_Unit);
else
Append_Element (Compilation_Unit_List_Tail, Comp_Unit);
end if;
if Trace_Generate > Extra then
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("new comp_unit:");
Tree.Print_Tree (Wisitoken_Grammar_Actions.Descriptor, Unit);
end if;
end Add_Compilation_Unit;
function To_RHS_List (RHS_Element : in Valid_Node_Index) return Valid_Node_Index
with Pre => Tree.ID (RHS_Element) = +rhs_element_ID
is
RHS_Item_List : constant Valid_Node_Index := Tree.Add_Nonterm ((+rhs_item_list_ID, 0), (1 => RHS_Element));
RHS : constant Valid_Node_Index := Tree.Add_Nonterm ((+rhs_ID, 1), (1 => RHS_Item_List));
begin
return Tree.Add_Nonterm ((+rhs_list_ID, 0), (1 => RHS));
end To_RHS_List;
function Convert_RHS_Alternative (Content : in Valid_Node_Index) return Valid_Node_Index
is
-- Convert rhs_alternative_list rooted at Content to an rhs_list
Node : Valid_Node_Index := Content;
begin
loop
exit when Tree.RHS_Index (Node) = 0;
-- current tree:
-- rhs_alternative_list : Node
-- | rhs_alternative_list: Node.Child (1)
-- | | ...
-- | BAR: Node.child (2)
-- | rhs_item_list: Node.Child (3)
-- new tree:
-- rhs_list: Node
-- | rhs_alternative_list: keep Node.Child (1)
-- | | ...
-- | BAR: keep
-- | rhs: new
-- | | rhs_item_list: keep Node,Child (3)
Tree.Set_Children
(Node,
(+rhs_list_ID, 1),
(1 => Tree.Child (Node, 1),
2 => Tree.Child (Node, 2),
3 => Tree.Add_Nonterm
((+rhs_ID, 1),
(1 => Tree.Child (Node, 3)))));
Clear_EBNF_Node (Node);
Node := Tree.Child (Node, 1);
end loop;
-- current tree:
-- rhs_alternative_list : Node
-- | rhs_item_list: Node.Child (1)
-- new tree:
-- rhs_list: Node
-- | rhs: new
-- | | rhs_item_list: Node.Child (1)
Tree.Set_Children
(Node,
(+rhs_list_ID, 0),
(1 => Tree.Add_Nonterm ((+rhs_ID, 1), (1 => Tree.Child (Node, 1)))));
Clear_EBNF_Node (Content);
return Content;
end Convert_RHS_Alternative;
procedure New_Nonterminal
(New_Identifier : in Identifier_Index;
Content : in Valid_Node_Index)
with Pre => To_Token_Enum (Tree.ID (Content)) in rhs_alternative_list_ID | rhs_element_ID
is
-- Convert subtree rooted at Content to an rhs_list contained by a new nonterminal
-- named New_Identifier.
New_Nonterm : constant Valid_Node_Index := Tree_Add_Nonterminal
(Child_1 => Tree.Add_Identifier (+IDENTIFIER_ID, New_Identifier, Tree.Byte_Region (Content)),
Child_2 => Tree.Add_Terminal (+COLON_ID),
Child_3 =>
(case To_Token_Enum (Tree.ID (Content)) is
when rhs_element_ID => To_RHS_List (Content),
when rhs_alternative_list_ID => Convert_RHS_Alternative (Content),
when others => raise SAL.Programmer_Error with "new_nonterminal unimplemented content" &
Tree.Image (Content, Wisitoken_Grammar_Actions.Descriptor)),
Child_4 => Tree.Add_Nonterm
((+semicolon_opt_ID, 0),
(1 => Tree.Add_Terminal (+SEMICOLON_ID))));
begin
Add_Compilation_Unit (New_Nonterm);
end New_Nonterminal;
procedure New_Nonterminal_List_1
(List_Nonterm : in Identifier_Index;
RHS_Element_1 : in Valid_Node_Index;
RHS_Element_3 : in Valid_Node_Index;
Byte_Region : in Buffer_Region)
is
-- nonterminal: foo_list
-- | IDENTIFIER: "foo_list" List_Nonterm
-- | COLON:
-- | rhs_list:
-- | | rhs_list: RHS_List_2
-- | | | rhs: RHS_2
-- | | | | rhs_item_list: RHS_Item_List_1
-- | | | | | rhs_element: RHS_Element_1
-- | | | | | | rhs_item: RHS_Item_1
-- | | | | | | | IDENTIFIER: List_Element
-- | | BAR:
-- | | rhs: RHS_3
-- | | | rhs_item_list: RHS_Item_List_2
-- | | | | | rhs_item_list: RHS_Item_List_3
-- | | | | | | rhs_element: RHS_Element_2
-- | | | | | | | rhs_item: RHS_Item_2
-- | | | | | | | | IDENTIFIER: List_Nonterm
-- | | | | rhs_element: RHS_Element_3
-- | | | | | rhs_item: RHS_Item_3
-- | | | | | | IDENTIFIER: List_Element
-- | semicolon_opt:
-- | | SEMICOLON:
RHS_Item_2 : constant Valid_Node_Index := Tree.Add_Nonterm
((+rhs_item_ID, 0), (1 => Tree.Add_Identifier (+IDENTIFIER_ID, List_Nonterm, Byte_Region)));
RHS_Element_2 : constant Valid_Node_Index := Tree.Add_Nonterm ((+rhs_element_ID, 0), (1 => RHS_Item_2));
RHS_Item_List_1 : constant Valid_Node_Index := Tree.Add_Nonterm ((+rhs_item_list_ID, 0), (1 => RHS_Element_1));
RHS_Item_List_3 : constant Valid_Node_Index := Tree.Add_Nonterm ((+rhs_item_list_ID, 0), (1 => RHS_Element_2));
RHS_Item_List_2 : constant Valid_Node_Index := Tree.Add_Nonterm
((+rhs_item_list_ID, 1), (1 => RHS_Item_List_3, 2 => RHS_Element_3));
RHS_2 : constant Valid_Node_Index := Tree.Add_Nonterm ((+rhs_ID, 1), (1 => RHS_Item_List_1));
RHS_3 : constant Valid_Node_Index := Tree.Add_Nonterm ((+rhs_ID, 1), (1 => RHS_Item_List_2));
Bar_1 : constant Valid_Node_Index := Tree.Add_Terminal (+BAR_ID);
RHS_List_2 : constant Valid_Node_Index := Tree.Add_Nonterm ((+rhs_list_ID, 0), (1 => RHS_2));
List_Nonterminal : constant Valid_Node_Index := Tree_Add_Nonterminal
(Child_1 => Tree.Add_Identifier (+IDENTIFIER_ID, List_Nonterm, Byte_Region),
Child_2 => Tree.Add_Terminal (+COLON_ID),
Child_3 => Tree.Add_Nonterm
((+rhs_list_ID, 1),
(1 => RHS_List_2,
2 => Bar_1,
3 => RHS_3)),
Child_4 => Tree.Add_Nonterm
((+semicolon_opt_ID, 0),
(1 => Tree.Add_Terminal (+SEMICOLON_ID))));
begin
Add_Compilation_Unit (List_Nonterminal);
end New_Nonterminal_List_1;
procedure New_Nonterminal_List
(List_Nonterm : in Identifier_Index;
List_Element : in Identifier_Index;
Byte_Region : in Buffer_Region)
is
RHS_Item_1 : constant Valid_Node_Index := Tree.Add_Nonterm
((+rhs_item_ID, 0), (1 => Tree.Add_Identifier (+IDENTIFIER_ID, List_Element, Byte_Region)));
RHS_Item_3 : constant Valid_Node_Index := Tree.Add_Nonterm
((+rhs_item_ID, 0), (1 => Tree.Add_Identifier (+IDENTIFIER_ID, List_Element, Byte_Region)));
RHS_Element_1 : constant Valid_Node_Index := Tree.Add_Nonterm ((+rhs_element_ID, 0), (1 => RHS_Item_1));
RHS_Element_3 : constant Valid_Node_Index := Tree.Add_Nonterm ((+rhs_element_ID, 0), (1 => RHS_Item_3));
begin
New_Nonterminal_List_1 (List_Nonterm, RHS_Element_1, RHS_Element_3, Byte_Region);
end New_Nonterminal_List;
procedure New_Nonterminal_List
(List_Nonterm : in Identifier_Index;
List_Element : in Token_Index;
Terminals : in Base_Token_Arrays.Vector;
Byte_Region : in Buffer_Region)
is
RHS_Item_1 : constant Valid_Node_Index := Tree.Add_Nonterm
((+rhs_item_ID, 0), (1 => Tree.Add_Terminal (List_Element, Terminals)));
RHS_Item_3 : constant Valid_Node_Index := Tree.Add_Nonterm
((+rhs_item_ID, 0), (1 => Tree.Add_Terminal (List_Element, Terminals)));
RHS_Element_1 : constant Valid_Node_Index := Tree.Add_Nonterm ((+rhs_element_ID, 0), (1 => RHS_Item_1));
RHS_Element_3 : constant Valid_Node_Index := Tree.Add_Nonterm ((+rhs_element_ID, 0), (1 => RHS_Item_3));
begin
New_Nonterminal_List_1 (List_Nonterm, RHS_Element_1, RHS_Element_3, Byte_Region);
end New_Nonterminal_List;
procedure Process_Node (Node : in Valid_Node_Index)
is begin
if Trace_Generate > Detail then
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("translate node" & Node_Index'Image (Node));
end if;
case To_Token_Enum (Tree.ID (Node)) is
-- Token_Enum_ID alphabetical order
when declaration_ID =>
-- Must be "%meta_syntax EBNF"; change to BNF
declare
Decl_Item : constant Valid_Node_Index := Tree.Find_Descendant
(Tree.Child (Node, 3), +declaration_item_ID);
Children : Valid_Node_Index_Array := Tree.Children (Decl_Item);
begin
Children (1) := Tree.Add_Identifier
(+IDENTIFIER_ID, New_Identifier ("BNF"), Tree.Byte_Region (Decl_Item));
Tree.Set_Children (Decl_Item, (+declaration_item_ID, 1), Children);
end;
when rhs_alternative_list_ID =>
-- All handled by New_Nonterminal*
raise SAL.Not_Implemented with Tree.Image (Node, Wisitoken_Grammar_Actions.Descriptor);
when rhs_attribute_ID =>
-- Just delete it
--
-- Current tree (so far, attributes are always the first item in an rhs):
--
-- rhs:
-- | ...
-- | rhs_item_list: RHS_Item_List.Parent 2
-- | | rhs_item_list: RHS_Item_List.Parent 1
-- | | | rhs_item_list: RHS_Item_List
-- | | | | rhs_element: Parent (Node, 2)
-- | | | | | rhs_item: Parent (Node, 1)
-- | | | | | | rhs_attribute: Node
-- | | | rhs_element: next_element 1
-- | | rhs_element: next_element 2
--
-- New tree:
--
-- rhs:
-- | ...
-- | rhs_item_list: keep RHS_Item_List.Parent
-- | | rhs_element: keep next_element 1
-- | rhs_element: kepp next_element 2
declare
RHS_Item_List : constant Valid_Node_Index := Tree.Parent (Node, 3);
Parent : constant Valid_Node_Index := Tree.Parent (RHS_Item_List);
begin
if Tree.RHS_Index (RHS_Item_List) /= 0 then
-- Not first
Raise_Programmer_Error ("translate_ebnf_to_bnf rhs_attribute_id unimplemented", Tree, Node);
end if;
Tree.Set_Children
(Parent,
(+rhs_item_list_ID, 0),
(1 => Tree.Child (Parent, 2)));
end;
when rhs_group_item_ID =>
-- Current tree:
--
-- rhs_element: Parent (Node, 2)
-- | rhs_item: Parent (Node, 1)
-- | | rhs_group_item: Node
-- | | | LEFT_PAREN
-- | | | rhs_alternative_list: Child (Node, 2)
-- | | | RIGHT_PAREN
-- See if there's an existing nonterminal for this content.
declare
Element_Content : constant String := Get_Text (Data, Tree, Tree.Child (Node, 2));
Temp : Node_Index := First_List_Element
(Tree.Child (Tree.Root, 1), +compilation_unit_ID);
Name_Node : Node_Index;
New_Ident : Base_Identifier_Index := Invalid_Identifier_Index;
begin
loop
pragma Assert (Tree.ID (Temp) = +compilation_unit_ID);
if Tree.Production_ID (Tree.Child (Temp, 1)) = (+nonterminal_ID, 0) then
-- Target nonterm is:
--
-- (compilation_unit_1, (111 . 128))
-- | (nonterminal_0, (111 . 128))
-- | | 7;(IDENTIFIER, (111 . 128))
-- | | (COLON)
-- | | (rhs_list_1, (111 . 128))
-- | | | ...
declare
RHS_List_1 : constant Node_Index := Tree.Child (Tree.Child (Temp, 1), 3);
begin
if RHS_List_1 /= Invalid_Node_Index and then
Element_Content = Get_Text (Data, Tree, RHS_List_1)
then
Name_Node := Tree.Child (Tree.Child (Temp, 1), 1);
case Tree.Label (Name_Node) is
when Shared_Terminal =>
New_Ident := New_Identifier (Get_Text (Data, Tree, Name_Node));
when Virtual_Identifier =>
New_Ident := Tree.Identifier (Name_Node);
when others =>
Raise_Programmer_Error ("process_node rhs_group_item", Tree, Name_Node);
end case;
exit;
end if;
end;
end if;
Temp := Next_List_Element (Temp, +compilation_unit_list_ID);
exit when Temp = Invalid_Node_Index;
end loop;
if New_Ident = Invalid_Identifier_Index then
New_Ident := Next_Nonterm_Name;
New_Nonterminal (New_Ident, Tree.Child (Node, 2));
end if;
Tree.Set_Node_Identifier (Node, +IDENTIFIER_ID, New_Ident);
Tree.Set_Children (Tree.Parent (Node), (+rhs_item_ID, 0), (1 => Node));
Clear_EBNF_Node (Node);
end;
when rhs_multiple_item_ID =>
-- We have one of:
--
-- | a { b } c
-- | a { b } - c
-- | a ( b ) + c
-- | a ( b ) * c
-- | a b+ c
-- | a b* c
--
-- Replace it with a new canonical list nonterminal:
--
-- nonterminal_nnn
-- : b
-- | nonterminal_nnn_list b
--
-- and a second RHS if it can be empty:
-- | a c
-- Current tree:
--
-- rhs_item: Parent (Node, 1)
-- | rhs_multiple_item: Node
-- | | LEFT_BRACE | LEFT_PAREN
-- | | rhs_alternative_list
-- | | | ...
-- | | RIGHT_BRACE | RIGHT_PAREN
-- | | [MINUS | PLUS | STAR]
-- or:
--
-- rhs_item: Parent (Node, 1)
-- | rhs_multiple_item: Node
-- | | IDENTIFIER
-- | | PLUS | STAR
declare
Done : Boolean := False;
RHS_Index : constant Integer := Tree.RHS_Index (Node);
Plus_Minus_Star : constant Node_Index := Tree.Child
(Node, (if RHS_Index in 0 .. 3 then 4 else 2));
Allow_Empty : constant Boolean := Plus_Minus_Star = Invalid_Node_Index or else
Tree.ID (Plus_Minus_Star) in +STAR_ID;
Parent_RHS_Item : constant Valid_Node_Index := Tree.Parent (Node);
List_Nonterm_Virtual_Name : Base_Identifier_Index := Invalid_Identifier_Index;
List_Nonterm_Terminal_Name : Base_Token_Index := Invalid_Token_Index;
List_Element : Base_Identifier_Index := Invalid_Identifier_Index;
procedure Check_Canonical_List
is
-- In EBNF, a canonical list with a separator looks like:
--
-- enumConstants : enumConstant (',' enumConstant)* ;
--
-- or, with no separator:
--
-- SwitchLabels : SwitchLabel {SwitchLabel} ;
--
-- The tokens may have labels.
--
-- Handling these cases specially this eliminates a conflict between
-- reducing to enumConstants and reducing to the introduced nonterm
-- list.
--
-- Alternately, the no separator case can be:
--
-- enumConstants : enumConstant+ ;
--
-- Handling this no separator case specially would not eliminate any conflicts.
use all type SAL.Base_Peek_Type;
Alt_List_Items : constant Valid_Node_Index_Array := Tree.Get_IDs (Node, +rhs_item_ID);
RHS_Element : constant Valid_Node_Index := Tree.Parent (Node, 2);
Element_1 : constant Node_Index := Prev_List_Element
(RHS_Element, +rhs_item_list_ID);
RHS_2 : constant Valid_Node_Index := Tree.Find_Ancestor
(Node, (+rhs_ID, +rhs_alternative_list_ID));
begin
if Tree.ID (RHS_2) = +rhs_alternative_list_ID then return; end if;
if not (Alt_List_Items'Last in 1 .. 2) then return; end if;
if Element_1 = Invalid_Node_Index or else
Get_Text (Data, Tree, Tree.Get_IDs (Element_1, +rhs_item_ID)(1)) /=
Get_Text (Data, Tree, Alt_List_Items (Alt_List_Items'Last))
then
return;
end if;
if Invalid_Node_Index /= Next_List_Element (RHS_Element, +rhs_item_list_ID) then return; end if;
if Invalid_Node_Index /= Next_List_Element (RHS_2, +rhs_list_ID) or
Invalid_Node_Index /= Prev_List_Element (RHS_2, +rhs_list_ID)
then
return;
end if;
-- We have a canonical list declaration. Rewrite it to:
--
-- with separator:
-- rhs_list: keep
-- | rhs_list:
-- | | rhs: new, RHS_1
-- | | | rhs_item_list: new, RHS_Item_List_1
-- | | | | rhs_element: keep, Element_1
-- | | | | | rhs_item: keep
-- | | | | | | IDENTIFIER: keep; element name
-- | BAR: new
-- | rhs: keep, RHS_2
-- | | rhs_item_list: new, RHS_Item_List_2
-- | | | rhs_item_list: keep, rhs_item_list_3
-- | | | | rhs_item_list: keep, rhs_item_list_4
-- | | | | | rhs_element: new
-- | | | | | | rhs_item: new
-- | | | | | | | IDENTIFIER: new, list name
-- | | | | rhs_element: keep
-- | | | | | rhs_item: keep
-- | | | | | | IDENTIFIER: keep, separator
-- | | | rhs_element: keep, alt_list_elements (last)
-- | | | | rhs_item: keep
-- | | | | | IDENTIFIER: keep, element name
--
-- no separator:
-- rhs_list: keep
-- | rhs_list:
-- | | rhs: new, RHS_1
-- | | | rhs_item_list: new, RHS_Item_List_1
-- | | | | rhs_element: keep, Element_1
-- | | | | | rhs_item: keep
-- | | | | | | IDENTIFIER: keep; element name
-- | BAR: new
-- | rhs: keep, RHS_2
-- | | rhs_item_list: keep, rhs_item_list_3
-- | | | rhs_item_list: new, rhs_item_list_4
-- | | | | rhs_element: new
-- | | | | | rhs_item: new
-- | | | | | | IDENTIFIER: new, list name
-- | | | rhs_element: keep, alt_list_elements (last)
-- | | | | rhs_item: keep
-- | | | | | IDENTIFIER: keep, element name
declare
List_Name_Node : constant Valid_Node_Index := Tree.Find_Ancestor (RHS_2, +nonterminal_ID);
List_Name_Tok : constant Token_Index := Tree.Min_Terminal_Index (List_Name_Node);
List_Name_Region : constant Buffer_Region := Data.Terminals.all (List_Name_Tok).Byte_Region;
List_Name : constant String := Data.Grammar_Lexer.Buffer_Text (List_Name_Region);
RHS_2_Index : constant Integer := Tree.RHS_Index (RHS_2);
RHS_2_Children : Valid_Node_Index_Array := Tree.Children (RHS_2);
RHS_Item_List_1 : constant Valid_Node_Index := Tree.Add_Nonterm
((+rhs_item_list_ID, 0), (1 => Element_1));
RHS_1_Action : constant Node_Index :=
(case RHS_2_Index is
when 2 | 3 => Tree.Add_Terminal
(Tree.Min_Terminal_Index (RHS_2_Children (2)), Data.Terminals.all),
when others => Invalid_Node_Index);
RHS_1_Check : constant Node_Index :=
(case RHS_2_Index is
when 3 => Tree.Add_Terminal
(Tree.Min_Terminal_Index (RHS_2_Children (3)), Data.Terminals.all),
when others => Invalid_Node_Index);
RHS_1 : constant Valid_Node_Index :=
(case RHS_2_Index is
when 1 => Tree.Add_Nonterm ((+rhs_ID, 1), (1 => RHS_Item_List_1)),
when 2 => Tree.Add_Nonterm ((+rhs_ID, 2), (1 => RHS_Item_List_1, 2 => RHS_1_Action)),
when 3 => Tree.Add_Nonterm
((+rhs_ID, 3), (1 => RHS_Item_List_1, 2 => RHS_1_Action, 3 => RHS_1_Check)),
when others => raise SAL.Programmer_Error);
Bar : constant Valid_Node_Index := Tree.Add_Terminal (+BAR_ID);
RHS_Item_List_3 : constant Valid_Node_Index := Tree.Child (RHS_2, 1);
RHS_Item_List_4 : constant Valid_Node_Index := Tree.Child (RHS_Item_List_3, 1);
New_List_Name_Term : constant Valid_Node_Index := Tree.Add_Terminal
(List_Name_Tok, Data.Terminals.all);
New_List_Name_Item : constant Valid_Node_Index := Tree.Add_Nonterm
((+rhs_item_ID, 0),
(1 => New_List_Name_Term));
New_List_Name_Label : constant Node_Index :=
(if Tree.RHS_Index (Element_1) = 1
then -- tokens have labels
Tree.Add_Identifier (+IDENTIFIER_ID, New_Identifier (List_Name), List_Name_Region)
else Invalid_Node_Index);
New_List_Name_Element : constant Valid_Node_Index :=
(if Tree.RHS_Index (Element_1) = 1
then -- tokens have labels
Tree.Add_Nonterm
((+rhs_element_ID, 1),
(1 => New_List_Name_Label,
2 => Tree.Add_Terminal (+EQUAL_ID),
3 => New_List_Name_Item))
else
Tree.Add_Nonterm ((+rhs_element_ID, 0), (1 => New_List_Name_Item)));
Alt_List_Elements : constant Valid_Node_Index_Array := Tree.Get_IDs (Node, +rhs_element_ID);
RHS_Item_List_2 : constant Node_Index :=
(if Alt_List_Elements'Last = 1
then Invalid_Node_Index -- no separator
else Tree.Add_Nonterm
((+rhs_item_list_ID, 1),
(1 => RHS_Item_List_3,
2 => Alt_List_Elements (Alt_List_Elements'Last))));
begin
Tree.Set_Children (RHS_Item_List_4, (+rhs_item_list_ID, 0), (1 => New_List_Name_Element));
Tree.Set_Children
(RHS_Item_List_3,
(+rhs_item_list_ID, 1),
(1 => RHS_Item_List_4,
2 => Alt_List_Elements (1)));
RHS_2_Children (1) :=
(if Alt_List_Elements'Last = 1
then RHS_Item_List_3 -- no separator
else RHS_Item_List_2);
Tree.Set_Children (RHS_2, (+rhs_ID, Tree.RHS_Index (RHS_2)), RHS_2_Children);
Tree.Set_Children
(Tree.Parent (RHS_2),
(+rhs_list_ID, 1),
(1 => Tree.Add_Nonterm ((+rhs_list_ID, 0), (1 => RHS_1)),
2 => Bar,
3 => RHS_2));
end;
Done := True;
Clear_EBNF_Node (Node);
if Trace_Generate > Extra then
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("edited rhs_list:");
Tree.Print_Tree (Wisitoken_Grammar_Actions.Descriptor, Tree.Parent (RHS_2));
end if;
end Check_Canonical_List;
procedure Find_List_Nonterminal_2 (Element_Content : in String)
is
-- Look for a virtual pair of nonterms implementing a list of Element_Content.
-- If found, set List_Nonterm_Virtual_Name, List_Element
Temp : Node_Index := First_List_Element (Tree.Child (Tree.Root, 1), +compilation_unit_ID);
Name_Node : Node_Index;
begin
loop
pragma Assert (Tree.ID (Temp) = +compilation_unit_ID);
if Tree.Production_ID (Tree.Child (Temp, 1)) = (+nonterminal_ID, 0) and
Tree.Is_Virtual (Tree.Child (Temp, 1))
then
if Element_Content = Get_Text (Data, Tree, Tree.Child (Tree.Child (Temp, 1), 3)) then
Name_Node := Tree.Child (Tree.Child (Temp, 1), 1);
case Tree.Label (Name_Node) is
when Virtual_Identifier =>
List_Element := Tree.Identifier (Name_Node);
when others =>
Raise_Programmer_Error
("unimplemented Find_List_Nonterminal_2 case '" & Element_Content & "'",
Tree, Name_Node);
end case;
-- list nonterm is the next nonterminal
Temp := Next_List_Element (Temp, +compilation_unit_list_ID);
Name_Node := Tree.Child (Tree.Child (Temp, 1), 1);
case Tree.Label (Name_Node) is
when Virtual_Identifier =>
List_Nonterm_Virtual_Name := Tree.Identifier (Name_Node);
when others =>
raise SAL.Programmer_Error;
end case;
exit;
end if;
end if;
Temp := Next_List_Element (Temp, +compilation_unit_list_ID);
exit when Temp = Invalid_Node_Index;
end loop;
end Find_List_Nonterminal_2;
procedure Find_List_Nonterminal_1 (Element_Content : in String)
is
-- Search for a nonterm (virtual or not) implementing a list for
-- Element_Content, which is a single rhs_element; no List_Element
-- Nonterminal. If found, set List_Nonterm_Virtual_Name or
-- List_Nonterm_Terminal_Name
Temp : Node_Index := First_List_Element (Tree.Child (Tree.Root, 1), +compilation_unit_ID);
begin
loop
pragma Assert (Tree.ID (Temp) = +compilation_unit_ID);
if Tree.Production_ID (Tree.Child (Temp, 1)) = (+nonterminal_ID, 0) then
-- Target List_Nonterm is:
--
-- nonterminal_nnn_list
-- : element
-- | nonterminal_nnn_list element
--
-- compilation_unit
-- | nonterminal
-- | | IDENTIFIER : list_nonterm
-- | | COLON
-- | | rhs_list: rhs_list_1
-- | | | rhs_list: rhs_list_2
-- | | | | rhs
-- | | | | | ... List_element
-- | | | BAR
-- | | | rhs: ... list_nonterm list_element
declare
Name_Node : constant Node_Index := Tree.Child (Tree.Child (Temp, 1), 1);
RHS_List_1 : constant Node_Index := Tree.Child (Tree.Child (Temp, 1), 3);
RHS_List_2 : constant Node_Index :=
(if RHS_List_1 = Invalid_Node_Index
then Invalid_Node_Index
else Tree.Child (RHS_List_1, 1));
begin
if RHS_List_2 /= Invalid_Node_Index and
Tree.Child (RHS_List_1, 3) /= Invalid_Node_Index and -- second rhs present
Tree.Child (RHS_List_2, 3) = Invalid_Node_Index -- no third rhs
then
declare
RHS_1 : constant String := Get_Text (Data, Tree, RHS_List_2);
RHS_2 : constant String := Get_Text (Data, Tree, Tree.Child (RHS_List_1, 3));
Expected_RHS_2 : constant String := Get_Text (Data, Tree, Name_Node) & " " &
Element_Content;
begin
if Element_Content = RHS_1 and RHS_2 = Expected_RHS_2 then
case Tree.Label (Name_Node) is
when Shared_Terminal =>
List_Nonterm_Terminal_Name := Tree.Min_Terminal_Index (Name_Node);
when Virtual_Identifier =>
List_Nonterm_Virtual_Name := Tree.Identifier (Name_Node);
when others =>
Raise_Programmer_Error
("unimplemented Find_List_Nonterminal_1 case '" & Element_Content & "'",
Tree, Name_Node);
end case;
exit;
end if;
end;
end if;
end;
end if;
Temp := Next_List_Element (Temp, +compilation_unit_list_ID);
exit when Temp = Invalid_Node_Index;
end loop;
end Find_List_Nonterminal_1;
begin
-- Check if this is a recognized pattern
Check_Canonical_List;
if Done then return; end if;
-- Check to see if there is an already declared nonterminal
-- list with the same content; if not, create one.
case Tree.RHS_Index (Node) is
when 0 .. 3 =>
-- { rhs_alternative_list } -?
-- ( rhs_alternative_list ) [+*]
if 0 = Tree.RHS_Index (Tree.Child (Node, 2)) and then
0 = Tree.RHS_Index (Tree.Child (Tree.Child (Node, 2), 1))
then
-- Only one element in the rhs_alternative_list, and in the rhs_item_list
Find_List_Nonterminal_1 (Get_Text (Data, Tree, Tree.Child (Node, 2)));
if List_Nonterm_Virtual_Name = Invalid_Identifier_Index and
List_Nonterm_Terminal_Name = Invalid_Token_Index
then
List_Nonterm_Virtual_Name := Next_Nonterm_Name ("_list");
New_Nonterminal_List
(List_Nonterm_Virtual_Name, Tree.Min_Terminal_Index (Tree.Child (Node, 2)),
Data.Terminals.all, Tree.Byte_Region (Node));
end if;
else
Find_List_Nonterminal_2 (Get_Text (Data, Tree, Tree.Child (Node, 2)));
if List_Nonterm_Virtual_Name = Invalid_Identifier_Index then
List_Nonterm_Virtual_Name := Next_Nonterm_Name ("_list");
List_Element := Next_Nonterm_Name;
New_Nonterminal (List_Element, Tree.Child (Node, 2));
New_Nonterminal_List (List_Nonterm_Virtual_Name, List_Element, Tree.Byte_Region (Node));
end if;
end if;
when 4 | 5 =>
-- IDENTIFIER + | *
Find_List_Nonterminal_1 (Get_Text (Data, Tree, Tree.Child (Node, 1)));
if List_Nonterm_Virtual_Name = Invalid_Identifier_Index then
List_Nonterm_Virtual_Name := Next_Nonterm_Name ("_list");
New_Nonterminal_List
(List_Nonterm_Virtual_Name, Tree.Min_Terminal_Index (Tree.Child (Node, 1)), Data.Terminals.all,
Tree.Byte_Region (Node));
end if;
when others =>
Raise_Programmer_Error ("translate_ebnf_to_bnf rhs_multiple_item unimplmented", Tree, Node);
end case;
if Allow_Empty then
Insert_Optional_RHS (Node);
end if;
declare
Child : constant Valid_Node_Index :=
(if List_Nonterm_Virtual_Name /= Invalid_Identifier_Index
then Tree.Add_Identifier
(+IDENTIFIER_ID, List_Nonterm_Virtual_Name, Tree.Byte_Region (Parent_RHS_Item))
elsif List_Nonterm_Terminal_Name /= Invalid_Token_Index
then Tree.Add_Terminal (List_Nonterm_Terminal_Name, Data.Terminals.all)
else raise SAL.Programmer_Error);
begin
Tree.Set_Children (Parent_RHS_Item, (+rhs_item_ID, 0), (1 => Child));
end;
Clear_EBNF_Node (Node);
if Trace_Generate > Extra then
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("edited rhs_item:");
Tree.Print_Tree (Wisitoken_Grammar_Actions.Descriptor, Parent_RHS_Item);
end if;
exception
when E : System.Assertions.Assert_Failure =>
Raise_Programmer_Error
("translate_ebnf_to_bnf multiple_item assert: " & Ada.Exceptions.Exception_Message (E), Tree, Node);
end;
when rhs_optional_item_ID =>
-- Source looks like:
--
-- | a [b] c
--
-- where 'a', 'b', 'c' are token sequences. Translate to:
--
-- | a nonterm_b c
-- | a c
--
-- where 'nonterm_b' is a new nonterminal containing b, unless b is
-- simple enough to inline.
--
-- See nested_ebnf_optional.wy for an example of nested optional
-- items.
--
-- current tree:
--
-- | rhs_list:
-- | | rhs | rhs_alternative_list:
-- | | | rhs_item_list
-- | | | | rhs_item_list
-- | | | ...
-- | | | | | | rhs_element:
-- | | | | | | | rhs_item: contains a tail
-- | | | | | rhs_element:
-- | | | | | | rhs_item: contains b
-- | | | | | | | rhs_optional_item: Node
-- | | | | | | | | LEFT_BRACKET: Node.Children (1)
-- | | | | | | | | rhs_alternative_item_list: Node.Children (2) b
-- | | | | | | | | RIGHT_BRACKET: Node.Children (3)
-- | | | | rhs_element: head of c
-- | | | | | rhs_item: head of c
declare
Name_Ident : Base_Identifier_Index := Invalid_Identifier_Index;
Name_Terminal : Base_Token_Index := Invalid_Token_Index;
Name_Label : Base_Token_Index := Invalid_Token_Index;
Found : Boolean := False;
begin
case Tree.RHS_Index (Node) is
when 0 | 1 =>
-- : LEFT_BRACKET rhs_alternative_list RIGHT_BRACKET
-- | LEFT_PAREN rhs_alternative_list RIGHT_PAREN QUESTION
-- Check for special cases
if List_Singleton (Tree.Child (Node, 2)) then
if List_Singleton (Tree.Child (Tree.Child (Node, 2), 1)) then
-- Single item in rhs_alternative_list and rhs_item_list; just use it.
--
-- Single alternative, multiple rhs_items handled below
declare
Name_Element_Node : Valid_Node_Index;
Name_Identifier_Node : Node_Index;
begin
Found := True;
Name_Element_Node := First_List_Element
(Tree.Child (Tree.Child (Node, 2), 1), +rhs_element_ID);
if Tree.RHS_Index (Name_Element_Node) = 0 then
Name_Identifier_Node := Tree.Child (Tree.Child (Name_Element_Node, 1), 1);
else
-- Name has a label
Name_Label := Tree.Min_Terminal_Index (Tree.Child (Name_Element_Node, 1));
Name_Identifier_Node := Tree.Child (Tree.Child (Name_Element_Node, 3), 1);
end if;
case Tree.Label (Name_Identifier_Node) is
when Virtual_Identifier =>
Name_Ident := Tree.Identifier (Name_Identifier_Node);
when Shared_Terminal =>
Name_Terminal := Tree.Min_Terminal_Index (Name_Identifier_Node);
when others =>
Raise_Programmer_Error ("unhandled rhs_optional case ", Tree, Name_Identifier_Node);
end case;
end;
end if;
else
-- See if we've already created a nonterminal for this.
declare
New_Text : constant String := Get_Text (Data, Tree, Tree.Child (Node, 2));
Temp : Node_Index := First_List_Element
(Tree.Child (Tree.Root, 1), +compilation_unit_ID);
Name_Identifier_Node : Node_Index;
begin
loop
pragma Assert (Tree.ID (Temp) = +compilation_unit_ID);
if Tree.Production_ID (Tree.Child (Temp, 1)) = (+nonterminal_ID, 0) then
if New_Text = Get_Text (Data, Tree, Tree.Child (Tree.Child (Temp, 1), 3)) then
Found := True;
Name_Identifier_Node := Tree.Child (Tree.Child (Temp, 1), 1);
case Tree.Label (Name_Identifier_Node) is
when Virtual_Identifier =>
Name_Ident := Tree.Identifier (Name_Identifier_Node);
when others =>
Raise_Programmer_Error
("unhandled rhs_optional case '" & New_Text & "'", Tree, Name_Identifier_Node);
end case;
exit;
end if;
end if;
Temp := Next_List_Element (Temp, +compilation_unit_list_ID);
exit when Found or Temp = Invalid_Node_Index;
end loop;
end;
end if;
if Found then
-- Use previously created nonterminal
if Name_Ident /= Invalid_Identifier_Index then
Tree.Set_Node_Identifier (Node, +IDENTIFIER_ID, Name_Ident);
-- Change RHS_Index, delete Check_EBNF action
Tree.Set_Children (Tree.Parent (Node), (+rhs_item_ID, 0), (1 => Node));
elsif Name_Terminal /= Invalid_Token_Index then
Tree.Set_Children
(Tree.Parent (Node),
(+rhs_item_ID, 0),
(1 => Tree.Add_Terminal (Name_Terminal, Data.Terminals.all)));
else
raise SAL.Programmer_Error;
end if;
if Name_Label /= Invalid_Token_Index then
declare
Label_Node : constant Valid_Node_Index := Tree.Add_Terminal
(Name_Label, Data.Terminals.all);
Equal_Node : constant Valid_Node_Index := Tree.Add_Terminal (+EQUAL_ID);
begin
Tree.Set_Children
(Tree.Parent (Tree.Parent (Node)),
(+rhs_element_ID, 1),
(1 => Label_Node,
2 => Equal_Node,
3 => Tree.Parent (Node)));
end;
end if;
else
-- Create a new nonterm, or handle more special cases
if List_Singleton (Tree.Child (Node, 2)) then
-- Single alternative, multiple rhs_items
--
-- No separate nonterminal, so token labels stay in the same RHS for
-- actions. Splice together rhs_item_lists a, b, c
declare
Root_List_A : constant Valid_Node_Index := Tree.Child (Tree.Parent (Node, 3), 1);
Tail_Element_A : constant Node_Index :=
(if Root_List_A = Tree.Parent (Node, 2)
then Invalid_Node_Index -- a is empty
else Last_List_Element (Root_List_A));
Root_List_B : constant Valid_Node_Index := Tree.Child (Tree.Child (Node, 2), 1);
Head_Element_B : constant Valid_Node_Index := First_List_Element
(Root_List_B, +rhs_element_ID);
Tail_Element_B : constant Valid_Node_Index := Last_List_Element (Root_List_B);
Root_List_C : constant Valid_Node_Index := List_Root (Tree.Parent (Node, 3));
Head_Element_C : constant Node_Index := Next_List_Element
(Tree.Parent (Node, 2), +rhs_item_list_ID);
RHS : constant Valid_Node_Index := Tree.Parent (Root_List_C);
RHS_Children : Valid_Node_Index_Array := Tree.Children (RHS);
begin
if Tail_Element_A = Invalid_Node_Index and Head_Element_C = Invalid_Node_Index then
-- A, C both empty
RHS_Children (1) := Tree.Child (Root_List_B, 1);
Tree.Set_Children (RHS, Tree.Production_ID (RHS), RHS_Children);
elsif Tail_Element_A = Invalid_Node_Index then
-- A empty, C not empty
declare
Parent_B2 : constant Valid_Node_Index := Tree.Parent (Tail_Element_B);
Parent_C : constant Valid_Node_Index := Tree.Parent (Head_Element_C);
begin
Tree.Set_Children (Parent_C, (+rhs_item_list_ID, 1), (Parent_B2, Head_Element_C));
-- Head_Element_C remains the list root.
end;
elsif Head_Element_C = Invalid_Node_Index then
-- A not empty, C empty.
declare
Parent_A : constant Valid_Node_Index := Tree.Parent (Tail_Element_A);
Parent_B : constant Valid_Node_Index := Tree.Parent (Head_Element_B);
begin
Tree.Set_Children (Parent_B, (+rhs_item_list_ID, 1), (Parent_A, Head_Element_B));
RHS_Children (1) := Root_List_B;
Tree.Set_Children (RHS, Tree.Production_ID (RHS), RHS_Children);
end;
else
-- A, C both not empty
declare
Parent_A : constant Valid_Node_Index := Tree.Parent (Tail_Element_A);
Parent_B1 : constant Valid_Node_Index := Tree.Parent (Head_Element_B);
Parent_B2 : constant Valid_Node_Index := Tree.Parent (Tail_Element_B);
Parent_C : constant Valid_Node_Index := Tree.Parent (Head_Element_C);
begin
Tree.Set_Children (Parent_B1, (+rhs_item_list_ID, 1), (Parent_A, Head_Element_B));
Tree.Set_Children (Parent_C, (+rhs_item_list_ID, 1), (Parent_B2, Head_Element_C));
-- Head_Element_C remains the list root.
end;
end if;
if Trace_Generate > Extra then
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("edited rhs:");
Tree.Print_Tree (Wisitoken_Grammar_Actions.Descriptor, RHS);
end if;
end;
else
declare
Nonterm_B : constant Identifier_Index := Next_Nonterm_Name ("");
begin
New_Nonterminal (Nonterm_B, Tree.Child (Node, 2));
Tree.Set_Node_Identifier (Node, +IDENTIFIER_ID, Nonterm_B);
end;
Tree.Set_Children (Tree.Parent (Node), (+rhs_item_ID, 0), (1 => Node));
end if;
end if;
when 2 =>
-- | IDENTIFIER QUESTION
Tree.Set_Children (Tree.Parent (Node), (+rhs_item_ID, 0), (1 => Tree.Child (Node, 1)));
when 3 =>
-- | STRING_LITERAL_2 QUESTION
Tree.Set_Children (Tree.Parent (Node), (+rhs_item_ID, 1), (1 => Tree.Child (Node, 1)));
when others =>
Raise_Programmer_Error ("translate_ebnf_to_bnf rhs_optional_item unimplmented", Tree, Node);
end case;
Clear_EBNF_Node (Node);
Insert_Optional_RHS (Node);
end;
when STRING_LITERAL_2_ID =>
declare
Value : constant String := Get_Text (Data, Tree, Node, Strip_Quotes => True);
Name_Ident : Identifier_Index;
Found : Boolean := False;
begin
-- See if Value is already declared
declare
Temp : Node_Index := First_List_Element (Tree.Child (Tree.Root, 1), +compilation_unit_ID);
Decl : Node_Index;
begin
loop
pragma Assert (Tree.ID (Temp) = +compilation_unit_ID);
if Tree.Production_ID (Tree.Child (Temp, 1)) = (+declaration_ID, 0) then
Decl := Tree.Child (Temp, 1);
declare
Value_Node : constant Valid_Node_Index := Tree.Child (Tree.Child (Decl, 4), 1);
begin
if Tree.ID (Value_Node) = +declaration_item_ID and then
Tree.ID (Tree.Child (Value_Node, 1)) in
+IDENTIFIER_ID | +STRING_LITERAL_1_ID | +STRING_LITERAL_2_ID and then
Value = Get_Text (Data, Tree, Tree.Child (Value_Node, 1), Strip_Quotes => True)
then
Found := True;
case Tree.Label (Tree.Child (Decl, 3)) is
when Shared_Terminal =>
Name_Ident := New_Identifier (Get_Text (Data, Tree, Tree.Child (Decl, 3)));
when Virtual_Identifier =>
Name_Ident := Tree.Identifier (Tree.Child (Decl, 3));
when others =>
raise SAL.Programmer_Error;
end case;
end if;
end;
end if;
Temp := Next_List_Element (Temp, +compilation_unit_list_ID);
exit when Temp = Invalid_Node_Index;
end loop;
end;
if not Found then
if GNAT.Regexp.Match (Value, Symbol_Regexp) then
Name_Ident := New_Identifier (Ada.Characters.Handling.To_Upper (Value));
else
Put_Error
(Error_Message
(Data.Grammar_Lexer.File_Name, Get_Line (Data, Tree, Node),
"punctuation token '" & Value & "' not declared"));
return;
end if;
end if;
declare
Parent : constant Valid_Node_Index := Tree.Parent (Node);
begin
case To_Token_Enum (Tree.ID (Parent)) is
when rhs_item_ID =>
Tree.Set_Children
(Tree.Parent (Node),
(+rhs_item_ID, 0),
(1 => Tree.Add_Identifier (+IDENTIFIER_ID, Name_Ident, Tree.Byte_Region (Node))));
when rhs_optional_item_ID =>
Tree.Set_Children
(Tree.Parent (Node),
(+rhs_optional_item_ID, 2),
(1 => Tree.Add_Identifier (+IDENTIFIER_ID, Name_Ident, Tree.Byte_Region (Node))));
when others =>
Raise_Programmer_Error ("translate_ebnf_to_bnf string_literal_2 unimplemented", Tree, Node);
end case;
end;
Clear_EBNF_Node (Node);
if Found then return; end if;
-- Declare token for keyword string literal
declare
Keyword : constant Valid_Node_Index := Tree.Add_Identifier
(+KEYWORD_ID, Keyword_Ident, Tree.Byte_Region (Node));
Kind : constant Valid_Node_Index := Tree.Add_Nonterm
((+token_keyword_non_grammar_ID, 0),
(1 => Keyword));
Value_Literal : constant Valid_Node_Index := Tree.Add_Identifier
(+STRING_LITERAL_1_ID, New_Identifier ('"' & Value & '"'), Tree.Byte_Region (Node));
Decl_Item : constant Valid_Node_Index := Tree.Add_Nonterm
((+declaration_item_ID, 1),
(1 => Value_Literal));
Decl_Item_List : constant Valid_Node_Index := Tree.Add_Nonterm
((+declaration_item_list_ID, 0),
(1 => Decl_Item));
Percent : constant Valid_Node_Index := Tree.Add_Identifier
(+PERCENT_ID, Percent_Ident, Tree.Byte_Region (Node));
Name : constant Valid_Node_Index := Tree.Add_Identifier
(+IDENTIFIER_ID, Name_Ident, Tree.Byte_Region (Node));
Decl : constant Valid_Node_Index := Tree.Add_Nonterm
((+declaration_ID, 0), (Percent, Kind, Name, Decl_Item_List), Action => declaration_0'Access);
begin
Add_Compilation_Unit (Decl, Prepend => True);
end;
end;
when others =>
Raise_Programmer_Error ("unimplemented EBNF node", Tree, Node);
end case;
exception
when SAL.Programmer_Error =>
raise;
when E : others =>
Raise_Programmer_Error
("unhandled exception " & Ada.Exceptions.Exception_Name (E) & ": " &
Ada.Exceptions.Exception_Message (E),
Tree, Node);
end Process_Node;
begin
-- Process nodes in node increasing order, so contained items are
-- translated first, so duplicates of the containing item can be found
for I in Data.EBNF_Nodes.First_Index .. Data.EBNF_Nodes.Last_Index loop
if Data.EBNF_Nodes (I) then
Process_Node (I);
end if;
end loop;
-- Processing copied nodes may produce more copied nodes, so we can't
-- use a 'for' loop.
declare
use all type SAL.Base_Peek_Type;
I : SAL.Base_Peek_Type := Copied_EBNF_Nodes.First_Index;
begin
loop
exit when I > Copied_EBNF_Nodes.Last_Index;
Process_Node (Copied_EBNF_Nodes (I));
I := I + 1;
end loop;
end;
Data.Meta_Syntax := BNF_Syntax;
if Trace_Generate > Detail then
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line ("Identifiers:");
for I in Data.Tokens.Virtual_Identifiers.First_Index .. Data.Tokens.Virtual_Identifiers.Last_Index loop
Ada.Text_IO.Put_Line (Base_Identifier_Index'Image (I) & " " & (-Data.Tokens.Virtual_Identifiers (I)));
end loop;
end if;
exception
when E : SAL.Not_Implemented =>
Ada.Text_IO.Put_Line
(Ada.Text_IO.Standard_Error, "Translate_EBNF_To_BNF not implemented: " & Ada.Exceptions.Exception_Message (E));
end Translate_EBNF_To_BNF;
procedure Print_Source
(File_Name : in String;
Tree : in WisiToken.Syntax_Trees.Tree;
Data : in User_Data_Type)
is
use Ada.Text_IO;
use WisiToken.Syntax_Trees;
File : File_Type;
Comments_Include_Newline : Boolean;
procedure Put_Comments (Node : in Valid_Node_Index)
is
Token : constant Base_Token_Index := Tree.Max_Terminal_Index (Node);
begin
-- Not all tokens have trailing non_grammar, so Data.Non_Grammar may
-- not have entries for every token.
Comments_Include_Newline := False;
if Token /= Invalid_Token_Index and then
Token in Data.Non_Grammar.First_Index .. Data.Non_Grammar.Last_Index
then
declare
Tokens : Base_Token_Arrays.Vector renames Data.Non_Grammar (Token);
begin
for Token of Tokens loop
if Token.ID = +NEW_LINE_ID then
Comments_Include_Newline := True;
end if;
Put (File, Data.Grammar_Lexer.Buffer_Text (Token.Byte_Region));
end loop;
end;
end if;
end Put_Comments;
procedure Put_Declaration_Item (Node : in Valid_Node_Index)
is
Children : constant Valid_Node_Index_Array := Tree.Children (Node);
begin
case To_Token_Enum (Tree.ID (Children (1))) is
when IDENTIFIER_ID | NUMERIC_LITERAL_ID | STRING_LITERAL_1_ID | STRING_LITERAL_2_ID =>
Put (File, ' ' & Get_Text (Data, Tree, Children (1)));
when REGEXP_ID =>
Put (File, " %[" & Get_Text (Data, Tree, Children (1)) & "]%");
when others =>
Put (File, Image (Tree.ID (Children (1)), Wisitoken_Grammar_Actions.Descriptor));
end case;
end Put_Declaration_Item;
procedure Put_Declaration_Item_List (Node : in Valid_Node_Index)
is
Children : constant Valid_Node_Index_Array := Tree.Children (Node);
begin
if Children'Length = 1 then
Put_Declaration_Item (Children (1));
else
Put_Declaration_Item_List (Children (1));
Put_Declaration_Item (Children (2));
end if;
end Put_Declaration_Item_List;
procedure Put_Identifier_List (Node : in Valid_Node_Index)
is
Children : constant Valid_Node_Index_Array := Tree.Children (Node);
begin
if Children'Length = 1 then
Put (File, Get_Text (Data, Tree, Children (1)));
else
Put_Identifier_List (Children (1));
Put (File, ' ');
Put (File, Get_Text (Data, Tree, Children (2)));
end if;
end Put_Identifier_List;
procedure Put_RHS_Element (Node : in Valid_Node_Index)
with Pre => Tree.ID (Node) = +rhs_element_ID
is begin
-- We don't raise an exception for errors here; it's easier to debug from the
-- mangled source listing.
case Tree.RHS_Index (Node) is
when 0 =>
Put (File, Get_Text (Data, Tree, Node));
when 1 =>
-- Output no spaces around "="
declare
Children : constant Valid_Node_Index_Array := Tree.Children (Node);
begin
Put (File, Get_Text (Data, Tree, Children (1)) & "=" & Get_Text (Data, Tree, Children (3)));
end;
when others =>
New_Line (File);
Put (File, " ;; not translated: " & Node_Index'Image (Node) & ":" &
Tree.Image (Node, Wisitoken_Grammar_Actions.Descriptor, Include_Children => True));
end case;
exception
when SAL.Programmer_Error =>
raise;
when E : others =>
declare
use Ada.Exceptions;
begin
Raise_Programmer_Error
("Put_RHS_Element: " & Exception_Name (E) & ": " & Exception_Message (E), Tree, Node);
end;
end Put_RHS_Element;
procedure Put_RHS_Item_List (Node : in Valid_Node_Index)
with Pre => Tree.ID (Node) = +rhs_item_list_ID
is
Children : constant Valid_Node_Index_Array := Tree.Children (Node);
begin
if Children'Length = 1 then
Put_RHS_Element (Children (1));
else
Put_RHS_Item_List (Children (1));
Put (File, ' ');
Put_RHS_Element (Children (2));
end if;
exception
when SAL.Programmer_Error =>
raise;
when E : others =>
declare
use Ada.Exceptions;
begin
Raise_Programmer_Error
("Put_RHS_Item_List: " & Exception_Name (E) & ": " & Exception_Message (E), Tree, Node);
end;
end Put_RHS_Item_List;
procedure Put_RHS
(Node : in Valid_Node_Index;
First : in Boolean;
Virtual : in Boolean)
with Pre => Tree.ID (Node) = +rhs_ID
is
Children : constant Valid_Node_Index_Array := Tree.Children (Node);
begin
Put (File, (if First then " : " else " | "));
case Tree.RHS_Index (Node) is
when 0 =>
if Virtual then
Put_Line (File, ";; empty");
else
Put_Comments (Tree.Parent (Node));
end if;
when 1 .. 3 =>
Put_RHS_Item_List (Children (1));
if Virtual then
New_Line (File);
else
Put_Comments (Children (1));
end if;
if Tree.RHS_Index (Node) > 1 then
Put (File, " %(" & Get_Text (Data, Tree, Children (2)) & ")%"); -- action
if Virtual then
New_Line (File);
else
Put_Comments (Children (2));
end if;
if Tree.RHS_Index (Node) > 2 then
Put (File, " %(" & Get_Text (Data, Tree, Children (3)) & ")%"); -- check
if Virtual then
New_Line (File);
else
Put_Comments (Children (3));
end if;
end if;
end if;
when others =>
Raise_Programmer_Error ("Put_RHS", Tree, Node);
end case;
exception
when SAL.Programmer_Error =>
raise;
when E : others =>
declare
use Ada.Exceptions;
begin
Raise_Programmer_Error ("Put_RHS: " & Exception_Name (E) & ": " & Exception_Message (E), Tree, Node);
end;
end Put_RHS;
procedure Put_RHS_List
(Node : in Valid_Node_Index;
First : in out Boolean;
Virtual : in Boolean)
with Pre => Tree.ID (Node) = +rhs_list_ID
is
Children : constant Valid_Node_Index_Array := Tree.Children (Node);
begin
case Tree.RHS_Index (Node) is
when 0 =>
Put_RHS (Children (1), First, Virtual or Children (1) > Data.EBNF_Nodes.Last_Index);
First := False;
when 1 =>
Put_RHS_List (Children (1), First, Virtual);
Put_RHS (Children (3), First => False, Virtual => Virtual or Children (3) > Data.EBNF_Nodes.Last_Index);
when 2 =>
Put
(File, "%if " & Get_Text (Data, Tree, Children (3)) & " = " & Get_Text (Data, Tree, Children (4)));
Put_Comments (Node);
when 3 =>
Put (File, "%end if");
Put_Comments (Node);
when others =>
Raise_Programmer_Error ("Put_RHS_List", Tree, Node);
end case;
exception
when SAL.Programmer_Error =>
raise;
when E : others =>
declare
use Ada.Exceptions;
begin
Raise_Programmer_Error ("Put_RHS_List: " & Exception_Name (E) & ": " & Exception_Message (E), Tree, Node);
end;
end Put_RHS_List;
procedure Process_Node (Node : in Valid_Node_Index)
is begin
case To_Token_Enum (Tree.ID (Node)) is
-- Enum_Token_ID alphabetical order
when compilation_unit_ID =>
Process_Node (Tree.Child (Node, 1));
when compilation_unit_list_ID =>
declare
Children : constant Valid_Node_Index_Array := Tree.Children (Node);
begin
case To_Token_Enum (Tree.ID (Children (1))) is
when compilation_unit_list_ID =>
Process_Node (Children (1));
Process_Node (Children (2));
when compilation_unit_ID =>
Process_Node (Children (1));
when others =>
raise SAL.Programmer_Error;
end case;
end;
when declaration_ID =>
declare
Children : constant Valid_Node_Index_Array := Tree.Children (Node);
begin
case Tree.RHS_Index (Node) is
when 0 =>
case Tree.RHS_Index (Children (2)) is
when 0 =>
Put (File, "%keyword");
when 1 =>
Put (File, "%non_grammar <" & Get_Text (Data, Tree, Tree.Child (Children (2), 3)) & ">");
when 2 =>
Put (File, "%token <" & Get_Text (Data, Tree, Tree.Child (Children (2), 3)) & ">");
when others =>
raise SAL.Programmer_Error;
end case;
Put (File, " " & Get_Text (Data, Tree, Children (3)));
Put_Declaration_Item_List (Children (4));
if Tree.Is_Virtual (Children (4)) then
New_Line (File);
else
Put_Comments (Children (4));
end if;
when 1 =>
Put (File, "%code ");
Put_Identifier_List (Children (3));
Put (File, " %{" & Get_Text (Data, Tree, Children (4)) & "}%"); -- RAW_CODE
Put_Comments (Node);
when 2 =>
declare
Key : constant String := Get_Text (Data, Tree, Children (2));
begin
if Key = "conflict" then
Put (File, Data.Grammar_Lexer.Buffer_Text (Tree.Byte_Region (Node)));
else
Put (File, "%" & Key);
Put_Declaration_Item_List (Children (3));
end if;
end;
Put_Comments (Children (3));
when 3 =>
Put (File, "%" & Get_Text (Data, Tree, Children (2)));
Put_Comments (Children (2));
when 4 =>
Put
(File, "%if" & Get_Text (Data, Tree, Children (2)) & " = " & Get_Text (Data, Tree, Children (4)));
Put_Comments (Node);
when 5 =>
Put (File, "%end if");
Put_Comments (Node);
when others =>
raise SAL.Programmer_Error;
end case;
end;
when nonterminal_ID =>
declare
Children : constant Valid_Node_Index_Array := Tree.Children (Node);
Virtual : constant Boolean := Tree.Label (Children (1)) = Virtual_Identifier;
First : Boolean := True;
begin
Put (File, Get_Text (Data, Tree, Children (1)));
if Virtual then
New_Line (File);
else
Put_Comments (Children (1));
if not Comments_Include_Newline then
New_Line (File);
end if;
end if;
Put_RHS_List (Children (3), First, Virtual);
if Tree.Children (Children (4))'Length > 0 then
if Virtual then
Put_Line (File, " ;");
else
Put (File, " ;");
Put_Comments (Children (4));
end if;
end if;
end;
when wisitoken_accept_ID =>
Process_Node (Tree.Child (Node, 1));
when others =>
raise SAL.Not_Implemented with Image (Tree.ID (Node), Wisitoken_Grammar_Actions.Descriptor);
end case;
end Process_Node;
begin
Create (File, Out_File, File_Name);
Put_Line (File, ";;; generated from " & Data.Grammar_Lexer.File_Name & " -*- buffer-read-only:t -*-");
Put_Line (File, ";;;");
declare
Tokens : Base_Token_Arrays.Vector renames Data.Non_Grammar (0);
begin
for Token of Tokens loop
Put (File, Data.Grammar_Lexer.Buffer_Text (Token.Byte_Region));
end loop;
end;
Process_Node (Tree.Root);
Close (File);
exception
when E : SAL.Not_Implemented =>
Close (File);
Ada.Text_IO.Put_Line
(Ada.Text_IO.Standard_Error, "Print_Source not implemented: " & Ada.Exceptions.Exception_Message (E));
end Print_Source;
end WisiToken_Grammar_Runtime;
-- Local Variables:
-- ada-which-func-parse-size: 30000
-- End:
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_728.asm | ljhsiun2/medusa | 9 | 172220 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r15
lea addresses_WC_ht+0x9619, %r11
nop
sub $40238, %r15
movb $0x61, (%r11)
nop
nop
xor $50505, %r11
pop %r15
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r14
push %r15
push %rcx
push %rdx
// Faulty Load
lea addresses_WT+0x5085, %r15
nop
add %rdx, %rdx
movups (%r15), %xmm6
vpextrq $1, %xmm6, %r12
lea oracles, %rcx
and $0xff, %r12
shlq $12, %r12
mov (%rcx,%r12,1), %r12
pop %rdx
pop %rcx
pop %r15
pop %r14
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_WT', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_WT', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 1, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'39': 21829}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
|
tier-1/xcb/source/thin/xcb-xcb_rgb_t.ads | charlie5/cBound | 2 | 19654 | <gh_stars>1-10
-- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with swig;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_rgb_t is
-- Item
--
type Item is record
red : aliased Interfaces.Unsigned_16;
green : aliased Interfaces.Unsigned_16;
blue : aliased Interfaces.Unsigned_16;
pad0 : aliased swig.int8_t_Array (0 .. 1);
end record;
-- Item_Array
--
type Item_Array is
array (Interfaces.C.size_t range <>) of aliased xcb.xcb_rgb_t.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_rgb_t.Item,
Element_Array => xcb.xcb_rgb_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array (Interfaces.C.size_t range <>) of aliased xcb.xcb_rgb_t.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_rgb_t.Pointer,
Element_Array => xcb.xcb_rgb_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_rgb_t;
|
src/tcl-strings.adb | thindil/tashy2 | 2 | 7968 | -- Copyright (c) 2020-2021 <NAME> <<EMAIL>>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Ada.Strings.Maps;
package body Tcl.Strings is
function To_Tcl_String
(Source: String; Evaluate: Boolean := False) return Tcl_String is
New_String: Tcl_String := Null_Tcl_String;
Element_Index: Natural := 1;
procedure Truncate_New_String is
begin
if Length(Source => New_String) = Natural'Last then
Delete
(Source => New_String, From => Natural'Last,
Through => Natural'Last);
end if;
if Length(Source => New_String) = Natural'Last - 1 then
Delete
(Source => New_String, From => Natural'Last - 1,
Through => Natural'Last - 1);
end if;
end Truncate_New_String;
begin
if Source'Length <= Natural'Last - Length(Source => New_String) then
Append(Source => New_String, New_Item => Source);
else
Append
(Source => New_String,
New_Item =>
Source
(Source'First .. Natural'Last - Length(Source => New_String)));
end if;
if Index(Source => New_String, Pattern => " ") = 0 or
Source'Length < 2 then
return New_String;
end if;
if Evaluate then
Evaluated_String_Loop :
loop
pragma Loop_Invariant
(Element_Index in 1 .. Length(Source => New_String));
Element_Index :=
Index
(Source => New_String, Pattern => """", From => Element_Index);
exit Evaluated_String_Loop when Element_Index = 0 or
Element_Index > Length(Source => New_String) or
Length(Source => New_String) = Natural'Last;
Insert
(Source => New_String, Before => Element_Index, New_Item => "\");
exit Evaluated_String_Loop when Element_Index > Natural'Last - 2;
Element_Index := Element_Index + 2;
exit Evaluated_String_Loop when Element_Index >
Length(Source => New_String);
end loop Evaluated_String_Loop;
Truncate_New_String;
Insert(Source => New_String, Before => 1, New_Item => """");
Append(Source => New_String, New_Item => """");
else
Truncate_New_String;
Insert(Source => New_String, Before => 1, New_Item => "{");
Append(Source => New_String, New_Item => "}");
end if;
return New_String;
end To_Tcl_String;
function To_Ada_String(Source: Tcl_String) return String is
use Ada.Strings.Maps;
New_String: Tcl_String := Source;
Element_Index: Natural := 1;
begin
if Length(Source => Source) = 0 then
return "";
end if;
if Element(Source => New_String, Index => 1) = '{' then
Trim
(Source => New_String, Left => To_Set(Sequence => "{"),
Right => To_Set(Sequence => "}"));
elsif Element(Source => New_String, Index => 1) = '"' then
Trim
(Source => New_String, Left => To_Set(Sequence => """"),
Right => To_Set(Sequence => """"));
if Length(Source => New_String) > 1 then
Remove_Quotes_Loop :
loop
pragma Loop_Invariant
(Element_Index in 1 .. Length(Source => New_String));
Element_Index :=
Index
(Source => New_String, Pattern => "\""",
From => Element_Index);
exit Remove_Quotes_Loop when Element_Index not in
1 .. Length(Source => New_String);
Delete
(Source => New_String, From => Element_Index,
Through => Element_Index);
exit Remove_Quotes_Loop when Element_Index >
Length(Source => New_String);
end loop Remove_Quotes_Loop;
end if;
end if;
return
Slice
(Source => New_String, Low => 1,
High => Length(Source => New_String));
end To_Ada_String;
end Tcl.Strings;
|
generated/natools-static_maps-web-tag_pages-components.adb | faelys/natools-web | 1 | 20216 | with Interfaces; use Interfaces;
package body Natools.Static_Maps.Web.Tag_Pages.Components is
P : constant array (0 .. 5) of Natural :=
(1, 5, 9, 14, 18, 24);
T1 : constant array (0 .. 5) of Unsigned_8 :=
(41, 18, 12, 22, 20, 39);
T2 : constant array (0 .. 5) of Unsigned_8 :=
(21, 12, 19, 39, 35, 24);
G : constant array (0 .. 46) of Unsigned_8 :=
(0, 6, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 15, 0, 20, 0, 0, 17, 0, 0, 19,
12, 0, 4, 2, 0, 0, 0, 9, 0, 3, 9, 0, 5, 0, 1, 0, 1, 13, 21, 6, 11, 0,
12, 0, 3);
function Hash (S : String) return Natural is
F : constant Natural := S'First - 1;
L : constant Natural := S'Length;
F1, F2 : Natural := 0;
J : Natural;
begin
for K in P'Range loop
exit when L < P (K);
J := Character'Pos (S (P (K) + F));
F1 := (F1 + Natural (T1 (K)) * J) mod 47;
F2 := (F2 + Natural (T2 (K)) * J) mod 47;
end loop;
return (Natural (G (F1)) + Natural (G (F2))) mod 23;
end Hash;
end Natools.Static_Maps.Web.Tag_Pages.Components;
|
StartPicture/_code/GlobalCode/odd_bmp.asm | kosmonautdnb/TheLandsOfZador | 0 | 165620 | ORG $2000
dc.b $55,$9A,$6A,$69,$61,$A0,$5F,$6F,$55,$55,$5A,$46,$55,$AA,$6D,$6F
dc.b $55,$95,$55,$55,$54,$98,$6A,$59,$50,$0A,$50,$90,$4B,$2B,$46,$AC
dc.b $4F,$5B,$06,$3F,$D7,$E9,$15,$19,$F6,$FF,$7F,$EB,$E8,$7E,$4A,$52
dc.b $60,$D6,$50,$F6,$20,$44,$55,$5A,$1A,$06,$22,$56,$6A,$56,$75,$AA
dc.b $50,$52,$55,$A5,$69,$01,$7D,$FE,$0B,$42,$42,$41,$17,$02,$7F,$7E
dc.b $59,$AA,$35,$06,$5C,$5A,$46,$62,$5C,$58,$5A,$5A,$00,$60,$65,$AA
dc.b $5A,$15,$5A,$02,$5A,$15,$56,$FD,$55,$55,$55,$A5,$55,$99,$55,$AA
dc.b $56,$54,$55,$55,$6E,$3F,$C5,$60,$6A,$D5,$19,$77,$6A,$AE,$66,$04
dc.b $53,$8A,$4A,$DD,$E0,$7A,$0E,$5E,$60,$E2,$60,$80,$06,$C5,$7A,$B0
dc.b $06,$5D,$41,$59,$68,$FE,$46,$01,$C0,$D9,$54,$FE,$68,$AE,$69,$02
dc.b $2A,$40,$40,$D9,$55,$AA,$5A,$95,$50,$0A,$09,$55,$59,$FF,$48,$00
dc.b $C6,$DF,$5B,$FB,$DE,$5E,$52,$52,$E7,$7D,$6B,$7F,$D5,$EE,$15,$2A
dc.b $7A,$50,$58,$ED,$0E,$C6,$36,$36,$15,$2A,$06,$3A,$6A,$6A,$68,$68
dc.b $FF,$DB,$57,$5B,$D5,$DD,$59,$AA,$40,$B0,$D4,$F6,$64,$44,$5D,$FE
dc.b $51,$99,$30,$64,$08,$64,$6B,$4B,$14,$29,$51,$2A,$09,$49,$FF,$55
dc.b $D7,$28,$0F,$42,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$56
dc.b $55,$59,$55,$56,$55,$95,$55,$95,$55,$55,$55,$55,$55,$55,$57,$5E
dc.b $55,$64,$5A,$58,$D7,$56,$56,$56,$7C,$ED,$D6,$56,$5A,$59,$69,$55
dc.b $56,$5A,$55,$96,$5A,$59,$55,$A5,$5A,$6A,$68,$54,$4F,$0E,$7E,$7F
dc.b $D4,$EC,$68,$28,$01,$02,$D6,$D5,$1A,$0A,$16,$02,$55,$55,$55,$55
dc.b $6A,$95,$56,$56,$DA,$55,$FF,$5A,$55,$AA,$55,$55,$55,$55,$FF,$5A
dc.b $5A,$56,$55,$56,$55,$55,$FF,$56,$45,$91,$55,$96,$5D,$6B,$76,$AA
dc.b $36,$3D,$06,$01,$7A,$6A,$60,$00,$7C,$A7,$4F,$8F,$40,$02,$00,$0C
dc.b $68,$C2,$66,$DE,$6A,$15,$6A,$6A,$5A,$15,$5A,$AA,$6B,$FF,$55,$66
dc.b $65,$5A,$69,$AA,$FF,$7E,$55,$A5,$56,$A5,$6A,$59,$77,$BB,$67,$95
dc.b $60,$A0,$55,$59,$55,$56,$C5,$66,$56,$2A,$5A,$6F,$45,$A1,$6A,$7F
dc.b $5A,$04,$6A,$55,$55,$6A,$0A,$75,$5A,$55,$55,$56,$5D,$A8,$69,$AA
dc.b $7F,$7B,$50,$54,$68,$AA,$5A,$57,$73,$BF,$70,$83,$00,$62,$28,$7F
dc.b $CE,$73,$5E,$FD,$6A,$10,$06,$C0,$56,$01,$D6,$FD,$5D,$AE,$6A,$B8
dc.b $DC,$E3,$3B,$D8,$5C,$EE,$69,$90,$07,$FC,$FF,$C0,$D9,$D5,$55,$03
dc.b $64,$F0,$DF,$00,$55,$40,$01,$0E,$7F,$FF,$F0,$00,$58,$40,$65,$FF
dc.b $DF,$D9,$15,$1A,$06,$02,$05,$65,$0A,$4C,$2A,$4F,$58,$5A,$5A,$5C
dc.b $16,$13,$72,$C2,$14,$00,$42,$FF,$55,$A9,$58,$58,$01,$00,$08,$DD
dc.b $2A,$40,$F5,$FF,$15,$00,$44,$EC,$5A,$06,$6B,$D7,$67,$29,$15,$56
dc.b $D2,$32,$56,$65,$FD,$FE,$7F,$A9,$55,$5A,$56,$56,$56,$55,$5F,$AA
dc.b $55,$95,$55,$55,$EA,$6A,$FE,$6A,$55,$55,$55,$55,$55,$6A,$5F,$5A
dc.b $55,$65,$55,$95,$55,$65,$FF,$5A,$54,$56,$5E,$5E,$56,$57,$DD,$5E
dc.b $57,$A6,$56,$56,$C5,$F6,$53,$4A,$5A,$16,$65,$A5,$16,$2A,$FF,$69
dc.b $5A,$95,$6A,$56,$55,$6A,$DF,$6A,$5A,$55,$55,$55,$55,$55,$FF,$55
dc.b $5A,$56,$6A,$5A,$55,$55,$FF,$55,$55,$6A,$55,$6A,$55,$56,$FF,$55
dc.b $6A,$1A,$6A,$AA,$56,$55,$7D,$56,$69,$58,$5A,$5A,$6A,$56,$FF,$6A
dc.b $55,$A5,$56,$56,$56,$96,$FF,$55,$60,$58,$02,$12,$69,$09,$FA,$5A
dc.b $20,$50,$55,$56,$65,$55,$5A,$5A,$46,$11,$07,$06,$43,$28,$49,$BE
dc.b $D5,$7B,$40,$E8,$60,$70,$56,$5C,$00,$6A,$50,$08,$5A,$50,$6A,$2A
dc.b $00,$56,$04,$02,$5A,$10,$55,$A9,$06,$55,$1E,$0A,$4B,$7A,$69,$64
dc.b $35,$1A,$FE,$7F,$7F,$7B,$65,$A9,$59,$A6,$5A,$D7,$65,$DF,$56,$57
dc.b $75,$A6,$55,$5F,$55,$DF,$69,$BB,$55,$A6,$56,$75,$55,$D5,$55,$FF
dc.b $FB,$6A,$59,$99,$56,$55,$55,$EB,$FF,$DD,$56,$75,$55,$69,$04,$58
dc.b $FD,$FF,$56,$55,$45,$59,$42,$F0,$D1,$E5,$44,$9A,$56,$66,$02,$7E
dc.b $60,$76,$04,$06,$55,$59,$11,$22,$59,$19,$40,$88,$55,$A9,$65,$49
dc.b $66,$57,$5A,$55,$50,$58,$65,$55,$F5,$7F,$07,$1E,$1A,$3A,$5A,$5B
dc.b $F6,$F6,$56,$57,$57,$AA,$6A,$AA,$55,$A5,$61,$4B,$07,$4E,$58,$57
dc.b $DF,$FE,$FA,$6A,$D6,$D6,$16,$17,$7E,$57,$55,$AA,$6A,$56,$42,$C0
dc.b $7D,$EA,$55,$A5,$55,$95,$55,$95,$58,$D5,$4A,$4A,$1A,$06,$56,$55
dc.b $2A,$4A,$55,$55,$55,$59,$5F,$A5,$55,$55,$56,$5A,$5A,$6A,$FF,$59
dc.b $5A,$58,$10,$52,$56,$56,$55,$AA,$6A,$06,$55,$A8,$56,$55,$5A,$56
dc.b $55,$56,$66,$16,$66,$56,$7E,$5A,$54,$24,$6E,$6A,$7E,$EA,$5E,$57
dc.b $54,$69,$DA,$C5,$EA,$60,$66,$55,$55,$26,$55,$96,$55,$59,$47,$76
dc.b $55,$65,$55,$55,$55,$55,$FF,$65,$55,$55,$55,$55,$55,$55,$FF,$55
dc.b $55,$55,$55,$55,$55,$55,$FF,$55,$55,$55,$55,$55,$55,$55,$FF,$55
dc.b $5A,$06,$5A,$56,$6A,$5A,$6A,$56,$55,$55,$55,$56,$59,$5A,$5A,$5B
dc.b $55,$55,$55,$96,$59,$69,$55,$95,$56,$56,$56,$9A,$55,$99,$55,$55
dc.b $05,$08,$6F,$4F,$3D,$3E,$40,$80,$D6,$55,$5A,$58,$6A,$5A,$3A,$4A
dc.b $19,$1D,$65,$A9,$6A,$6A,$56,$AA,$6A,$6A,$55,$60,$5A,$A0,$55,$A9
dc.b $41,$94,$53,$0E,$6A,$AA,$6A,$6A,$01,$06,$55,$AA,$56,$5E,$02,$50
dc.b $56,$55,$7F,$5A,$6F,$7F,$00,$56,$56,$66,$69,$67,$F7,$FD,$02,$55
dc.b $75,$A5,$75,$FD,$FF,$7F,$55,$69,$7D,$56,$55,$FD,$7E,$FE,$2A,$55
dc.b $55,$6A,$7F,$7F,$57,$EF,$45,$96,$57,$A9,$59,$F7,$DF,$EF,$28,$69
dc.b $DE,$D7,$55,$95,$54,$99,$5D,$B9,$FE,$76,$22,$55,$02,$44,$59,$AE
dc.b $46,$97,$48,$04,$14,$02,$56,$AB,$14,$65,$2A,$6A,$6A,$56,$6A,$56
dc.b $55,$04,$55,$56,$67,$60,$6B,$BF,$02,$06,$2F,$5F,$7F,$6B,$7B,$FF
dc.b $56,$5A,$FF,$F5,$57,$FE,$57,$F6,$5A,$56,$D0,$E8,$40,$A8,$6A,$FB
dc.b $EA,$6A,$40,$42,$00,$45,$55,$F5,$FB,$7F,$00,$51,$06,$4E,$7B,$69
dc.b $59,$D5,$40,$90,$60,$60,$65,$95,$56,$55,$55,$00,$6A,$05,$5A,$DA
dc.b $54,$AA,$56,$15,$5A,$55,$5A,$55,$08,$55,$55,$AA,$55,$95,$55,$55
dc.b $00,$10,$56,$55,$6A,$55,$5A,$55,$46,$01,$69,$55,$55,$9A,$69,$55
dc.b $56,$68,$55,$AA,$55,$AA,$56,$AA,$56,$01,$5B,$54,$56,$A6,$55,$6A
dc.b $55,$95,$ED,$69,$5E,$5E,$12,$12,$DA,$52,$55,$95,$55,$95,$55,$95
dc.b $55,$65,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55
dc.b $55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55
dc.b $F5,$F9,$12,$50,$55,$A6,$FF,$55,$54,$56,$55,$65,$55,$A5,$FA,$5F
dc.b $7B,$53,$67,$29,$FD,$55,$60,$E0,$55,$59,$55,$95,$14,$D5,$06,$00
dc.b $6A,$6A,$43,$52,$7F,$CA,$DA,$4A,$6F,$53,$DE,$5C,$DA,$7A,$1A,$5A
dc.b $FB,$5A,$00,$12,$50,$67,$6B,$3B,$66,$55,$56,$AA,$55,$56,$F5,$DA
dc.b $16,$15,$1A,$1A,$69,$55,$D2,$52,$6A,$55,$65,$55,$19,$19,$55,$A5
dc.b $56,$56,$56,$56,$55,$95,$56,$55,$55,$65,$55,$69,$5A,$5A,$55,$6A
dc.b $55,$59,$55,$9A,$55,$A5,$45,$AA,$65,$AA,$65,$6A,$69,$A9,$00,$4A
dc.b $55,$96,$56,$56,$55,$A6,$20,$44,$55,$96,$55,$A5,$55,$66,$00,$00
dc.b $6A,$69,$69,$59,$55,$95,$0A,$4A,$14,$56,$56,$5A,$55,$BE,$5A,$6A
dc.b $00,$56,$5A,$A6,$55,$69,$56,$AA,$0F,$5B,$54,$AB,$55,$6A,$55,$A5
dc.b $E0,$60,$FF,$DE,$68,$5B,$59,$59,$00,$45,$7F,$75,$19,$68,$69,$AA
dc.b $02,$50,$FA,$DF,$40,$20,$56,$A6,$00,$55,$FF,$FF,$10,$00,$5A,$55
dc.b $00,$44,$FF,$FF,$04,$00,$59,$55,$07,$0B,$DA,$F5,$15,$04,$55,$A9
dc.b $68,$80,$6A,$AA,$5A,$55,$55,$66,$0F,$4B,$5A,$56,$6A,$AA,$57,$56
dc.b $6A,$15,$55,$65,$55,$A5,$EF,$5F,$57,$BF,$50,$55,$55,$A5,$6A,$EA
dc.b $FF,$7F,$40,$28,$55,$66,$55,$55,$D9,$EA,$6A,$24,$6F,$6A,$5E,$5C
dc.b $DF,$FF,$54,$20,$EB,$41,$55,$D5,$55,$FB,$14,$55,$FE,$66,$7E,$7A
dc.b $6B,$2B,$68,$E9,$64,$68,$E8,$68,$6A,$EA,$2A,$4A,$16,$3D,$5E,$57
dc.b $55,$55,$55,$55,$7F,$5A,$55,$55,$55,$55,$55,$56,$FF,$55,$5F,$7E
dc.b $55,$55,$55,$55,$FF,$69,$EA,$7A,$55,$55,$55,$55,$FF,$55,$55,$55
dc.b $7F,$55,$55,$56,$20,$44,$60,$68,$FF,$56,$55,$02,$1A,$06,$00,$01
dc.b $72,$EA,$7D,$56,$6A,$2A,$56,$16,$55,$56,$55,$FB,$55,$6A,$65,$A6
dc.b $50,$90,$56,$FA,$FE,$55,$55,$6A,$56,$5A,$48,$50,$4F,$AA,$65,$55
dc.b $63,$68,$5A,$55,$5E,$AB,$55,$AA,$57,$AA,$64,$5A,$54,$56,$FF,$56
dc.b $FE,$F5,$6A,$F6,$5A,$5E,$F5,$F9,$55,$A9,$6A,$6A,$55,$AB,$66,$BA
dc.b $55,$AA,$5A,$5A,$55,$FE,$7F,$5A,$59,$AA,$55,$AA,$5B,$FF,$FF,$6A
dc.b $55,$A9,$6A,$55,$56,$FF,$5E,$AA,$62,$46,$5A,$56,$4A,$69,$FA,$5A
dc.b $51,$55,$15,$FB,$40,$62,$54,$65,$56,$55,$04,$CF,$55,$BA,$06,$06
dc.b $10,$52,$01,$FE,$73,$69,$57,$EB,$29,$55,$06,$F6,$6A,$55,$6A,$BA
dc.b $6A,$65,$6A,$55,$66,$55,$6A,$D5,$5A,$5A,$55,$AA,$66,$56,$69,$AA
dc.b $6A,$6A,$55,$A5,$6A,$4A,$D8,$D6,$6A,$2B,$68,$60,$55,$96,$56,$A8
dc.b $5A,$DD,$5A,$5A,$55,$0A,$40,$A8,$55,$56,$55,$AA,$51,$5A,$1A,$01
dc.b $55,$55,$55,$AA,$45,$00,$09,$5A,$55,$55,$55,$28,$0A,$12,$66,$6A
dc.b $55,$E5,$55,$59,$52,$51,$59,$65,$FF,$5A,$55,$6A,$6A,$9A,$5A,$5A
dc.b $69,$AA,$55,$A9,$56,$96,$6A,$AA,$65,$AA,$55,$59,$55,$99,$69,$A9
dc.b $55,$A5,$55,$99,$55,$55,$6A,$6A,$55,$96,$75,$59,$5A,$AA,$56,$6A
dc.b $1A,$6A,$FE,$6A,$56,$55,$5A,$55,$55,$5A,$FF,$6A,$55,$AA,$55,$55
dc.b $7A,$A8,$FE,$56,$6A,$6A,$56,$56,$2F,$7F,$56,$56,$7A,$32,$57,$56
dc.b $EA,$6A,$17,$E9,$67,$53,$6A,$6A,$55,$EB,$FC,$52,$5F,$FB,$77,$A6
dc.b $4F,$76,$16,$C0,$42,$42,$F8,$5A,$55,$55,$5F,$0A,$55,$55,$15,$25
dc.b $56,$6A,$56,$56,$56,$5A,$56,$55,$42,$00,$62,$50,$6F,$4F,$7A,$5C
dc.b $0A,$48,$01,$0E,$F7,$FB,$00,$16,$2A,$56,$15,$3A,$55,$6A,$15,$19
dc.b $5A,$AA,$57,$BE,$5A,$9A,$5A,$66,$59,$55,$FA,$55,$55,$96,$55,$A9
dc.b $67,$FD,$FD,$65,$59,$5A,$55,$A5,$7F,$FE,$EA,$6A,$5A,$6A,$5A,$AA
dc.b $D6,$5A,$56,$55,$55,$59,$5A,$56,$6B,$AF,$6A,$AA,$66,$65,$69,$9A
dc.b $5F,$7E,$55,$AA,$56,$55,$55,$A5,$FF,$55,$57,$56,$6A,$5A,$65,$A9
dc.b $6B,$DF,$7E,$AA,$5A,$9A,$5A,$66,$FD,$FE,$57,$A5,$5A,$56,$5A,$56
dc.b $55,$69,$55,$AE,$67,$66,$6A,$59,$02,$52,$01,$FF,$7A,$5A,$50,$55
dc.b $65,$56,$56,$AA,$5A,$5A,$60,$08,$DA,$49,$59,$51,$C6,$F6,$06,$01
dc.b $5A,$55,$56,$56,$5A,$59,$59,$55,$55,$A9,$6A,$6A,$56,$5B,$43,$93
dc.b $78,$E0,$6C,$6C,$7C,$9C,$53,$E4,$6A,$A0,$69,$41,$F3,$5B,$1A,$F4
dc.b $15,$09,$16,$28,$CE,$77,$02,$D1,$40,$44,$56,$6A,$56,$16,$FA,$15
dc.b $6A,$18,$56,$66,$6A,$AA,$FA,$DE,$6A,$56,$1A,$05,$60,$55,$67,$B1
dc.b $55,$99,$5A,$AA,$2A,$52,$EF,$5B,$5A,$56,$6A,$55,$6A,$15,$FA,$D5
dc.b $5A,$6A,$5A,$6A,$5A,$2A,$55,$A5,$55,$95,$5A,$55,$59,$6E,$40,$5A
dc.b $56,$A9,$55,$AA,$55,$9A,$EA,$7A,$55,$A9,$55,$A9,$56,$9A,$56,$AA
dc.b $6A,$AA,$6A,$AA,$58,$0B,$D6,$F0,$55,$95,$55,$AA,$56,$D6,$4E,$F2
dc.b $56,$A8,$56,$AA,$58,$20,$55,$69,$65,$28,$46,$3C,$5F,$56,$02,$66
dc.b $7A,$DA,$3E,$17,$5B,$56,$55,$AA,$7A,$AB,$43,$63,$1A,$6A,$55,$AA
dc.b $FE,$F4,$56,$56,$5B,$5A,$5A,$56,$06,$15,$35,$FA,$C0,$7F,$40,$54
dc.b $55,$56,$6A,$65,$59,$59,$56,$AA,$6F,$AF,$40,$48,$50,$A3,$7F,$6F
dc.b $55,$11,$03,$01,$00,$60,$FD,$6D,$40,$60,$FF,$69,$55,$5F,$55,$56
dc.b $46,$45,$EA,$55,$5F,$5F,$40,$6A,$55,$56,$55,$AF,$FF,$FF,$08,$50
dc.b $55,$95,$55,$AF,$FF,$D9,$00,$68,$5A,$AA,$6A,$FA,$FE,$55,$00,$6A
dc.b $52,$52,$DA,$C5,$5E,$55,$16,$55,$12,$72,$EA,$6A,$6A,$AA,$6A,$5A
dc.b $56,$55,$5A,$FE,$7F,$AA,$00,$5A,$55,$A6,$55,$7E,$FE,$F5,$14,$59
dc.b $56,$9A,$6A,$FF,$FE,$D5,$02,$6A,$5A,$56,$67,$AA,$7F,$FF,$02,$55
dc.b $40,$54,$FF,$59,$55,$D7,$6A,$AA,$22,$40,$FF,$55,$5E,$7E,$41,$59
dc.b $56,$05,$18,$04,$C2,$D2,$F6,$F7,$D6,$C6,$36,$06,$06,$06,$5E,$5E
dc.b $56,$56,$55,$56,$55,$66,$55,$56,$7F,$80,$58,$58,$68,$60,$6A,$AF
dc.b $5F,$9F,$55,$56,$66,$0A,$55,$FF,$F3,$52,$E8,$60,$18,$18,$DF,$EF
dc.b $56,$55,$1A,$06,$0A,$12,$DA,$F6,$69,$D9,$54,$56,$62,$4F,$42,$4A
dc.b $6B,$F0,$6E,$6A,$DB,$79,$60,$6B,$5B,$04,$FA,$D9,$52,$7A,$E9,$69
dc.b $5A,$AE,$2A,$6A,$1A,$5A,$6A,$59,$5A,$55,$55,$AA,$66,$6A,$56,$56
dc.b $55,$59,$65,$55,$55,$69,$05,$09,$62,$63,$5A,$5A,$55,$56,$55,$5A
dc.b $6A,$56,$56,$56,$55,$55,$56,$6A,$56,$5A,$6A,$A8,$6A,$68,$5E,$72
dc.b $7B,$DA,$29,$55,$6A,$AA,$55,$69,$F7,$0A,$4B,$5D,$7D,$BA,$2B,$67
dc.b $08,$41,$EA,$7F,$1A,$7A,$50,$A6,$5A,$AA,$6A,$EA,$FF,$FF,$02,$40
dc.b $56,$55,$5A,$57,$DA,$FD,$05,$08,$6A,$55,$55,$FA,$EA,$6A,$16,$2A
dc.b $50,$5A,$7C,$6A,$7A,$7A,$19,$02,$15,$10,$00,$55,$40,$55,$FF,$55
dc.b $65,$AA,$6A,$7F,$FA,$56,$68,$8A,$50,$52,$75,$67,$51,$58,$64,$A8
dc.b $10,$28,$76,$56,$00,$19,$73,$FE,$15,$37,$5A,$9A,$16,$17,$FF,$7D
dc.b $57,$F7,$41,$69,$49,$EB,$55,$55,$7F,$7E,$28,$55,$65,$DF,$76,$5A
dc.b $7F,$BF,$00,$65,$6A,$FE,$6A,$55,$FF,$FD,$00,$5A,$55,$FA,$55,$6A
dc.b $EF,$55,$1A,$55,$55,$AA,$5A,$AA,$6A,$AA,$6A,$AA,$56,$55,$55,$55
dc.b $5F,$AB,$5A,$5A,$69,$EF,$5A,$5A,$DD,$FE,$50,$6A,$55,$79,$65,$A6
dc.b $FF,$FF,$40,$91,$69,$BA,$5A,$6A,$7F,$7F,$54,$9A,$6A,$EE,$55,$6A
dc.b $55,$55,$55,$95,$55,$55,$55,$59,$51,$55,$56,$45,$04,$54,$57,$5D
dc.b $0A,$4A,$6B,$5B,$3D,$02,$7C,$BD,$68,$03,$FA,$D5,$56,$59,$DC,$72
dc.b $6A,$A9,$56,$5A,$4A,$6A,$DA,$48,$56,$68,$DF,$FF,$72,$53,$6A,$54
dc.b $41,$08,$D5,$65,$22,$40,$1B,$FF,$64,$24,$FB,$59,$60,$40,$76,$FB
dc.b $06,$01,$55,$55,$0C,$06,$FF,$FF,$4E,$7A,$FA,$DA,$54,$97,$C6,$1A
dc.b $C5,$C6,$6F,$6F,$69,$A9,$57,$58,$6A,$55,$6E,$FF,$5A,$5A,$5A,$56
dc.b $55,$95,$75,$E5,$6A,$5A,$55,$55,$55,$5A,$56,$56,$55,$5A,$6A,$6A
dc.b $41,$42,$56,$5A,$56,$56,$59,$6A,$55,$55,$6A,$6A,$56,$56,$5A,$6A
dc.b $56,$96,$65,$6A,$65,$55,$5A,$6A,$68,$A0,$6A,$5B,$FC,$68,$65,$54
dc.b $EA,$6A,$52,$52,$19,$18,$64,$94,$76,$56,$6A,$58,$55,$DB,$63,$C0
dc.b $2F,$6E,$40,$20,$56,$55,$D5,$69,$FF,$55,$01,$00,$68,$EA,$55,$A5
dc.b $6A,$AB,$5A,$55,$45,$55,$57,$55,$7A,$FA,$54,$52,$5A,$DA,$D5,$55
dc.b $7A,$5F,$52,$50,$6A,$D6,$69,$65,$00,$55,$5A,$15,$00,$55,$57,$AA
dc.b $66,$66,$5A,$98,$59,$89,$65,$84,$58,$54,$58,$A0,$FA,$52,$FA,$72
dc.b $40,$02,$41,$08,$30,$1F,$30,$6F,$4A,$0A,$68,$2A,$73,$7F,$F2,$DC
dc.b $50,$55,$10,$55,$57,$59,$55,$65,$17,$17,$17,$16,$DF,$57,$EB,$6A
dc.b $FD,$FF,$FE,$55,$5A,$55,$55,$56,$DE,$FE,$D7,$56,$6A,$6A,$55,$56
dc.b $D5,$DA,$E6,$6A,$55,$AA,$55,$AA,$65,$A9,$57,$A5,$55,$AA,$55,$A5
dc.b $FB,$7F,$55,$A5,$56,$55,$55,$AA,$55,$F5,$55,$65,$75,$99,$6B,$5A
dc.b $6B,$AB,$5D,$65,$F5,$59,$5F,$55,$D5,$F5,$55,$55,$F5,$55,$F7,$55
dc.b $62,$BA,$54,$54,$55,$55,$DD,$55,$08,$49,$04,$59,$7F,$76,$FD,$FE
dc.b $49,$0A,$41,$02,$43,$77,$C4,$57,$52,$0D,$0A,$4A,$D4,$E4,$E8,$6C
dc.b $6A,$6A,$6A,$6A,$61,$89,$45,$85,$5A,$6A,$55,$95,$55,$96,$55,$AA
dc.b $6A,$80,$54,$56,$5A,$68,$56,$56,$60,$20,$41,$81,$07,$07,$53,$52
dc.b $00,$79,$56,$56,$FD,$CE,$3E,$D6,$E5,$65,$6B,$6A,$6A,$6A,$6A,$6A
dc.b $F6,$F2,$CA,$4A,$58,$5B,$68,$58,$56,$56,$5A,$5A,$69,$69,$55,$A9
dc.b $55,$55,$55,$56,$55,$95,$55,$A5,$59,$55,$6A,$6F,$5A,$5A,$56,$5A
dc.b $6A,$6A,$56,$FE,$56,$A8,$54,$AB,$55,$55,$55,$55,$15,$E5,$F6,$FD
dc.b $5A,$56,$6A,$D9,$59,$AA,$69,$6A,$56,$56,$5A,$F5,$59,$6A,$69,$6A
dc.b $69,$A9,$59,$5F,$6A,$6A,$55,$65,$56,$A5,$56,$7F,$65,$65,$55,$55
dc.b $77,$9F,$7F,$4A,$59,$55,$59,$6A,$55,$B5,$55,$95,$5A,$96,$6A,$7A
dc.b $10,$55,$00,$6A,$77,$55,$77,$57,$17,$55,$12,$56,$FF,$F5,$FF,$FD
dc.b $7A,$7F,$55,$A9,$D5,$59,$F5,$D6,$40,$EA,$00,$55,$6A,$55,$5F,$AA
dc.b $59,$AA,$65,$54,$5A,$AA,$55,$95,$41,$21,$31,$FD,$46,$06,$CE,$1E
dc.b $50,$A0,$6F,$53,$56,$64,$76,$F4,$60,$80,$07,$F7,$66,$4A,$69,$EE
dc.b $4A,$5A,$1E,$C2,$18,$05,$36,$0F,$01,$41,$7F,$5F,$50,$55,$40,$C0
dc.b $50,$55,$55,$D5,$00,$40,$40,$54,$5F,$7E,$5A,$5A,$56,$5F,$55,$5A
dc.b $65,$EA,$55,$5A,$D6,$EA,$5A,$6A,$DF,$6B,$56,$55,$56,$AA,$65,$55
dc.b $D5,$EF,$5A,$56,$6A,$55,$55,$A5,$65,$FD,$5A,$56,$FA,$7F,$55,$95
dc.b $40,$51,$5F,$57,$60,$E0,$40,$0A,$00,$05,$F6,$F5,$60,$20,$00,$40
dc.b $01,$49,$F7,$D5,$06,$00,$15,$3B,$00,$01,$0F,$57,$1A,$0A,$57,$C3
dc.b $68,$2A,$01,$CE,$56,$56,$F6,$D5,$58,$50,$6C,$6C,$5A,$8A,$D5,$F8
dc.b $5A,$59,$50,$7B,$49,$48,$51,$F0,$6A,$5A,$6A,$16,$55,$A5,$7A,$FA
dc.b $56,$66,$59,$54,$64,$53,$F6,$DA,$54,$52,$C5,$59,$57,$67,$5A,$58
dc.b $05,$7F,$D5,$D6,$12,$12,$41,$C0,$DE,$7E,$56,$DA,$07,$07,$5A,$0A
dc.b $5E,$57,$69,$A9,$EB,$57,$65,$65,$55,$99,$66,$DC,$55,$1A,$65,$10
dc.b $55,$AA,$59,$AA,$55,$AA,$6A,$55,$56,$5A,$5A,$5A,$5A,$5A,$53,$58
dc.b $55,$69,$69,$79,$49,$8A,$6A,$4A,$4F,$8F,$4A,$7A,$4F,$6F,$58,$56
dc.b $19,$C9,$5A,$5E,$FD,$FE,$56,$56,$56,$96,$6A,$59,$65,$65,$65,$69
dc.b $55,$9A,$55,$95,$55,$65,$55,$55,$55,$55,$55,$95,$55,$66,$55,$55
dc.b $5A,$6A,$6A,$69,$55,$56,$55,$55,$54,$56,$59,$55,$66,$6A,$56,$5A
dc.b $50,$55,$EF,$6A,$40,$4A,$40,$68,$00,$10,$FF,$7F,$00,$10,$00,$00
dc.b $01,$17,$FE,$F5,$00,$00,$12,$30,$DA,$D5,$6B,$6A,$52,$55,$10,$15
dc.b $6A,$55,$55,$AA,$55,$9A,$55,$6A,$75,$B5,$E9,$69,$65,$65,$56,$AB
dc.b $66,$AC,$67,$A7,$59,$59,$69,$EA,$56,$5D,$66,$54,$6A,$1A,$7F,$69
dc.b $4A,$30,$FB,$DF,$75,$96,$5D,$65,$40,$20,$FF,$F7,$D1,$60,$60,$B0
dc.b $30,$42,$7F,$EA,$15,$55,$0A,$6A,$3F,$5A,$56,$6A,$55,$5D,$55,$AA
dc.b $6A,$AA,$56,$56,$55,$FA,$55,$56,$59,$56,$55,$69,$56,$55,$55,$AA
dc.b $56,$56,$65,$69,$65,$AB,$6A,$5A,$57,$5A,$5F,$5F,$40,$45,$50,$90
dc.b $10,$4C,$03,$FF,$37,$00,$02,$16,$41,$02,$D0,$F7,$FE,$58,$66,$CA
dc.b $6A,$3C,$C6,$CB,$53,$69,$51,$5A,$4A,$0C,$5F,$FB,$08,$69,$65,$65
dc.b $69,$DF,$55,$FA,$54,$BC,$4A,$3F,$6A,$FF,$51,$D7,$17,$01,$15,$02
dc.b $55,$03,$16,$F5,$7C,$4B,$1A,$6A,$55,$4A,$19,$6A,$69,$AA,$55,$A5
dc.b $D5,$56,$57,$97,$54,$BD,$6A,$5A,$72,$3B,$14,$3A,$19,$EA,$56,$56
dc.b $68,$F0,$3F,$DA,$15,$3B,$16,$1A,$1F,$2A,$35,$36,$36,$C2,$60,$49
dc.b $5C,$60,$7E,$7D,$70,$65,$20,$68,$19,$C2,$36,$FC,$42,$01,$02,$16
dc.b $5A,$55,$66,$56,$56,$56,$5E,$D4,$5F,$E9,$16,$16,$D2,$32,$1E,$DA
dc.b $6A,$A9,$66,$6A,$66,$AA,$67,$55,$5A,$6A,$5A,$5A,$56,$9A,$FF,$6A
dc.b $46,$1A,$59,$55,$55,$9A,$FF,$55,$55,$65,$55,$95,$55,$A9,$FF,$69
dc.b $55,$55,$55,$55,$55,$55,$FF,$5A,$55,$55,$55,$56,$55,$95,$FF,$55
dc.b $55,$55,$55,$AA,$59,$AA,$77,$56,$55,$5A,$54,$56,$57,$94,$F2,$52
dc.b $7C,$AA,$6A,$66,$68,$EA,$68,$A8,$04,$02,$F8,$52,$4E,$42,$45,$E3
dc.b $6A,$31,$56,$54,$76,$16,$54,$B4,$40,$AA,$FF,$DF,$00,$00,$00,$00
dc.b $0A,$68,$5A,$65,$59,$5A,$59,$9A,$55,$95,$55,$5A,$5F,$5A,$5D,$65
dc.b $45,$16,$5A,$A9,$F9,$59,$5A,$5A,$55,$60,$5B,$F3,$56,$56,$69,$8A
dc.b $56,$5A,$55,$59,$5A,$55,$69,$AA,$60,$80,$2F,$7F,$59,$A0,$64,$A4
dc.b $7F,$FE,$F0,$01,$05,$06,$14,$64,$56,$AA,$2A,$59,$59,$5A,$5A,$BF
dc.b $56,$AA,$55,$96,$56,$5A,$55,$FF,$55,$AA,$55,$6A,$55,$55,$56,$FB
dc.b $5A,$55,$65,$5A,$55,$9A,$59,$F7,$67,$A7,$56,$6A,$54,$A4,$58,$D4
dc.b $7E,$AB,$44,$40,$40,$0A,$05,$3A,$D0,$D2,$FF,$36,$19,$6E,$6A,$A6
dc.b $0A,$D5,$DA,$54,$15,$6F,$56,$56,$5B,$6E,$43,$32,$5A,$5A,$60,$60
dc.b $5A,$5F,$54,$56,$1A,$6E,$6A,$EA,$01,$DA,$C9,$55,$5A,$AF,$55,$AA
dc.b $5A,$AA,$55,$AA,$6A,$FF,$55,$AA,$55,$AA,$65,$AA,$5A,$FE,$55,$95
dc.b $55,$95,$55,$A9,$56,$D5,$55,$56,$55,$97,$5A,$6A,$55,$AA,$6A,$56
dc.b $E9,$69,$0E,$4A,$6A,$52,$60,$5A,$D7,$EE,$5C,$C2,$56,$96,$0A,$74
dc.b $6A,$AA,$40,$01,$11,$00,$12,$13,$FE,$F7,$00,$3F,$5A,$20,$10,$C0
dc.b $C2,$42,$D5,$D2,$40,$48,$65,$1A,$75,$95,$CD,$DA,$7D,$95,$6F,$5A
dc.b $6A,$AA,$6A,$A9,$7F,$5A,$7F,$59,$6A,$AA,$6A,$AA,$FF,$6A,$FF,$55
dc.b $55,$95,$55,$55,$FF,$55,$FF,$55,$55,$55,$55,$55,$FF,$6A,$FF,$55
dc.b $55,$95,$55,$55,$FE,$56,$FF,$55,$55,$AA,$56,$AA,$75,$59,$D7,$5A
dc.b $59,$56,$66,$5A,$FF,$56,$FE,$54,$55,$57,$55,$78,$11,$51,$40,$40
dc.b $6E,$BB,$40,$48,$21,$50,$40,$80,$D7,$6B,$D8,$0C,$12,$12,$55,$4A
dc.b $E0,$44,$7A,$F8,$52,$52,$5A,$5A,$7F,$EF,$73,$2A,$55,$00,$55,$00
dc.b $5A,$F9,$5B,$97,$55,$A7,$56,$54,$59,$59,$FA,$DB,$66,$65,$6A,$AA
dc.b $65,$6B,$6F,$EB,$DB,$6E,$5A,$5A,$5D,$6E,$55,$D9,$E5,$65,$59,$8A
dc.b $F9,$75,$7F,$FB,$F9,$59,$1A,$68,$56,$D6,$FE,$F6,$55,$6A,$20,$60
dc.b $5B,$60,$7A,$E0,$E2,$6B,$65,$A6,$16,$6A,$5A,$4A,$40,$80,$D7,$FE
dc.b $6A,$69,$02,$40,$55,$26,$FA,$65,$65,$AA,$14,$2A,$40,$0A,$59,$A9
dc.b $55,$AA,$0A,$55,$46,$02,$6F,$55,$60,$6A,$48,$40,$40,$AA,$D5,$D5
dc.b $1A,$1A,$58,$10,$2A,$69,$57,$56,$56,$56,$5A,$15,$52,$47,$56,$FD
dc.b $64,$13,$6A,$69,$65,$D0,$69,$69,$E5,$65,$FF,$6F,$5F,$4E,$60,$60
dc.b $D5,$26,$CA,$6A,$6A,$4A,$EA,$6A,$55,$AA,$55,$A5,$56,$55,$56,$56
dc.b $5A,$5A,$55,$55,$6A,$AA,$5A,$55,$59,$55,$55,$55,$56,$54,$6B,$6B
dc.b $69,$69,$6A,$6A,$45,$28,$F6,$5A,$55,$65,$55,$55,$56,$55,$66,$56
dc.b $6A,$5A,$5A,$56,$58,$50,$75,$59,$15,$56,$01,$55,$40,$02,$FD,$55
dc.b $40,$94,$56,$55,$55,$AA,$56,$55,$60,$55,$2A,$4A,$42,$40,$5F,$55
dc.b $36,$0E,$6A,$80,$54,$96,$57,$B7,$56,$57,$5F,$A5,$16,$01,$FE,$D7
dc.b $55,$96,$59,$59,$FD,$FE,$58,$56,$6A,$AA,$57,$5A,$5A,$AA,$05,$46
dc.b $55,$6A,$55,$AA,$FB,$56,$0A,$5A,$55,$AA,$55,$A5,$6A,$6A,$55,$55
dc.b $5A,$55,$56,$56,$55,$55,$55,$55,$55,$95,$55,$55,$55,$55,$55,$55
dc.b $55,$56,$55,$55,$55,$55,$56,$52,$04,$0E,$D6,$C5,$46,$AE,$59,$65
dc.b $62,$42,$66,$55,$5A,$6A,$55,$A6,$6A,$AE,$55,$8A,$51,$5A,$59,$95
dc.b $5A,$70,$56,$A9,$6A,$6B,$55,$A9,$7F,$3F,$5A,$55,$55,$7A,$55,$AA
dc.b $52,$50,$56,$54,$6A,$6A,$57,$9B,$59,$9A,$5A,$5A,$5A,$56,$5F,$BA
dc.b $55,$02,$55,$55,$55,$AA,$F1,$F2,$20,$54,$55,$A9,$5A,$0A,$7F,$BF
dc.b $54,$5A,$55,$55,$55,$AA,$E9,$57,$60,$9A,$5A,$6A,$69,$05,$6B,$A9
dc.b $65,$B6,$59,$AA,$6A,$6A,$5B,$79,$D9,$56,$3E,$F4,$05,$CA,$72,$CA
dc.b $55,$AA,$25,$55,$19,$D9,$55,$A5,$65,$AA,$5A,$56,$55,$55,$50,$A5
dc.b $5A,$5A,$5F,$7F,$7F,$6B,$50,$95,$FF,$7F,$FC,$FF,$FF,$75,$14,$15
dc.b $7E,$EA,$FE,$7A,$FF,$5F,$06,$02,$65,$55,$60,$AC,$67,$95,$65,$65
dc.b $69,$A9,$01,$36,$22,$60,$55,$DE,$D6,$D4,$66,$A9,$69,$A9,$D5,$E9
dc.b $16,$35,$68,$8F,$53,$90,$7A,$5A,$5A,$56,$DA,$5D,$17,$5A,$54,$59
dc.b $75,$56,$55,$56,$FA,$7F,$5A,$16,$5E,$59,$55,$96,$55,$F6,$D6,$DA
dc.b $56,$5A,$56,$AA,$5A,$56,$5A,$5A,$5A,$5A,$55,$56,$56,$58,$3D,$FE
dc.b $67,$AF,$5C,$C9,$12,$5E,$13,$27,$65,$A9,$69,$AE,$6F,$B3,$C0,$66
dc.b $6A,$6A,$6D,$A7,$6A,$55,$55,$2A,$59,$55,$5A,$D7,$75,$AA,$56,$05
dc.b $57,$A9,$55,$5A,$56,$6A,$56,$60,$D9,$D9,$7E,$6B,$6C,$68,$6B,$76
dc.b $C0,$60,$52,$CA,$56,$55,$FE,$55,$56,$56,$55,$A5,$6A,$56,$56,$6A
dc.b $55,$A5,$69,$A9,$69,$A9,$55,$A5,$55,$55,$55,$56,$55,$94,$7F,$5A
dc.b $55,$55,$55,$09,$52,$1A,$55,$55,$55,$55,$55,$55,$55,$55,$55,$55
dc.b $5B,$4E,$5B,$6E,$5A,$52,$50,$52,$76,$BB,$7D,$F2,$7D,$FF,$49,$49
dc.b $D7,$FE,$F2,$DA,$DB,$FB,$5A,$1D,$E3,$7B,$7B,$E7,$D7,$D4,$5F,$29
dc.b $D6,$DF,$FB,$7F,$6D,$7F,$55,$56,$55,$BF,$45,$C0,$15,$D5,$55,$AA
dc.b $00,$42,$57,$5B,$5A,$6B,$02,$62,$69,$A9,$FD,$FE,$D9,$E9,$60,$50
dc.b $57,$65,$D6,$56,$5A,$5F,$0A,$14,$1A,$56,$5F,$6F,$5A,$6A,$01,$06
dc.b $55,$56,$FA,$5A,$5A,$FF,$56,$55,$60,$20,$55,$AE,$66,$F7,$51,$6A
dc.b $16,$16,$FE,$F7,$D6,$18,$45,$A7,$36,$36,$7E,$FF,$FE,$10,$F9,$7A
dc.b $6A,$AA,$52,$00,$00,$00,$FD,$DA,$5A,$5A,$55,$1A,$59,$5A,$F5,$56
dc.b $55,$66,$55,$A9,$53,$A0,$5F,$A5,$75,$55,$00,$00,$05,$00,$D7,$FB
dc.b $59,$55,$62,$00,$1D,$00,$D7,$FE,$56,$55,$04,$0A,$C0,$00,$59,$FF
dc.b $7A,$5E,$0B,$43,$5E,$42,$6D,$6F,$50,$5A,$DA,$CE,$F5,$C6,$70,$B4
dc.b $03,$01,$55,$95,$55,$95,$40,$60,$69,$9A,$EA,$6A,$14,$E5,$6A,$6A
dc.b $6F,$5A,$18,$10,$40,$20,$FF,$7B,$FE,$7E,$1E,$04,$D6,$16,$6B,$59
dc.b $55,$A9,$56,$55,$5A,$5A,$56,$66,$7F,$95,$5A,$52,$7E,$43,$D6,$7D
dc.b $3A,$7A,$FA,$5A,$6B,$6B,$7E,$7E,$EE,$77,$59,$A1,$F5,$62,$55,$76
dc.b $55,$F6,$6F,$9F,$6A,$55,$56,$A7,$5B,$5B,$76,$F8,$62,$73,$5D,$59
dc.b $5A,$AA,$EF,$7F,$5A,$6E,$55,$69,$5B,$EA,$69,$7F,$69,$BD,$69,$69
dc.b $56,$5A,$FE,$5A,$5A,$6A,$54,$66,$01,$51,$56,$AA,$5A,$9A,$05,$15
dc.b $00,$50,$6A,$59,$55,$59,$00,$14,$10,$50,$55,$95,$55,$55,$00,$00
dc.b $00,$01,$55,$55,$55,$95,$00,$40,$00,$00,$55,$55,$55,$55,$00,$00
dc.b $1E,$1A,$70,$78,$4D,$89,$69,$6D,$7B,$76,$76,$D0,$FD,$02,$F5,$FE
dc.b $EE,$55,$04,$14,$FE,$15,$E9,$59,$6D,$A5,$55,$58,$5F,$BB,$5A,$D5
dc.b $FB,$7D,$69,$30,$6E,$F3,$5A,$A6,$EA,$55,$55,$00,$55,$00,$55,$AA
dc.b $65,$6A,$51,$56,$05,$19,$50,$18,$49,$89,$40,$60,$45,$59,$FF,$7F
dc.b $59,$69,$01,$06,$00,$00,$D6,$6A,$5A,$6A,$69,$F9,$16,$6A,$54,$56
dc.b $55,$5A,$DC,$E4,$56,$D6,$7E,$BE,$56,$55,$00,$01,$62,$81,$5B,$5B
dc.b $6A,$6A,$54,$5A,$40,$90,$EA,$65,$3E,$4A,$7A,$3A,$69,$6A,$7F,$6A
dc.b $56,$A6,$66,$69,$1F,$27,$40,$4A,$55,$55,$55,$5A,$FD,$6A,$16,$6A
dc.b $5A,$6A,$65,$AA,$55,$6A,$6A,$AA,$7D,$6A,$55,$A5,$55,$5A,$68,$60
dc.b $EA,$7C,$7D,$95,$5B,$5B,$16,$01,$F7,$FF,$D6,$DA,$5D,$BA,$5A,$62
dc.b $D8,$FD,$6A,$5A,$6A,$6B,$55,$6A,$4A,$79,$FC,$F6,$55,$AA,$56,$A4
dc.b $65,$6A,$10,$62,$58,$76,$6F,$A7,$5E,$52,$1A,$0A,$40,$81,$F6,$F6
dc.b $5E,$56,$5F,$6F,$17,$3B,$06,$04,$D2,$F5,$6F,$7F,$D7,$E7,$4A,$49
dc.b $1D,$2D,$6E,$6F,$56,$56,$4A,$5A,$CA,$6B,$7E,$BA,$49,$E9,$69,$25
dc.b $65,$27,$7F,$6E,$69,$69,$6A,$60,$5A,$8A,$7F,$AB,$56,$77,$55,$06
dc.b $56,$35,$FA,$DE,$5A,$56,$69,$19,$1B,$3B,$69,$FD,$5A,$9A,$65,$65
dc.b $16,$16,$55,$5A,$56,$56,$55,$59,$55,$29,$75,$79,$55,$65,$54,$6C
dc.b $55,$A6,$64,$55,$74,$6D,$7F,$95,$56,$9A,$00,$15,$10,$50,$F7,$79
dc.b $55,$A9,$00,$50,$11,$26,$7F,$9F,$55,$55,$00,$00,$00,$40,$FF,$FF
dc.b $55,$66,$00,$40,$01,$01,$7F,$BD,$55,$55,$00,$00,$00,$10,$FF,$FF
dc.b $5B,$5F,$2E,$56,$00,$00,$FE,$F6,$73,$63,$7E,$9D,$47,$97,$2A,$66
dc.b $54,$A4,$6A,$A9,$6A,$DA,$56,$56,$12,$02,$5A,$56,$59,$59,$65,$55
dc.b $16,$14,$59,$57,$55,$AA,$65,$69,$6A,$3F,$55,$55,$55,$E6,$55,$AA
dc.b $69,$6A,$5D,$5E,$79,$49,$6A,$56,$4F,$8F,$02,$06,$6A,$EA,$48,$4C
dc.b $F6,$D1,$6A,$55,$55,$B9,$5B,$5A,$65,$56,$59,$9A,$5D,$02,$6A,$56
dc.b $1E,$59,$61,$A1,$59,$A9,$0C,$18,$D9,$59,$40,$42,$56,$16,$6A,$69
dc.b $FF,$FF,$0D,$0E,$55,$A6,$4A,$4F,$FF,$1B,$4E,$CE,$0E,$12,$25,$4F
dc.b $55,$6A,$6A,$7D,$18,$6A,$7A,$EA,$56,$9A,$56,$AA,$26,$55,$55,$69
dc.b $55,$59,$55,$56,$50,$A9,$7E,$7E,$56,$55,$56,$5F,$53,$50,$7F,$EA
dc.b $55,$AA,$56,$FF,$03,$60,$5A,$F5,$40,$6A,$D7,$EA,$FB,$51,$40,$80
dc.b $6A,$69,$57,$6A,$EA,$7D,$48,$08,$6A,$55,$79,$55,$EE,$75,$10,$5A
dc.b $0A,$12,$D8,$D6,$E6,$71,$02,$12,$7F,$3B,$01,$03,$5A,$D5,$40,$38
dc.b $D5,$D9,$59,$D9,$7E,$FE,$36,$36,$62,$62,$6D,$79,$6F,$6F,$49,$5A
dc.b $1A,$1A,$FA,$59,$D9,$1B,$02,$40,$51,$19,$EB,$65,$76,$75,$60,$A0
dc.b $1A,$09,$7A,$5A,$7A,$FE,$5B,$0B,$55,$A5,$57,$FF,$60,$95,$7E,$FC
dc.b $55,$95,$75,$AA,$0F,$4A,$66,$50,$51,$02,$58,$5D,$EA,$66,$19,$18
dc.b $19,$1A,$15,$59,$16,$15,$6A,$62,$55,$A9,$54,$5A,$55,$56,$65,$A1
dc.b $D9,$5A,$69,$69,$64,$AB,$5C,$5E,$7F,$97,$0A,$59,$2F,$7C,$49,$59
dc.b $67,$57,$40,$40,$56,$6A,$6A,$5A,$FF,$FF,$00,$01,$55,$55,$55,$55
dc.b $F7,$F7,$00,$10,$55,$5A,$5A,$A2,$FF,$F7,$00,$00,$55,$95,$55,$95
dc.b $FF,$FF,$00,$00,$55,$55,$55,$55,$D5,$E5,$05,$09,$55,$55,$55,$55
dc.b $1A,$5A,$1A,$6A,$5A,$5B,$56,$56,$61,$04,$64,$90,$55,$5A,$55,$56
dc.b $28,$68,$1A,$56,$55,$5A,$5A,$AA,$15,$0A,$55,$AA,$6A,$AA,$55,$AA
dc.b $FE,$F7,$49,$29,$12,$02,$5F,$5A,$56,$56,$5A,$4A,$50,$5A,$EA,$6A
dc.b $1A,$6A,$56,$56,$66,$54,$5F,$DA,$55,$5A,$F7,$D9,$5B,$00,$FF,$56
dc.b $5A,$00,$7E,$FC,$02,$16,$FC,$58,$36,$06,$DA,$D9,$71,$21,$6F,$6A
dc.b $56,$AA,$55,$AB,$55,$96,$FC,$68,$22,$42,$06,$F6,$6B,$AA,$69,$55
dc.b $45,$5A,$6A,$6A,$E6,$55,$66,$56,$55,$9A,$56,$5A,$6B,$6A,$42,$55
dc.b $54,$56,$5A,$56,$DF,$5F,$06,$05,$46,$5A,$6A,$AA,$7E,$7F,$50,$40
dc.b $59,$A9,$5A,$5A,$7E,$FA,$14,$1A,$04,$66,$58,$5B,$FA,$7E,$06,$00
dc.b $FA,$5A,$55,$99,$68,$5A,$6B,$7A,$66,$52,$6F,$AF,$15,$19,$45,$6B
dc.b $74,$02,$FB,$79,$56,$56,$56,$58,$F0,$19,$6C,$6F,$69,$E7,$48,$2A
dc.b $69,$A1,$F9,$59,$74,$E5,$14,$3A,$5A,$50,$7D,$79,$F2,$7B,$18,$DF
dc.b $04,$59,$5B,$6B,$56,$7E,$5A,$FA,$6B,$02,$78,$DE,$66,$56,$6A,$5A
dc.b $6D,$66,$54,$78,$6A,$65,$59,$A9,$C0,$D6,$F9,$D9,$6B,$3F,$22,$72
dc.b $2F,$6B,$74,$7C,$C1,$D2,$6A,$5A,$7F,$67,$50,$32,$01,$56,$5A,$4A
dc.b $7B,$0B,$D6,$CE,$FF,$6A,$52,$5E,$3F,$7B,$60,$A2,$62,$54,$67,$CD
dc.b $D9,$F9,$28,$44,$0A,$51,$7B,$66,$0E,$12,$4A,$72,$79,$38,$5F,$4A
dc.b $59,$6A,$65,$6A,$55,$96,$FF,$55,$55,$96,$54,$96,$55,$55,$FF,$6A
dc.b $5B,$FA,$10,$38,$51,$59,$FF,$5A,$FA,$76,$2A,$6A,$55,$55,$FF,$55
dc.b $55,$55,$55,$55,$55,$55,$FF,$55,$55,$55,$55,$55,$55,$55,$FF,$55
dc.b $55,$55,$55,$55,$55,$55,$FF,$55,$55,$55,$55,$55,$55,$55,$FF,$55
dc.b $5F,$AF,$6A,$5A,$55,$55,$FF,$55,$7F,$FA,$40,$40,$55,$5A,$FF,$55
dc.b $50,$58,$45,$29,$6A,$59,$FD,$F6,$56,$19,$48,$4A,$65,$A5,$78,$64
dc.b $40,$90,$6A,$20,$5D,$22,$5B,$1A,$00,$00,$55,$95,$55,$9A,$E7,$42
dc.b $16,$06,$52,$57,$5A,$5A,$D5,$D9,$50,$95,$6A,$6A,$5A,$55,$7F,$97
dc.b $02,$04,$55,$65,$57,$54,$F0,$DA,$55,$D9,$6B,$6B,$40,$56,$56,$AA
dc.b $57,$97,$DF,$DF,$41,$6A,$55,$A5,$DF,$FB,$FE,$7E,$CB,$45,$55,$59
dc.b $6A,$6A,$56,$AA,$D7,$0A,$14,$00,$57,$BD,$55,$5D,$CC,$10,$01,$00
dc.b $5E,$D6,$57,$DE,$D0,$CA,$40,$80,$FB,$7F,$FF,$FD,$00,$10,$01,$15
dc.b $6A,$F9,$D9,$DF,$C3,$1B,$52,$54,$6B,$9E,$63,$62,$56,$54,$55,$95
dc.b $57,$9F,$6F,$6F,$72,$70,$48,$68,$59,$5A,$D9,$69,$50,$00,$44,$06
dc.b $7B,$BA,$DA,$DA,$C4,$D9,$64,$69,$69,$DA,$6A,$EA,$FA,$4F,$16,$12
dc.b $5A,$65,$6A,$65,$55,$56,$7F,$7F,$55,$9A,$55,$A9,$5A,$5A,$FF,$DF
dc.b $55,$95,$02,$14,$5C,$5B,$65,$65,$5A,$B6,$50,$EA,$67,$BA,$66,$55
dc.b $5A,$56,$50,$A6,$F2,$F6,$12,$12,$2E,$5A,$0A,$69,$50,$48,$12,$52
dc.b $5A,$AA,$50,$94,$6A,$DA,$69,$59,$DE,$D5,$7F,$6A,$55,$55,$55,$56
dc.b $14,$E5,$C2,$D1,$56,$FE,$5E,$6E,$60,$1C,$4D,$8E,$4A,$4A,$7F,$7E
dc.b $00,$40,$55,$56,$59,$59,$5E,$5E,$65,$69,$5A,$4A,$55,$83,$55,$6A
dc.b $50,$15,$55,$55,$5F,$CA,$55,$95,$00,$00,$55,$15,$6A,$1A,$7F,$2F
dc.b $00,$00,$55,$55,$55,$55,$FF,$FF,$00,$00,$55,$55,$55,$55,$FF,$FF
dc.b $00,$00,$55,$55,$55,$55,$FF,$FF,$00,$00,$55,$55,$55,$55,$FF,$FF
dc.b $00,$00,$55,$55,$55,$55,$FF,$FF,$00,$05,$55,$55,$55,$55,$FF,$FF
dc.b $55,$E5,$57,$9B,$09,$19,$65,$69,$5B,$56,$DC,$D8,$1D,$2F,$7F,$EA
dc.b $F6,$3F,$FE,$7E,$61,$61,$6B,$64,$70,$90,$42,$EA,$F6,$FA,$C9,$6C
dc.b $7A,$56,$5E,$0E,$68,$DE,$FC,$12,$69,$AA,$55,$95,$40,$85,$64,$64
dc.b $5E,$54,$70,$60,$6F,$6F,$5F,$AA,$55,$9A,$15,$55,$FE,$5A,$55,$59
dc.b $55,$55,$55,$55,$D5,$55,$55,$AA,$6A,$55,$42,$0A,$6A,$6A,$55,$AA
dc.b $48,$50,$16,$15,$5A,$56,$55,$AF,$FF,$13,$55,$95,$66,$55,$55,$AB
dc.b $DF,$FA,$6A,$55,$56,$59,$59,$FF,$78,$CE,$7A,$5A,$55,$6A,$00,$69
dc.b $00,$40,$6A,$56,$55,$A5,$45,$AA,$D6,$3F,$6A,$55,$55,$56,$44,$AA
dc.b $6F,$9B,$6F,$D7,$45,$95,$16,$F8,$C5,$53,$54,$F8,$7E,$FE,$5E,$57
dc.b $16,$16,$1A,$1A,$69,$69,$6A,$4A,$7F,$90,$6A,$6A,$6A,$6A,$6A,$7A
dc.b $5A,$D6,$5A,$5A,$40,$80,$55,$96,$55,$59,$55,$56,$07,$0B,$53,$60
dc.b $7E,$63,$5A,$0A,$D5,$E5,$DA,$1B,$65,$D7,$59,$6A,$56,$5F,$4E,$FB
dc.b $D8,$FA,$63,$07,$D5,$79,$2B,$68,$63,$DB,$DF,$E9,$5B,$5F,$4F,$60
dc.b $55,$95,$FA,$66,$6A,$6A,$4A,$5A,$5A,$D6,$D5,$D6,$40,$42,$5A,$5A
dc.b $55,$A9,$6A,$56,$01,$52,$56,$56,$7A,$9E,$7A,$7B,$47,$5E,$4A,$4A
dc.b $5A,$56,$F6,$0A,$DA,$EF,$5A,$5A,$7A,$5F,$7F,$7B,$F6,$F6,$70,$0B
dc.b $5A,$0A,$DA,$F5,$55,$65,$55,$5A,$7A,$4E,$F5,$F9,$40,$58,$6A,$59
dc.b $55,$55,$55,$55,$20,$54,$56,$56,$55,$55,$55,$55,$00,$04,$55,$55
dc.b $55,$55,$55,$55,$00,$00,$55,$55,$55,$55,$55,$55,$00,$00,$55,$55
dc.b $55,$55,$55,$55,$00,$00,$55,$55,$55,$55,$55,$55,$00,$00,$55,$55
dc.b $79,$63,$62,$A2,$42,$62,$40,$60,$62,$82,$56,$7E,$67,$27,$5E,$5E
dc.b $D8,$DA,$5A,$9A,$F8,$78,$18,$1B,$78,$F0,$4F,$BF,$22,$63,$55,$AA
dc.b $1A,$1A,$FD,$FE,$5B,$6A,$57,$AB,$D6,$FF,$62,$8C,$DE,$5E,$6A,$EA
dc.b $06,$1B,$D5,$DA,$DF,$DE,$4A,$4A,$FA,$58,$54,$A4,$16,$1A,$40,$50
dc.b $55,$98,$54,$13,$0B,$4B,$F5,$7F,$55,$01,$75,$55,$79,$D5,$67,$FF
dc.b $6A,$55,$55,$55,$57,$57,$FF,$FD,$56,$55,$55,$55,$FF,$FF,$DA,$6A
dc.b $69,$55,$5A,$56,$DA,$D6,$FF,$DA,$55,$69,$56,$5A,$55,$AA,$F5,$69
dc.b $55,$A9,$56,$66,$55,$6A,$F5,$5A,$55,$6A,$43,$FA,$5B,$6F,$DA,$56
dc.b $60,$80,$D6,$57,$6A,$6A,$56,$56,$16,$1A,$DA,$FA,$56,$6A,$7A,$5E
dc.b $41,$00,$75,$B7,$DA,$D6,$57,$B7,$1F,$1B,$DA,$D6,$5F,$9F,$66,$A6
dc.b $55,$D9,$55,$99,$65,$A5,$40,$95,$60,$C0,$7C,$8F,$02,$12,$E5,$5F
dc.b $5F,$5A,$5A,$1A,$69,$E9,$5D,$79,$7F,$7B,$55,$59,$5A,$5A,$4B,$CA
dc.b $68,$28,$18,$18,$63,$66,$55,$A5,$60,$E0,$4A,$4A,$5A,$5A,$1A,$1F
dc.b $6A,$6A,$15,$16,$69,$69,$58,$EA,$DA,$E6,$55,$56,$50,$58,$00,$05
dc.b $56,$AA,$5A,$9A,$00,$15,$04,$16,$D5,$D9,$68,$68,$12,$1A,$14,$26
dc.b $48,$C8,$4A,$4A,$5A,$59,$5A,$5A,$06,$06,$4A,$6A,$69,$55,$55,$56
dc.b $DA,$D0,$60,$A0,$6A,$69,$FA,$5E,$7B,$1E,$16,$15,$6E,$5A,$6A,$A9
dc.b $56,$55,$55,$56,$68,$5A,$04,$4A,$55,$96,$56,$9A,$58,$9A,$00,$00
dc.b $55,$95,$55,$95,$10,$10,$00,$00,$55,$9A,$55,$55,$00,$01,$00,$00
dc.b $55,$55,$55,$55,$00,$00,$00,$04,$55,$55,$55,$55,$00,$01,$00,$00
dc.b $E7,$67,$66,$61,$65,$65,$65,$A5,$C1,$C2,$5A,$5F,$5E,$5A,$50,$50
dc.b $D7,$E5,$5D,$2D,$6D,$CB,$18,$FB,$60,$28,$2A,$6A,$08,$55,$7D,$96
dc.b $00,$00,$55,$A6,$00,$56,$5C,$58,$60,$60,$DA,$5F,$C3,$63,$F0,$42
dc.b $7E,$AA,$DF,$0E,$DC,$5B,$2A,$4A,$FF,$FF,$45,$B1,$4E,$5E,$F2,$1A
dc.b $DA,$DA,$52,$5A,$50,$78,$6C,$21,$55,$AA,$5C,$5A,$3D,$3E,$55,$AA
dc.b $5A,$5A,$52,$50,$5F,$F2,$36,$3A,$DF,$DF,$55,$42,$C5,$6A,$5A,$5A
dc.b $F6,$FD,$55,$25,$4F,$94,$5F,$6A,$10,$12,$5A,$50,$55,$B5,$C2,$5F
dc.b $4A,$6A,$36,$F6,$C2,$F6,$5E,$1E,$4A,$4A,$5B,$6A,$40,$80,$D5,$56
dc.b $65,$18,$56,$5F,$00,$60,$FD,$69,$04,$54,$EA,$56,$59,$69,$55,$B7
dc.b $66,$16,$60,$54,$FE,$1E,$5A,$50,$6A,$69,$00,$10,$7D,$FE,$55,$08
dc.b $DF,$65,$15,$25,$55,$95,$55,$68,$67,$97,$10,$78,$C7,$D8,$14,$E4
dc.b $56,$56,$50,$14,$D7,$FB,$04,$06,$DD,$65,$44,$26,$7F,$FE,$20,$40
dc.b $55,$56,$01,$01,$F5,$F9,$0A,$4A,$FE,$DD,$55,$66,$56,$AB,$53,$1E
dc.b $5F,$AF,$55,$55,$55,$ED,$F2,$7C,$FF,$FF,$55,$65,$55,$65,$65,$67
dc.b $F5,$75,$55,$56,$55,$95,$14,$FE,$FD,$FD,$55,$55,$55,$55,$55,$95
dc.b $5A,$55,$55,$55,$55,$55,$55,$55,$7E,$FC,$54,$56,$57,$56,$54,$56
dc.b $54,$A4,$65,$69,$6A,$AA,$6A,$AA,$56,$AA,$6A,$6F,$66,$56,$56,$56
dc.b $7D,$65,$49,$55,$D7,$EB,$18,$DB,$6F,$1F,$54,$B8,$42,$50,$5A,$5A
dc.b $FF,$FD,$55,$69,$55,$59,$55,$56,$FF,$FF,$55,$65,$65,$69,$65,$69
dc.b $FF,$FF,$55,$55,$55,$55,$55,$55,$FF,$FF,$55,$5A,$55,$6A,$65,$A5
dc.b $00,$54,$04,$F0,$04,$0E,$04,$05,$02,$16,$54,$D6,$D0,$EC,$60,$F1
dc.b $70,$62,$6E,$C6,$55,$A9,$5E,$5A,$FF,$D5,$F6,$55,$78,$BD,$43,$5E
dc.b $FE,$5A,$2A,$7A,$F7,$69,$FD,$56,$25,$57,$FA,$55,$7F,$5A,$DA,$5A
dc.b $FC,$56,$40,$6C,$CA,$69,$55,$A5,$06,$0A,$10,$FF,$54,$95,$79,$FF
dc.b $40,$A0,$10,$CF,$00,$D6,$6B,$FA,$10,$50,$00,$00,$FF,$65,$FD,$56
dc.b $1B,$0A,$07,$30,$C0,$60,$F0,$5B,$57,$9F,$7F,$25,$FA,$DA,$3E,$36
dc.b $FA,$59,$FA,$55,$6F,$A5,$6A,$69,$59,$59,$7B,$A6,$65,$55,$7D,$A5
dc.b $D0,$E5,$55,$AA,$6A,$69,$55,$5A,$66,$67,$6A,$A6,$7C,$6A,$40,$50
dc.b $EF,$6A,$58,$55,$FC,$56,$06,$5A,$55,$56,$55,$5A,$D5,$5A,$5A,$9A
dc.b $50,$5A,$55,$5A,$5D,$79,$45,$55,$11,$65,$56,$5A,$FC,$7D,$01,$76
dc.b $29,$69,$6A,$76,$EA,$6A,$65,$A9,$D9,$EA,$70,$56,$6B,$6A,$68,$68
dc.b $60,$68,$34,$56,$D0,$EF,$60,$EA,$52,$56,$02,$4F,$D1,$FB,$04,$41
dc.b $00,$15,$00,$3F,$40,$BC,$60,$92,$01,$02,$5D,$C6,$55,$65,$65,$65
dc.b $6A,$7A,$40,$A7,$C8,$7C,$54,$A4,$00,$49,$5A,$E5,$F2,$6A,$26,$6A
dc.b $5A,$57,$54,$59,$7C,$9F,$6A,$6A,$70,$7A,$16,$0D,$39,$19,$15,$16
dc.b $00,$60,$00,$5B,$70,$60,$60,$68,$00,$00,$06,$00,$06,$05,$01,$03
dc.b $15,$35,$5A,$E5,$F6,$F6,$46,$CF,$55,$55,$68,$56,$6C,$6F,$68,$FA
dc.b $D0,$D8,$0A,$70,$06,$0E,$02,$07,$6A,$7B,$60,$97,$40,$B3,$52,$D7
dc.b $40,$80,$01,$0F,$40,$8C,$40,$00,$00,$45,$00,$30,$00,$30,$00,$50
dc.b $00,$00,$00,$C0,$00,$0C,$00,$00,$00,$11,$00,$C0,$00,$00,$00,$00
dc.b $01,$40,$55,$55,$FF,$FD,$FF,$75,$3C,$4B,$67,$AD,$59,$DA,$FE,$D8
dc.b $D8,$3C,$55,$42,$75,$A5,$4B,$2B,$DD,$39,$50,$A5,$FF,$FD,$F5,$D2
dc.b $55,$A5,$15,$55,$FF,$42,$05,$5A,$FF,$7E,$19,$69,$FF,$6E,$5D,$56
dc.b $55,$59,$6A,$AA,$7D,$9F,$3F,$6F,$55,$AA,$45,$96,$57,$55,$FF,$F6
dc.b $53,$A4,$55,$55,$7F,$DD,$FF,$75,$55,$E9,$50,$5B,$F5,$DD,$FF,$FF
dc.b $6A,$75,$40,$22,$FF,$7F,$FF,$FF,$C1,$6C,$00,$7B,$D2,$F5,$FF,$D6
dc.b $7D,$ED,$50,$28,$FF,$7F,$FF,$7F,$5A,$56,$15,$07,$FE,$DF,$FF,$FF
dc.b $55,$69,$06,$DB,$55,$A5,$FF,$FF,$C0,$7C,$C5,$08,$FF,$55,$D5,$66
dc.b $3F,$FF,$50,$AA,$55,$6A,$48,$AA,$53,$5B,$15,$FE,$10,$2A,$6A,$55
dc.b $D7,$FA,$41,$EE,$54,$6A,$56,$45,$FE,$6D,$FC,$5E,$48,$4A,$6E,$2E
dc.b $55,$95,$D8,$40,$6E,$2A,$6A,$6A,$70,$AC,$68,$90,$5B,$AA,$7F,$7B
dc.b $31,$79,$50,$62,$FB,$7A,$F7,$55,$E0,$58,$56,$5A,$FF,$DD,$DF,$67
dc.b $04,$00,$55,$A9,$FF,$55,$FF,$7F,$0A,$D6,$55,$56,$F6,$FE,$F6,$DA
dc.b $EB,$76,$32,$F7,$24,$65,$55,$56,$0D,$6A,$DA,$55,$57,$59,$67,$56
dc.b $65,$5A,$13,$3A,$5A,$56,$52,$5A,$0E,$C6,$48,$CF,$2A,$54,$52,$50
dc.b $60,$66,$7B,$7D,$04,$48,$5A,$98,$00,$01,$D5,$5A,$79,$02,$64,$00
dc.b $10,$05,$6A,$99,$FF,$56,$FF,$D6,$51,$15,$55,$55,$FF,$DF,$FF,$F5
dc.b $00,$40,$55,$55,$FF,$FF,$FF,$7E,$61,$5A,$52,$4A,$FF,$FF,$FF,$5F
dc.b $40,$90,$6A,$AA,$FF,$FD,$FF,$FF,$10,$04,$55,$65,$DF,$F9,$F5,$F9
dc.b $00,$00,$55,$55,$FF,$FF,$F3,$DB,$00,$00,$55,$55,$FF,$FD,$FF,$D7
|
programs/oeis/158/A158676.asm | neoneye/loda | 22 | 96817 | ; A158676: a(n) = 62*n^2 + 1.
; 1,63,249,559,993,1551,2233,3039,3969,5023,6201,7503,8929,10479,12153,13951,15873,17919,20089,22383,24801,27343,30009,32799,35713,38751,41913,45199,48609,52143,55801,59583,63489,67519,71673,75951,80353,84879,89529,94303,99201,104223,109369,114639,120033,125551,131193,136959,142849,148863,155001,161263,167649,174159,180793,187551,194433,201439,208569,215823,223201,230703,238329,246079,253953,261951,270073,278319,286689,295183,303801,312543,321409,330399,339513,348751,358113,367599,377209,386943,396801,406783,416889,427119,437473,447951,458553,469279,480129,491103,502201,513423,524769,536239,547833,559551,571393,583359,595449,607663
pow $0,2
mul $0,62
add $0,1
|
src/geste-grid.ads | Fabien-Chouteau/GESTE | 13 | 13242 | ------------------------------------------------------------------------------
-- --
-- GESTE --
-- --
-- Copyright (C) 2018 <NAME> --
-- --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with GESTE.Tile_Bank;
package GESTE.Grid is
type Grid_Data is array (Natural range <>, Natural range <>) of Tile_Index;
type Grid_Data_Ref is access constant Grid_Data;
subtype Parent is Layer.Instance;
type Instance (Data : not null Grid_Data_Ref;
Bank : not null Tile_Bank.Const_Ref)
is new Parent with private;
subtype Class is Instance'Class;
type Ref is access all Class;
type Const_Ref is access constant Class;
private
type Grid_Map is array (Natural range <>, Natural range <>) of Tile_Index;
type Grid_Orientation is array (Natural range <>, Natural range <>) of Integer;
type Instance (Data : not null Grid_Data_Ref;
Bank : not null Tile_Bank.Const_Ref)
is new Parent with null record;
overriding
procedure Update_Size (This : in out Instance);
overriding
function Pix (This : Instance; X, Y : Integer) return Output_Color
with Pre => X in 0 .. This.Width - 1 and then Y in 0 .. This.Height - 1;
overriding
function Collides (This : Instance; X, Y : Integer) return Boolean;
end GESTE.Grid;
|
grammar/ValidationExpr.g4 | poncos/gothings | 1 | 1159 | /*
* Grammar defining a validation language.
*
* Pre:
* - Regex: "amiga.common.grpc.client.myclient.deadline:\s+(\w+)"
* - Regex Match Result: [amiga.common.grpc.client.myclient.deadline: 38] [38]
* Input:
* 1. Given the Regex Match Result
* 2. Given a Context with optional extra values: [40]
* 3. Given a validation expression: $1 <= 40, $1 <= @1
* Output:
* - True | False with the validation result
* Samples:
* - Conditionals: if : $3 < 10 else $4 range 100,500
* - Braces: $1 == 1 and ( $2 == 1 or $3 == 1)
* - Version number: $1 >= 3.14.1
* - Arrays: contains(localhost, [remote.host.com,remote2.host.com,localhost,remote3.localhost.com])
* - Strings:localhost in $1
*/
grammar ValidationExpr;
selectionExpr
: 'if' validationExpr ':' validationExpr 'else' validationExpr EOF
| validationExpr EOF
;
validationExpr :
(validationOrExpr | validationAndExpr )
;
validationOrExpr:
validationAndExpr ( 'or' validationAndExpr )*
;
validationAndExpr:
valueLogical ( 'and' valueLogical )*
;
valueLogical:
relationalExpression
;
relationalExpression
: numericExpression ( '=' numericExpression | '!=' numericExpression | '<' numericExpression | '>' numericExpression | '<=' numericExpression | '>=' numericExpression )*
;
numericExpression
: additiveExpression
;
additiveExpression
: multiplicativeExpression ( '+' multiplicativeExpression | '-' multiplicativeExpression )*
;
multiplicativeExpression
: unaryExpression ( '*' unaryExpression | '/' unaryExpression )*
;
unaryExpression
:
brackettedExpression
| functionCall
| variable
| literal
| unaryOperator unaryExpression
;
unaryOperator
: 'not'
;
brackettedExpression
: '(' validationExpr ')'
;
functionCall
: STR functionArgumentList
;
functionArgumentList
: NIL
| '(' functionAttribute (',' functionAttribute)* ')'
;
functionAttribute
: variable
| literal
;
literal:
| boolenLiteral
| numericLiteral
| stringLiteral
| arrayLiteral
| rangeLiteral
;
boolenLiteral
: 'true'
| 'false'
;
numericLiteral
: INTEGER
| timeDurationLiteral;
timeDurationLiteral:
INTEGER + ('ms'|'s')
;
versionNumberLiteral
: INTEGER + '.' INTEGER + ('.' INTEGER)+
;
arrayLiteral
: NONE
| '[' STR + (',' + STR)+ ']'
;
rangeLiteral
: (numericLiteral + (','+ numericLiteral))+
;
stringLiteral
: STR
;
variable
: LOCAL_VARIABLE
| CONTEXT_VARIABLE
;
LOCAL_VARIABLE
: '$' + STR | ('${' + STR + '}')
;
CONTEXT_VARIABLE
: '@' + STR | '@{' + STR + '}'
;
INTEGER : [0-9]+
;
STR
: ('"'|'\'')? [a-zA-Z0-9_.]+ ('"'|'\'')?
| ('"'|'\'') ('"'|'\'')
;
NONE
: '[' WS* ']'
;
NIL
: '(' WS* ')'
;
WS
: (' '| '\t'| '\n'| '\r')+ ->skip
;
// ==========================================
// LEXER
// ==========================================
|
tests/natools-s_expressions-lockable-tests.adb | faelys/natools | 0 | 19811 | ------------------------------------------------------------------------------
-- Copyright (c) 2014, <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.S_Expressions.Test_Tools;
with Natools.S_Expressions.Parsers;
package body Natools.S_Expressions.Lockable.Tests is
-------------------------------
-- Lockable.Descriptor Tests --
-------------------------------
function Test_Expression return Atom is
begin
return To_Atom ("(begin(command1 arg1.1 arg1.2)"
& "(command2 (subcmd2.1 arg2.1.1) (subcmd2.3) arg2.4)"
& "(command3 (subcmd3.1 ((subcmd3.1.1 arg3.1.1.1)) arg3.1.2))"
& "end)5:extra");
end Test_Expression;
procedure Test_Interface
(Test : in out NT.Test;
Object : in out Lockable.Descriptor'Class)
is
Level_1, Level_2 : Lock_State;
Base : Natural;
begin
Base := Object.Current_Level;
Test_Tools.Next_And_Check (Test, Object, To_Atom ("begin"), Base);
Test_Tools.Next_And_Check (Test, Object, Events.Open_List, Base + 1);
Test_Tools.Next_And_Check (Test, Object, To_Atom ("command1"), Base + 1,
"Before first lock:");
Object.Lock (Level_1);
Test_Tools.Test_Atom_Accessors (Test, Object, To_Atom ("command1"), 0,
"After first lock:");
Test_Tools.Next_And_Check (Test, Object, To_Atom ("arg1.1"), 0);
Test_Tools.Next_And_Check (Test, Object, To_Atom ("arg1.2"), 0);
Test_Tools.Next_And_Check (Test, Object, Events.End_Of_Input, 0,
"Before first unlock:");
Test_Tools.Test_Atom_Accessor_Exceptions (Test, Object);
Object.Unlock (Level_1);
declare
Event : constant Events.Event := Object.Current_Event;
Level : constant Natural := Object.Current_Level;
begin
if Event /= Events.Close_List then
Test.Fail ("Current event is " & Events.Event'Image (Event)
& ", expected Close_List");
end if;
if Level /= Base then
Test.Fail ("Current level is" & Natural'Image (Level)
& ", expected" & Natural'Image (Base));
end if;
end;
Test_Tools.Next_And_Check (Test, Object, Events.Open_List, Base + 1);
Test_Tools.Next_And_Check (Test, Object, To_Atom ("command2"), Base + 1,
"Before second lock:");
Object.Lock (Level_1);
Test_Tools.Test_Atom_Accessors (Test, Object, To_Atom ("command2"), 0,
"After second lock:");
Test_Tools.Next_And_Check (Test, Object, Events.Open_List, 1);
Test_Tools.Next_And_Check (Test, Object, To_Atom ("subcmd2.1"), 1,
"Before inner lock:");
Object.Lock (Level_2);
Test_Tools.Test_Atom_Accessors (Test, Object, To_Atom ("subcmd2.1"), 0,
"After inner lock:");
Test_Tools.Next_And_Check (Test, Object, To_Atom ("arg2.1.1"), 0,
"Before inner unlock:");
Object.Unlock (Level_2, False);
Test_Tools.Test_Atom_Accessors (Test, Object, To_Atom ("arg2.1.1"), 1,
"After inner unlock:");
Test_Tools.Next_And_Check (Test, Object, Events.Close_List, 0);
Test_Tools.Next_And_Check (Test, Object, Events.Open_List, 1);
Test_Tools.Next_And_Check (Test, Object, To_Atom ("subcmd2.3"), 1,
"Before inner lock:");
Object.Lock (Level_2);
Test_Tools.Test_Atom_Accessors (Test, Object, To_Atom ("subcmd2.3"), 0,
"After inner lock:");
Test_Tools.Next_And_Check (Test, Object, Events.End_Of_Input, 0,
"Before inner unlock:");
Object.Unlock (Level_2, False);
declare
Event : constant Events.Event := Object.Current_Event;
Level : constant Natural := Object.Current_Level;
begin
if Event /= Events.Close_List then
Test.Fail ("Current event is " & Events.Event'Image (Event)
& ", expected Close_List");
end if;
if Level /= 0 then
Test.Fail ("Current level is" & Natural'Image (Level)
& ", expected 0");
end if;
end;
Object.Unlock (Level_1);
Test_Tools.Next_And_Check (Test, Object, Events.Open_List, Base + 1);
Test_Tools.Next_And_Check (Test, Object, To_Atom ("command3"), Base + 1,
"Before third lock:");
Object.Lock (Level_1);
Test_Tools.Test_Atom_Accessors (Test, Object, To_Atom ("command3"), 0,
"After third lock:");
Test_Tools.Next_And_Check (Test, Object, Events.Open_List, 1);
Test_Tools.Next_And_Check (Test, Object, To_Atom ("subcmd3.1"), 1);
Test_Tools.Next_And_Check (Test, Object, Events.Open_List, 2);
Test_Tools.Next_And_Check (Test, Object, Events.Open_List, 3);
Object.Unlock (Level_1);
Test_Tools.Next_And_Check (Test, Object, To_Atom ("end"), Base);
Test_Tools.Next_And_Check (Test, Object, Events.Close_List, Base - 1);
Test_Tools.Next_And_Check (Test, Object, To_Atom ("extra"), Base - 1);
Object.Lock (Level_1);
Test_Tools.Test_Atom_Accessors (Test, Object, To_Atom ("extra"), 0);
Object.Unlock (Level_1);
declare
Event : constant Events.Event := Object.Current_Event;
begin
if Event /= Events.End_Of_Input then
Test.Fail ("Last current event is "
& Events.Event'Image (Event)
& ", expected End_Of_Input");
end if;
end;
end Test_Interface;
-------------------------
-- Complete Test Suite --
-------------------------
procedure All_Tests (Report : in out NT.Reporter'Class) is
begin
Test_Stack (Report);
Test_Wrapper_Interface (Report);
Test_Wrapper_Extra (Report);
end All_Tests;
---------------------------
-- Individual Test Cases --
---------------------------
procedure Test_Stack (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Level stack");
begin
declare
Stack : Lock_Stack;
State : array (1 .. 4) of Lock_State;
procedure Check_Level
(Stack : in Lock_Stack;
Expected : in Natural;
Context : in String);
procedure Dump_Data;
procedure Check_Level
(Stack : in Lock_Stack;
Expected : in Natural;
Context : in String)
is
Level : constant Natural := Current_Level (Stack);
begin
if Level /= Expected then
Test.Fail (Context & ": level is"
& Natural'Image (Level) & ", expected"
& Natural'Image (Expected));
Dump_Data;
end if;
end Check_Level;
procedure Dump_Data is
begin
Test.Info (" Stack: (Depth =>"
& Natural'Image (Stack.Depth)
& ", Level =>"
& Natural'Image (Stack.Level) & ')');
for I in State'Range loop
Test.Info (" State"
& Natural'Image (I)
& ": (Depth =>"
& Natural'Image (Stack.Depth)
& ", Level =>"
& Natural'Image (Stack.Level) & ')');
end loop;
end Dump_Data;
begin
Check_Level (Stack, 0, "1");
Push_Level (Stack, 14, State (1));
Check_Level (Stack, 14, "2");
begin
Pop_Level (Stack, State (2));
Test.Fail ("No exception raised after popping blank state");
exception
when Constraint_Error =>
null;
when Error : others =>
Test.Fail
("Unexpected exception raised after popping blank state");
Test.Report_Exception (Error, NT.Fail);
end;
Pop_Level (Stack, State (1));
Check_Level (Stack, 0, "3");
Push_Level (Stack, 15, State (1));
Check_Level (Stack, 15, "4");
Push_Level (Stack, 92, State (2));
Check_Level (Stack, 92, "5");
Push_Level (Stack, 65, State (3));
Check_Level (Stack, 65, "6");
Pop_Level (Stack, State (3));
Check_Level (Stack, 92, "7");
Push_Level (Stack, 35, State (3));
Check_Level (Stack, 35, "8");
Push_Level (Stack, 89, State (4));
Check_Level (Stack, 89, "9");
begin
Pop_Level (Stack, State (3));
Test.Fail ("No exception raised after popping a forbidden gap");
exception
when Constraint_Error =>
null;
when Error : others =>
Test.Fail
("Unexpected exception raised after popping a forbidden gap");
Test.Report_Exception (Error, NT.Fail);
end;
Check_Level (Stack, 89, "10");
Pop_Level (Stack, State (3), True);
Check_Level (Stack, 92, "11");
begin
Pop_Level (Stack, State (4));
Test.Fail ("No exception raised after popping stale state");
exception
when Constraint_Error =>
null;
when Error : others =>
Test.Fail
("Unexpected exception raised after popping stale state");
Test.Report_Exception (Error, NT.Fail);
end;
Check_Level (Stack, 92, "12");
Pop_Level (Stack, State (2));
Check_Level (Stack, 15, "13");
Pop_Level (Stack, State (1));
Check_Level (Stack, 0, "14");
end;
exception
when Error : others => Test.Report_Exception (Error);
end Test_Stack;
procedure Test_Wrapper_Extra (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Extra tests of wrapper");
begin
declare
Input : aliased Test_Tools.Memory_Stream;
Parser : aliased Parsers.Stream_Parser (Input'Access);
Tested : Wrapper (Parser'Access);
State : Lock_State;
begin
Input.Set_Data (To_Atom ("(cmd1 arg1)(cmd2 4:arg2"));
-- Check Events.Error is returned by Next when finished
Test_Tools.Next_And_Check (Test, Tested, Events.Open_List, 1);
Test_Tools.Next_And_Check (Test, Tested, To_Atom ("cmd1"), 1);
Tested.Lock (State);
Test_Tools.Next_And_Check (Test, Tested, To_Atom ("arg1"), 0);
Test_Tools.Next_And_Check (Test, Tested, Events.End_Of_Input, 0);
Test_Tools.Next_And_Check (Test, Tested, Events.Error, 0);
Tested.Unlock (State);
-- Run Unlock with End_Of_Input in backend
Test_Tools.Next_And_Check (Test, Tested, Events.Open_List, 1);
Test_Tools.Next_And_Check (Test, Tested, To_Atom ("cmd2"), 1);
Tested.Lock (State);
Test_Tools.Next_And_Check (Test, Tested, To_Atom ("arg2"), 0);
Tested.Unlock (State);
end;
exception
when Error : others => Test.Report_Exception (Error);
end Test_Wrapper_Extra;
procedure Test_Wrapper_Interface (Report : in out NT.Reporter'Class) is
Test : NT.Test
:= Report.Item ("Lockable.Descriptor interface of wrapper");
begin
declare
Input : aliased Test_Tools.Memory_Stream;
Parser : aliased Parsers.Stream_Parser (Input'Access);
Tested : Wrapper (Parser'Access);
begin
Input.Set_Data (Test_Expression);
Test_Tools.Next_And_Check (Test, Parser, Events.Open_List, 1);
Test_Interface (Test, Tested);
end;
exception
when Error : others => Test.Report_Exception (Error);
end Test_Wrapper_Interface;
end Natools.S_Expressions.Lockable.Tests;
|
oeis/174/A174863.asm | neoneye/loda-programs | 11 | 162029 | <reponame>neoneye/loda-programs
; A174863: Little omega analog to Liouville's function L(n).
; Submitted by <NAME>(s2)
; 1,0,-1,-2,-3,-2,-3,-4,-5,-4,-5,-4,-5,-4,-3,-4,-5,-4,-5,-4,-3,-2,-3,-2,-3,-2,-3,-2,-3,-4,-5,-6,-5,-4,-3,-2,-3,-2,-1,0,-1,-2,-3,-2,-1,0,-1,0,-1,0,1,2,1,2,3,4,5,6,5,4,3,4,5,4,5,4,3,4,5,4,3,4,3,4,5,6,7,6,5,6,5,6,5,4,5,6,7,8,7,6,7,8,9,10,11,12,11,12,13,14
lpb $0
mov $2,$0
sub $0,1
seq $2,76479 ; a(n) = mu(rad(n)), where mu is the Moebius-function (A008683) and rad is the radical or squarefree kernel (A007947).
add $1,$2
lpe
add $1,1
mov $0,$1
|
test/Succeed/Issue5734.agda | KDr2/agda | 0 | 4389 | <reponame>KDr2/agda<filename>test/Succeed/Issue5734.agda
-- Liang-Ting, 2022-01-14, issue #5734
{-# OPTIONS --cubical-compatible #-}
open import Agda.Builtin.Unit
open import Agda.Builtin.List
open import Agda.Builtin.Sigma
open import Agda.Builtin.Reflection
renaming (returnTC to return; bindTC to _>>=_)
open import Agda.Primitive
private variable
A B : Set _
reverseApp : List A → List A → List A
reverseApp [] ys = ys
reverseApp (x ∷ xs) ys = reverseApp xs (x ∷ ys)
reverse : List A → List A
reverse xs = reverseApp xs []
extend*Context : Telescope → TC A → TC A
extend*Context [] m = m
extend*Context ((s , a) ∷ tel) m = extendContext s a (extend*Context tel m)
pattern vArg x = arg (arg-info visible (modality relevant quantity-ω)) x
pattern visible-relevant-erased = arg-info visible (modality relevant quantity-0)
pattern var₀ x = var x []
Γ : Telescope
Γ = ("ℓ" , arg visible-relevant-erased (quoteTerm Level))
∷ ("A" , vArg (agda-sort (set (var₀ 0))))
∷ []
macro
m : Term → TC ⊤
m hole = do
_ ← extend*Context Γ do
_ ← checkType (var₀ 0) (agda-sort (set (var₀ 1)))
return tt
inContext (reverse Γ) do
return tt
_ : ⊤
_ = m
|
programs/oeis/269/A269906.asm | jmorken/loda | 1 | 88501 | ; A269906: Number of active (ON,black) cells in n-th stage of growth of two-dimensional cellular automaton defined by "Rule 1", based on the 5-celled von Neumann neighborhood.
; 1,4,1,44,1,116,1,220,1,356,1,524,1,724,1,956,1,1220,1,1516,1,1844,1,2204,1,2596,1,3020,1,3476,1,3964,1,4484,1,5036,1,5620,1,6236,1,6884,1,7564,1,8276,1,9020,1,9796,1,10604,1,11444,1,12316,1,13220,1
mov $1,2
mov $6,$0
gcd $0,2
mov $4,$6
mul $4,2
add $4,1
mov $2,$4
mul $2,$4
lpb $0
mov $1,$3
mov $2,8
add $5,1
mov $0,$5
lpe
add $1,$2
sub $1,7
|
src/osascripts/system-preferences.applescript | jokajak/ki | 83 | 1262 | <gh_stars>10-100
-- AppleScript template for various system preferences options
-- `option` - the name of the option
-- `targetPane` - the target pane to reveal
set option to "{{option}}"
set targetPane to "{{targetPane}}"
tell application "System Preferences"
if option is "fetch-panes" then
set paneIdsByName to {}
repeat with prefPane in panes
set paneId to id of prefPane
set paneName to name of prefPane as string
set AppleScript's text item delimiters to {return & linefeed, return, linefeed, character id 8233, character id 8232}
set paneName to text items of paneName
set AppleScript's text item delimiters to {" "}
set paneName to paneName as text
set paneRecord to run script "{|" & paneId & "|:\"" & (paneName as string) & "\"}"
set paneIdsByName to paneIdsByName & paneRecord
end repeat
return paneIdsByName
else if option is "reveal-pane" then
reveal pane targetPane
else if option is "Accessibility" then
reveal pane "com.apple.preference.universalaccess"
else if option is "Bluetooth" then
reveal pane "com.apple.preferences.bluetooth"
else if option is "Date & Time" then
reveal pane "com.apple.preference.datetime"
else if option is "Desktop & Screen Saver" then
reveal pane "com.apple.preference.desktopscreeneffect"
else if option is "Displays" then
reveal pane "com.apple.preference.displays"
else if option is "Dock" then
reveal pane "com.apple.preference.dock"
else if option is "Energy Saver" then
reveal pane "com.apple.preference.energysaver"
else if option is "Extensions" then
reveal pane "com.apple.preferences.extensions"
else if option is "General" then
reveal pane "com.apple.preference.general"
else if option is "iCloud" then
reveal pane "com.apple.preferences.icloud"
else if option is "Internet Accounts" then
reveal pane "com.apple.preferences.internetaccounts"
else if option is "Keyboard" then
reveal pane "com.apple.preference.keyboard"
else if option is "Language & Region" then
reveal pane "com.apple.localization"
else if option is "Mission Control" then
reveal pane "com.apple.preference.expose"
else if option is "Mouse" then
reveal pane "com.apple.preference.mouse"
else if option is "Network" then
reveal pane "com.apple.preference.network"
else if option is "Notifications" then
reveal pane "com.apple.preference.notifications"
else if option is "Parental Controls" then
reveal pane "com.apple.preferences.parentalcontrols"
else if option is "Printers & Scanners" then
reveal pane "com.apple.preference.printfax"
else if option is "Security & Privacy" then
reveal pane "com.apple.preference.security"
else if option is "Sharing" then
reveal pane "com.apple.preferences.sharing"
else if option is "Siri" then
reveal pane "com.apple.preference.speech"
else if option is "Software Update" then
reveal pane "com.apple.preferences.softwareupdate"
else if option is "Sound" then
reveal pane "com.apple.preference.sound"
else if option is "Spotlight" then
reveal pane "com.apple.preference.spotlight"
else if option is "Startup Disk" then
reveal pane "com.apple.preference.startupdisk"
else if option is "Time Machine" then
reveal pane "com.apple.prefs.backup"
else if option is "Touch ID" then
reveal pane "com.apple.preferences.password"
else if option is "Trackpad" then
reveal pane "com.apple.preference.trackpad"
else if option is "Users & Groups" then
reveal pane "com.apple.preferences.users"
else if option is "Wallet & Apple Pay" then
reveal pane "com.apple.preferences.wallet"
end if
end tell
|
formalization/agda/Spire/Examples/ComputationalDesc.agda | spire/spire | 43 | 8462 | <filename>formalization/agda/Spire/Examples/ComputationalDesc.agda
open import Data.Unit
open import Data.Product
open import Relation.Binary.PropositionalEquality
module Spire.Examples.ComputationalDesc where
----------------------------------------------------------------------
data Desc (I : Set) : Set₁ where
`⊤ : Desc I
`X : (i : I) → Desc I
`Σ `Π : (A : Set) (B : A → Desc I) → Desc I
El : (I : Set) (D : Desc I) (X : I → Set) → Set
El I `⊤ X = ⊤
El I (`X i) X = X i
El I (`Σ A B) X = Σ A (λ a → El I (B a) X)
El I (`Π A B) X = (a : A) → El I (B a) X
data μ (I : Set) (R : I → Desc I) (i : I) : Set where
con : El I (R i) (μ I R) → μ I R i
All : (I : Set) (X : I → Set) (D : Desc I) (xs : El I D X) (P : (i : I) → X i → Set) → Set
All I X `⊤ tt P = ⊤
All I X (`X i) x P = P i x
All I X (`Σ A B) (a , b) P = All I X (B a) b P
All I X (`Π A B) f P = (a : A) → All I X (B a) (f a) P
----------------------------------------------------------------------
ind :
(I : Set)
(R : I → Desc I)
(P : (i : I) → μ I R i → Set)
(pcon : (i : I) (xs : El I (R i) (μ I R)) → All I (μ I R) (R i) xs P → P i (con xs))
(i : I)
(x : μ I R i)
→ P i x
hyps :
(I : Set)
(R : I → Desc I)
(P : (i : I) → μ I R i → Set)
(pcon : (i : I) (xs : El I (R i) (μ I R)) → All I (μ I R) (R i) xs P → P i (con xs))
(D : Desc I)
(xs : El I D (μ I R))
→ All I (μ I R) D xs P
ind I R P pcon i (con xs) = pcon i xs (hyps I R P pcon (R i) xs)
hyps I R P pcon `⊤ tt = tt
hyps I R P pcon (`X i) xs = ind I R P pcon i xs
hyps I R P pcon (`Σ A B) (a , b) = hyps I R P pcon (B a) b
hyps I R P pcon (`Π A B) f = λ a → hyps I R P pcon (B a) (f a)
----------------------------------------------------------------------
data ℕT : Set where `zero `suc : ℕT
data VecT : Set where `nil `cons : VecT
ℕD : ⊤ → Desc ⊤
ℕD tt = `Σ ℕT λ
{ `zero → `⊤
; `suc → `X tt
}
ℕ : ⊤ → Set
ℕ = μ ⊤ ℕD
-- zero : ℕ tt
pattern zero = con (`zero , tt)
-- suc : ℕ tt → ℕ tt
pattern suc n = con (`suc , n)
----------------------------------------------------------------------
VecD : (A : Set) (n : ℕ tt) → Desc (ℕ tt)
VecD A zero = `⊤
VecD A (suc n) = `Σ A λ _ → `X n
Vec : (A : Set) (n : ℕ tt) → Set
Vec A n = μ (ℕ tt) (VecD A) n
nil : (A : Set) → Vec A zero
nil A = con tt
cons : (A : Set) (n : ℕ tt) (x : A) (xs : Vec A n) → Vec A (suc n)
cons A n x xs = con (x , xs)
----------------------------------------------------------------------
add : ℕ tt → ℕ tt → ℕ tt
add = ind ⊤ ℕD (λ _ _ → ℕ tt → ℕ tt)
(λ
{ tt (`zero , tt) tt n → n
; tt (`suc , m) ih n → suc (ih n)
}
)
tt
mult : ℕ tt → ℕ tt → ℕ tt
mult = ind ⊤ ℕD (λ _ _ → ℕ tt → ℕ tt)
(λ
{ tt (`zero , tt) tt n → zero
; tt (`suc , m) ih n → add n (ih n)
}
)
tt
append : (A : Set) (m : ℕ tt) (xs : Vec A m) (n : ℕ tt) (ys : Vec A n) → Vec A (add m n)
append A = ind (ℕ tt) (VecD A) (λ m xs → (n : ℕ tt) (ys : Vec A n) → Vec A (add m n))
(λ
{ zero tt tt n ys → ys
; (suc m) (x , xs) ih n ys → cons A (add m n) x (ih n ys)
}
)
concat : (A : Set) (m n : ℕ tt) (xss : Vec (Vec A m) n) → Vec A (mult n m)
concat A m = ind (ℕ tt) (VecD (Vec A m)) (λ n xss → Vec A (mult n m))
(λ
{ zero tt tt → nil A
; (suc n) (xs , xss) ih → append A m xs (mult n m) ih
}
)
----------------------------------------------------------------------
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.