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 |
|---|---|---|---|---|
libsrc/_DEVELOPMENT/adt/p_stack/c/sdcc_iy/p_stack_top.asm | meesokim/z88dk | 0 | 168668 | <reponame>meesokim/z88dk
; void *p_stack_top(p_stack_t *s)
SECTION code_adt_p_stack
PUBLIC _p_stack_top
EXTERN _p_forward_list_front
defc _p_stack_top = _p_forward_list_front
|
oeis/008/A008752.asm | neoneye/loda-programs | 11 | 177658 | <reponame>neoneye/loda-programs
; A008752: Expansion of (1+x^9)/((1-x)*(1-x^2)*(1-x^3)).
; Submitted by <NAME>(s4)
; 1,1,2,3,4,5,7,8,10,13,15,18,22,25,29,34,38,43,49,54,60,67,73,80,88,95,103,112,120,129,139,148,158,169,179,190,202,213,225,238,250,263,277,290,304,319,333,348,364,379,395,412,428,445,463,480,498,517,535,554,574,593,613,634,654,675,697,718,740,763,785,808,832,855,879,904,928,953,979,1004,1030,1057,1083,1110,1138,1165,1193,1222,1250,1279,1309,1338,1368,1399,1429,1460,1492,1523,1555,1588
trn $0,1
mov $2,$0
sub $0,1
lpb $2
mul $0,$2
sub $0,1
div $0,6
add $0,2
mov $2,3
lpe
add $0,2
|
programs/oeis/214/A214877.asm | neoneye/loda | 22 | 17125 | ; A214877: n ^ (last digit of n).
; 1,1,4,27,256,3125,46656,823543,16777216,387420489,1,11,144,2197,38416,759375,16777216,410338673,11019960576,322687697779,1,21,484,12167,331776,9765625,308915776,10460353203,377801998336,14507145975869,1,31,1024,35937,1336336,52521875,2176782336,94931877133,4347792138496,208728361158759,1,41,1764,79507,3748096,184528125,9474296896,506623120463,28179280429056,1628413597910449,1,51,2704,148877,8503056,503284375,30840979456,1954897493193,128063081718016,8662995818654939,1,61,3844,250047,16777216,1160290625,82653950016,6060711605323,457163239653376,35452087835576229,1,71,5184,389017,29986576,2373046875,192699928576,16048523266853,1370114370683136,119851595982618319,1,81,6724,571787,49787136,4437053125,404567235136,37725479487783,3596345248055296,350356403707485209,1,91,8464,804357,78074896,7737809375,782757789696,80798284478113,8507630225817856,913517247483640899
mov $1,$0
mod $1,10
pow $0,$1
|
Psychtoolbox/PsychContributed/MacDisplaySettings/MacDisplaySettings.applescript | dcnieho/Psychtoolbox-3 | 0 | 1186 | (*
MacDisplaySettings.applescript
<NAME>, <EMAIL>
June 11, 2020.
INTRODUCTION
This applescript run handler allows you read and set seven parameters of
the macOS System Preferences Displays panel: Brightness (slider),
"Automatically adjust brightness" (checkbox), True Tone (checkbox)
(present only on some Macs made in 2018 or later), Night Shift (pop up
and checkbox), Color Profile (by name or row number), and the "Show
Profiles For This Display Only" checkbox. Apple invites users to use these
parameters to personally customize their experience by enabling dynamic
adjustments of all displayed images in response to personal preference,
ambient lighting, and time of day. Users seem to like that, but those
adjustments could defeat our efforts to calibrate the display one day
and, at a later date, use our calibrations to reliably present an
accurately specified stimulus. MacDisplaySettings aims to satisfy
everyone, by allowing your calibration and test programs to use the
computer in a fixed state, unaffected by user whims, ambient lighting,
and time of day, while saving and restoring whatever custom states the
users have customized it to. MacDisplaySettings reports and controls
these five settings. It allows you to read their current states, set
them to standard values for your critical work, and, when you're done,
restore them to their original values.
I wrote this script to be invoked from MATLAB, but you could call it
from any application running under macOS. To support an external monitor
the caller must provide the global rect of the external screen; that's not
necessary for the main screen.
MacDisplaySettings allows you to temporarily override any macOS user
customization of the display, to allow calibration and user testing with
stable display settings. It allows you to peek and poke seven settings in
the System Preferences:Displays panel by using the corresponding fields
in the oldXXX and newXXX arguments, where XXX is as follows:
DISPLAY
brightness the Brightness slider
automatically the "Automatically adjust brightness" checkbox (true or false)
trueTone the "True Tone" checkbox (true or false)
NIGHT SHIFT
nightShiftSchedule the Night Shift Schedule pop up menu ('Off','Custom', or 'Sunset to Sunrise')
nightShiftManual the Night Shift Manual checkbox (true or false)
COLOR
showProfilesForThisDisplayOnly the checkbox (true or false)
profile name of selection in Color Profile menu (text)
profileRow row # of selection in Color Profile menu (integer)
INPUT ARGS: The screenNumber, if provided, must be an integer of an
available screen, i.e. one of the values returned by Screen('Screens'). If
newProfileRow is specified then newProfile is ignored. True Tone is not
available on Macs manufactured before 2018.
OUTPUT ARGS: The variables oldXXX (where XXX stands for any of the fields
listed above) report the prior state of all available parameters. errorMsg
is the last output argument. If everything worked then errorMsg is an empty
string. Otherwise it will describe one failure, even if there were
several. In peeking, the fields corresponding to parameters that could
not be read will be empty [], and is not flagged as an error. Any omission
in poking is flagged as an error. If you get an error while poking, you
might call MacDisplaySettings again to compare the new peek with what you
poked.
SCREENNUMBER (AND GLOBAL RECT): We endeavor to interpret
screenNumber in the same way as Psychtoolbox Screen does (0 for main
screen, 1 for first external monitor, etc.). To achieve this we
request the global rect of the desired monitor as 4 input
arguments. We anticipate that the rect will be provided by
Screen('GlobalRect',screenNumber). We use this rect to select
whichever window of System Preferences: Displays is on the
desired monitor. This is reliable, provided the user
does not move those windows to different screens.
This applescript code works with whichever Displays
window is currently on the desired monitor. (If there are
several, it will arbitrarily pick one.)
BRIGHTNESS is a slider on the Displays panel, allowing users to easily
adjust the "Brightness" of Apple Macintosh displays.
Setting this parameter is equivalent to manually opening the System
Preference:Displays and adjusting the "brightnes" slider.
The "brightness" setting controls the luminance of the fluorescent light
that is behind the liquid crystal display. I believe that this
"brightness" setting controls only the luminance of the source, and does
not affect the liquid crystal display. The screen luminance is
presumably the product of the two factors: luminance of the source and
transmission of the liquid crystal, at each wavelength.
AUTOMATICALLY is a checkbox on the Displays panel. WHen enabled the
macOS adjusts the display luminance to track ambient lighting. I find
that pleasant as a user, but it's terrible for calibrationg.
TRUE TONE checkbox on the Displays panel.
NIGHT SHIFT panel has a "Schedule" pop-up menu and a "Manual"
checkbox.
DISPLAY PROFILE is a menu of named profiles on the "Color" panel.
Most of these controls don't interact. However,
showProfilesForThisDisplayOnly affects the choices available for
selecting a Profile. When you call MacDisplaySettings with a setting for
showProfilesForThisDisplayOnly, that setting is applied before it peeks
or pokes the Profile selection.
ERROR CHECKING. Most of the controls are straightforward. You are just
peeking and poking a Boolean (0 or 1) or a small integer with a known
range. Brightness and Profile are more subtle, so MacDisplaySettings
always checks by peeking immediately after poking Brightness (float)
or Profile (whether by name or by row). A discrepancy will be flagged
by a string in errorMsg. Note that you provide a float to Brightness
but within the macOS it's quantized to roughly 18-bit precision. The
peek of Brightness is considered erroneous only if it differes by more
than 0.001 from what we poked.
SYSTEM PREFERENCES TAKES 30 S TO OPEN: This script uses the "System
Preferences: Displays" panel, which takes 30 s to launch, if it isn't
already running. We leave it running.
All returned values are [] if your application (e.g. MATLAB) does not
have permission to control your computer (see APPLE SECURITY below).
In MATLAB, you should call MacDisplaySettings.m, which calls this
applescript.:
oldSettings=MacDisplaySettings(screenNumber,newSettings);
To call this applescript directly from MATLAB:
[status, errorMsg, oldBrightness, oldAutomatically, oldTrueTone, ...
oldNightSchedule, oldNightShiftManual, oldProfileRow, oldProfile] ...
= ...
system(['osascript MacDisplaySettings.applescript ' ...
num2str(screenNumber) ' '...
num2str(newBrightness) ' ' ...
num2str(newAutomatically) ' '...
num2str(newTrueTone) ' '...
num2str(newNightShiftSchedule) ' ' ...
num2str(ewNightShiftManual) ' '...
num2str(newShowProfilesForThisDisplayOnly) ' '...
num2str(newProfileRow) ' ' ...
'"' newProfile '"']);
Calling from any other language is very similar. Ignore the returned
"status", which seems to always be zero.
COMPATIBILITY: macOS VERSION: Works on Mavericks, Yosemite, El Capitan,
and Mojave (macOS 10.9 to 10.14). Not yet tested on macOS 10.8 or
earlier, or on Catalina (10.15). INTERNATIONAL: It is designed (but not
yet tested) to work internationally, with macOS localized for any
language, not just English. (For example, that is why we select the
Display/Colors panel by the internal name "displaysDisplayTab" instead
using the localized name "Display".) MULTIPLE SCREENS: All my computers
have only one screen, so I haven't yet tested it with values of
screenNumber other than zero.
FOR SPEED WE LEAVE SYSTEM PREFERENCES OPEN: This script uses the
System Preferences app, which takes 30 s to open, if it isn't already
open, so we leave it open.
APPLE PRIVACY. Unless the application (e.g. MATLAB) has the needed
user-granted permissions to control the computer, attempts by
MacDisplaySettings to change settings will be blocked by the macOS.
The needed permissions include Accessibility, Full Disk Access, and
Automation, all in System Preferences: Security & Privacy: Privacy.
Here are Apple pages on privacy in general, and accessibility in particular:
https://support.apple.com/guide/mac-help/change-privacy-preferences-on-mac-mh32356/mac
https://support.apple.com/guide/mac-help/allow-accessibility-apps-to-access-your-mac-mh43185/mac
New versions of macOS may demand more permissions. In some cases
MacDisplaySettings will detect the missing permission, open the
appropriate Security and Privacy System Preference panel, and provide an
error dialog window asking the user to provide the permission. In other
cases MacDisplaySettings merely prints the macOS error message. The
granting of permission needs to be done only once for your specific
MATLAB app. When you upgrade MATLAB it typically has a new name, and will
be treated as a new app, requiring newly granted permissions. Only
users with administation privileges can grant permission. When you grant
permission, sometimes the macOS doesn't seem to notice right away, and
keeps claiming MATLAB lacks permission. It may help to restart MATLAB or
reboot.
Psychtoolbox Screen.mex. Screen(... 'Brightness'): The Psychtoolbox for
MATLAB and macOS has a Screen call to get and set the brightness.
THANKS to <NAME> for explaining how macOS "brightness" works.
Thanks to <EMAIL> for sharing his applescript code for
dimmer.scpt and brighter.scpt.
SEE ALSO:
Script Debugger app from Late Night Software. https://latenightsw.com/
UI Browser app from UI Browser by PFiddlesoft. https://pfiddlesoft.com/uibrowser/
ScriptingAllowed.applescript (http://psych.nyu.edu/pelli/software.html)
The Psychtoolbox call to get and set the Macintosh brightness:
[oldBrightness]=Screen('ConfigureDisplay','Brightness', ...);
http://www.manpagez.com/man/1/osascript/
https://developer.apple.com/library/mac/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_cmds.html
https://discussions.apple.com/thread/6418291
https://stackoverflow.com/questions/13415994/how-to-get-the-number-of-items-in-a-pop-up-menu-without-opening-it-using-applesc
HISTORY
May 21, 2015. Wrote AutoBrightness to control the "Automatically adjust
brightness" checkbox of the Displays panel.
May 29, 2015 Enhanced to allow specification of screenNumber.
June 1, 2015. Polished the comments.
July 25, 2015 Previously worked on Mavericks (Mac OS X 10.9). Now
enhanced to also support Yosemite (Mac OS X 10.10.4).
August 3, 2015 Now uses try-blocks to try first group 1 and then group 2
to cope with variations in Apple's macOS. I find that under macOS 10.9
the checkbox is always in group 1. Under macOS 10.10 I have previously
found it in group 2, but now I find it in group 1, so it seems best for
the program to keep trying groups until it finds the checkbox: first 1,
then 2, then give up.
February 29, 2016 Improved the wording of the pop-up screen to spell out
what the user needs to do to allow MATLAB to control the computer.
June 25, 2017. First version of Brightness, based on my
AutoBrightness.applescript
April 9, 2020. Now called MacDisplaySettings.applescript merging code
from Brightness and AutoBrightness, and adding code for True Tone and
Night Shift.
April 14, 2020. Added loops to wait "until exists tab group 1 of window
windowNumber" before accessing it. This change has enormously increased
the reliability. I think the old failures were timeouts, and the wait
loops seem to have almost entirely fixed that.
May 2, 2020. Watching it work, I notice that the operations on the
System Preferences panel are glacially slow while it's in background,
behind MATLAB, but zippy, like a fast human operator, when System
Preferences is foremost. Observing that, I now "activate" System
Preferences at the beginning (and reactivate the former app when we
exit), and this runs much faster. Formerly delays of 60 s were common.
Now it reliably takes 3 s.
May 5, 2020. Return an error message if anything went wrong. The user
will know that everything's ok if the error string is empty. Also apply
the user's setting of newShowProfilesForThisDisplayOnly before peeking
and poking.
May 9, 2020. Improved speed (from 3 to 1.6 s) by replacing fixed delays
in applescript with wait loops. Enhanced the built-in peek of brightness
afer poking. Now if the peek differs by more than 0.001,
MacDisplaySettings waits 100 ms and tries again, to let the value settle,
as the visual effect is a slow fade. Then it reports in errorMsg if the
new peek differs by more than 0.001. In limited testing, waiting for a
good answer works: the peek-poke difference rarely exceeds +/-5e-6 and
never exceeds 0.001. It's my impression that if we always waited 100 ms,
then the discrepancy would always be less than +/-5e-6.
May 15, 2020. MacDisplaySettings.m now also passes a flag indicating
whether Psychtoolbox has a window on the main screen. In that case,
AppleScript will not try to show a dialog. Added a loop in AppleScript
to wait for System Preferences window to open; this fixes a rare error.
Replaced every error code with a message in errorMsg.
May 20, 2020. MacDisplaySettings hung up on my student <NAME>
with the Night Shift panel showing. I suspect it was in an endless
loop waiting for the menu to pop up after a click. I rewrote the
loop to throw an error if the menu doesn't appear after three attempts
of clicking and waiting up to 500 ms each time.
June 9, 2020. Cosmetic. Improved explanation of APPLE PRIVACY,
*)
on run argv
-- INPUT ARGUMENTS: screenNumber, screen rect, newBrightness, newAutomatically, newTrueTone,
-- newNightShiftSchedule, newNightShiftManual,
-- newShowProfilesForThisDisplayOnly, newProfileRow, newProfile.
-- OUTPUT ARGUMENTS: olsdBrightness, oldAutomatically, oldTrueTone, oldNightShift,
-- oldShowProfilesForThisDisplayOnly, oldProfileRow, oldProfile, errorMSG.
-- integer screenNumber. Zero for main screen. Default is zero.
--integer 4 values for global rect of desired screen. (Can be -1 -1 -1 -1 for main screen.)
-- float newBrightness: -1.0 (ignore) or 0.0 to 1.0 value of brightness slider.
-- integer newAutomatically: -1 (ignore) or 0 or 1 logical value of checkbox.
-- integer newTrueTone: -1 (ignore) or 0 or 1 logical value of checkbox.
-- A value of -1 leaves the setting unchanged.
-- Returns oldBrightness (-1, or 0.0 to 1.0), oldAutomatically (-1, or 0 or 1),
-- oldTrueTone (-1, or 0 or 1), oldNightShiftSchedule (-1, or 1, 2, or 3),
-- oldNightShiftManual (-1 or 0 or 1),
-- oldShowProfilesForThisDisplayOnly (-1, or 0 or 1),
-- oldProfileRow (-1 or integer), oldProfile (string).
-- TrueTone only exists on some Macs manufactured 2018 or later. When not
-- available, oldTrueTone is [].
tell application "Finder"
set mainRect to bounds of window of desktop
end tell
--GET ARGUMENTS
set theRect to {-1, -1, -1, -1}
try
set screenNumber to item 1 of argv as integer
on error
set screenNumber to 0 -- Default is the main screen.
end try
try
set item 1 of theRect to item 2 of argv as integer
on error
set item 1 of theRect to item 1 of mainRect -- Default is the main screen.
end try
try
set item 2 of theRect to item 3 of argv as integer
on error
set item 2 of theRect to item 2 of mainRect -- Default is the main screen.
end try
try
set item 3 of theRect to item 4 of argv as integer
on error
set item 3 of theRect to item 3 of mainRect -- Default is the main screen.
end try
try
set item 4 of theRect to item 5 of argv as integer
on error
set item 4 of theRect to item 4 of mainRect -- Default is the main screen.
end try
try
set windowIsOpenOnMainScreen to item 6 of argv as integer
if windowIsOpenOnMainScreen > 0 then
set windowIsOpenOnMainScreen to true
else
set windowIsOpenOnMainScreen to false
end if
on error
set windowIsOpenOnMainScreen to true
end try
try
set newBrightness to item 7 of argv as real
on error
set newBrightness to -1.0 -- Unspecified value, so don't change the setting.
end try
try
set newAutomatically to item 8 of argv as integer
on error
set newAutomatically to -1 -- Unspecified value, so don't change the setting.
end try
try
set newTrueTone to item 9 of argv as integer
on error
set newTrueTone to -1 -- Unspecified value, so don't change the setting.
end try
try
--To ease passing the Night Shift Schedule menu choice back and forth
--between MATLAB and AppleScript (and for compatibility with international
--variations of macOS), we receive and pass just the integer index into
--the list: {'Off','Custom','Sunset to Sunrise'}. This should work in
--international (i.e. translated) versions of macOS.
set newNightShiftSchedule to item 10 of argv as integer
on error
set newNightShiftSchedule to -1 -- Unspecified value, so don't change the setting.
end try
try
set newNightShiftManual to item 11 of argv as integer
on error
set newNightShiftManual to -1 -- Unspecified value, so don't change the setting.
end try
try
set newShowProfilesForThisDisplayOnly to item 12 of argv as integer
on error
set newShowProfilesForThisDisplayOnly to -1 -- Unspecified value, so don't change the setting.
end try
try
set newProfileRow to item 13 of argv as integer
on error
set newProfileRow to -1 -- Unspecified value is ignored.
end try
try
set newProfile to item 14 of argv as string
on error
set newProfile to -1 -- Unspecified value is ignored.
end try
if newProfile as string is equal to "" then
set newProfile to -1
end if
-- CHECK ARGUMENTS
if newNightShiftSchedule is not in {-1, 1, 2, 3} then
set errorMsg to "newNightShiftSchedule " & newNightShiftSchedule & " should be one of -1, 1, 2, 3."
return {oldBrightness, oldAutomatically, ¬
oldTrueTone, oldNightShiftSchedule, oldNightShiftManual, ¬
oldShowProfilesForThisDisplayOnly, oldProfileRow, ¬
"|" & oldProfile & "|", "|" & errorMsg & "|"}
end if
set leaveSystemPrefsRunning to true -- This could be made a further argument.
set versionString to system version of (system info)
considering numeric strings
set isMojaveOrBetter to versionString ≥ "10.14.0"
set isNightShiftAvailable to versionString ≥ "10.12.4"
end considering
-- Default values. The value -1 means don't modify this setting.
set oldBrightness to -1.0
set oldAutomatically to -1
set oldTrueTone to -1
set oldProfile to ""
set oldProfileRow to -1
set oldShowProfilesForThisDisplayOnly to -1
set oldNightShiftSchedule to -1
set oldNightShiftManual to -1
set errorMsg to ""
-- The "ok" flags help track what failed. We return an error message if
-- any failed (that shouldn't).
set trueToneOk to false
set groupOk to false
set brightnessOk to false
set profileOk to false
set manualOk to false
set scheduleOk to false
-- GET NAME OF CURRENT APP.
-- Save name of current active application (probably MATLAB) to
-- restore at end as the frontmost. Apparently this
-- works reliably only if saved "as text".
--https://stackoverflow.com/questions/44017508/set-application-to-frontmost-in-applescript
--https://stackoverflow.com/questions/13097426/activating-an-application-in-applescript-with-the-application-as-a-variable
set currentApp to path to frontmost application as text
--ACTIVATE SYSTEM PREFERENCES APP
tell application "System Preferences"
activate -- Bring it to the front, which makes the rest MUCH faster.
-- This is the international way to get to the desired pane of Displays,
-- immune to language localizations.
set current pane to pane id "com.apple.preference.displays"
set wasRunning to running
reveal anchor "displaysDisplayTab" of pane id "com.apple.preference.displays"
end tell
-- FIND THE SYSTEM PREFS WINDOWS ON THE DESIRED SCREEN.
-- theRect is received as an argument. In MATLAB theRect=Screen('GlobalRect',screen).
-- Formerly we always referred to "window windowNumber" but windowNumber changes
-- if a window is brought forward. The frontmost window always has number 1. So now
-- we refer to theWindow which is stable, even after we bring the window to the front.
-- We know a window is on the desired screen by checking whether its x y position
-- is inside the global rect of the desired screen, which is received as an
-- argument when MacDisplayScreen.applescript is called. (If the global rect is not
-- provided, the default is the rect of the main screen, which we compute above.)
set theWindow to -1
set mainWindow to -1
if screenNumber is equal to 0 then
set theRect to mainRect
end if
--set theRect to {1000, 0, 3600, 1000} -- for debugging
tell application "System Events"
tell application process "System Preferences"
repeat until exists window 1
delay 0.05
end repeat
repeat with w from 1 to (count windows)
set winPos to position of window w
set x to item 1 of winPos
set y to item 2 of winPos
if (x ≥ item 1 of theRect and x ≤ item 3 of theRect and ¬
y ≥ item 2 of theRect and y ≤ item 4 of theRect) then
set theWindow to window w
end if
-- We never use the variable "mainWindow", but it's cheap to
-- find it, and it's handy to have when debugging.
if (x ≥ item 1 of mainRect and x ≤ item 3 of mainRect and ¬
y ≥ item 2 of mainRect and y ≤ item 4 of mainRect) then
set mainWindow to window w
end if
end repeat
end tell
end tell
if theWindow is equal to -1 then
set AppleScript's text item delimiters to space
set theString to theRect as string
set AppleScript's text item delimiters to ""
set errorMsg to "Could not find System Preferences window on screenNumber " & screenNumber & " with rect [" & theString & "]."
activate application currentApp -- Restore active application.
--delay 0.1 -- May not be needed.
return {oldBrightness, oldAutomatically, ¬
oldTrueTone, oldNightShiftSchedule, oldNightShiftManual, ¬
oldShowProfilesForThisDisplayOnly, oldProfileRow, ¬
"|" & oldProfile & "|", "|" & errorMsg & "|"}
end if
-- PERMISSION CHECK, TRUE TONE, BRIGHTNESS & AUTOMATIC,
tell application "System Events"
-- CHECK FOR PERMISSION
set applicationName to item 1 of (get name of processes whose frontmost is true)
if not UI elements enabled then
tell application "System Preferences"
activate
reveal anchor "Privacy_Accessibility" of pane id "com.apple.preference.security"
if windowIsOpenOnMainScreen then
-- Psychtoolbox has a window open that might obscure
-- our dialog window. So we return instead and let
-- MacDisplaySettings close all windows.
set errorMsg to "To set Displays preferences, " & applicationName & ¬
" needs your permission to control this computer. " & ¬
"Please unlock System Preferences: Security & Privacy: " & ¬
"Privacy and click the boxes to grant " & applicationName & " permission for Full Disk Access and Automation. "
return {oldBrightness, oldAutomatically, ¬
oldTrueTone, oldNightShiftSchedule, oldNightShiftManual, ¬
oldShowProfilesForThisDisplayOnly, oldProfileRow, ¬
"|" & oldProfile & "|", "|" & errorMsg & "|"}
end if
display alert "To set Displays preferences, " & applicationName & ¬
" needs your permission to control this computer. " & ¬
"BEFORE you click OK below, please unlock System Preferences: Security & Privacy: " & ¬
"Privacy and click the boxes to grant permission for Full Disk Access and Automation. " & ¬
"THEN click OK."
end tell
return {oldBrightness, oldAutomatically, ¬
oldTrueTone, oldNightShiftSchedule, oldNightShiftManual, ¬
oldShowProfilesForThisDisplayOnly, oldProfileRow, ¬
"|" & oldProfile & "|", "|" & errorMsg & "|"}
end if
--DISPLAY PANEL
-- TRUE TONE, BRIGHTNESS & AUTOMATIC
set screenNumber to 1
tell process "System Preferences"
repeat 10 times
if exists theWindow then exit repeat
delay 0.05
end repeat
if not (exists theWindow) then
set errorMsg to "screenNumber " & screenNumber & " is not available."
activate application currentApp -- Restore active application.
--delay 0.1
return {oldBrightness, oldAutomatically, ¬
oldTrueTone, oldNightShiftSchedule, oldNightShiftManual, ¬
oldShowProfilesForThisDisplayOnly, oldProfileRow, ¬
"|" & oldProfile & "|", "|" & errorMsg & "|"}
end if
repeat until exists tab group 1 of theWindow
delay 0.05
end repeat
tell tab group 1 of theWindow
-- TRUE TONE
set trueToneOk to false
try
tell checkbox 1
set oldTrueTone to value
if newTrueTone is in {0, 1} and newTrueTone is not oldTrueTone then
click -- It's stale, so update it.
end if
end tell
--Succeeded with True Tone.
set trueToneOk to true
on error
-- Don't report True Tone error.
-- Just return oldTrueTone=-1.
set trueToneOk to false
end try
-- BRIGHTNESS & AUTOMATIC
repeat with iGroup from 1 to 2
-- Find the right group
-- 1 works on macOS 10.9 and 10.14, and some versions of 10.10.
-- 2 works on macOS 10.11 through 10.13, and some versions of 10.10.
try
tell group iGroup
set oldBrightness to slider 1's value -- Get brightness
end tell
set groupOk to true
set theGroup to iGroup
exit repeat
on error errorMessage
set groupOk to false
end try
end repeat
if groupOk is false then
set errorMsg to "Could not find valid group for brightness."
else
try
tell group theGroup
-- BRIGHTNESS
set brightnessOk to false
set oldBrightness to slider 1's value -- Get brightness
if newBrightness > -1 then
set slider 1's value to newBrightness -- Set brightness
-- Check the poke by peeking.
-- We can't demand equality (of peek and poke) because
-- macOS uses only about 18-bit precision internally.
--Visually, moving the slider causes a slow
--fade. (Maybe that's why they gave it such high precision.)
--It's possible that the value we
--read similarly takes time to reach the
--requested setting. So when we read a bad
--value (different by at least 0.001 from the newBrightness we poked)
--then we wait a bit and try again. After 2000
--poke-peek pairs with random brightnesses (0.0 to 1.0),
--only 5 immediate peeks differed by at least 0.01, and only 11 differed
-- by at least 0.0001. The rest were within
--+/- 5e-6 of the value poked. (The outliers were all
--brighter than desired, suggesting that dimming is
--slower than brightening.) In limited testing, this delay
--seems to have eliminated the outliers, so the peek-poke
--difference never exceeds +/- 5e-6. Given
--that the brightness always settles to the desired value
--perhaps the extra peek is superfluous. I'm leaving it in
--because MacDisplaySettings is slow anyway, due to applescript,
--so the extra up to 200 ms of the peek seems good insurance
--for detecting unanticipated problems in particular Macs,
--or different versions of the macOS.
set b to slider 1's value -- Get brightness
set bErr to (b - newBrightness)
--is the peek bad?
if bErr > 1.0E-3 or bErr < -1.0E-3 then
-- yep, it's bad. Wait and peek again.
delay 0.1
set b to slider 1's value -- Get brightness
set bErr to (b - newBrightness)
if bErr > 1.0E-3 or bErr < -1.0E-3 then
error "Poked Brightness " & newBrightness & " but peeked " & b & "."
end if
end if
end if
--Succeeded with Brightness.
-- AUTOMATICALLY
tell checkbox 1 -- Enable/disable Automatically adjust brightness
set oldAutomatically to value
if newAutomatically is in {0, 1} and ¬
newAutomatically is not oldAutomatically then
click -- It's stale, so update it.
end if
end tell -- checkbox 1
--Succeeded with Automatically.
end tell -- group iGroup
--Succeeded with Brightness and Automatically.
set brightnessOk to true
on error errorMessage
set errorMsg to errorMessage
set brightnessOk to false
end try
end if
end tell
end tell
end tell
-- This block of code selects the right window (a System Preferences window on
-- the desired screen) and selects the Color pane within it.
tell application "System Events"
tell process "System Preferences"
tell theWindow
select
perform action "AXRaise" of theWindow
tell tab group 1
tell radio button 2
--This click selects color.
click
end tell
end tell
end tell
end tell
end tell
-- COLOR PANEL
tell application "System Events"
tell process "System Preferences"
repeat until exists tab group 1 of theWindow
delay 0.05
end repeat
tell tab group 1 of theWindow
-- Show all profiles.
try
repeat until exists checkbox 1
delay 0.05
end repeat
tell checkbox 1 -- Yes/no: Show profiles for this display only.
set oldShowProfilesForThisDisplayOnly to value
if newShowProfilesForThisDisplayOnly is not equal to -1 then
-- Set new value.
if newShowProfilesForThisDisplayOnly is not equal to oldShowProfilesForThisDisplayOnly ¬
then
click
end if
end if
end tell -- checkbox 1
-- Read selection and select new Display Profile
repeat until exists row 1 of table 1 of scroll area 1
delay 0.05
end repeat
tell table 1 of scroll area 1
set oldProfile to value of static text 1 of ¬
(row 1 where selected is true)
repeat with profileRow from 1 to 101
if selected of row profileRow then exit repeat
end repeat
set oldProfileRow to profileRow
if oldProfileRow is 101 then
set oldProfileRow to -1
error "Could not select Profile by row."
end if
if newProfileRow is not equal to -1 then
--newProfileRow specifies Profile row.
if selected of row newProfileRow is true then
-- If the desired row is already selected
-- then we first select and activate another row,
-- and then reselect and activate the one we want.
-- This makes sure that a fresh copy of the profile
-- is loaded from disk.
if newProfileRow is equal to 1 then
select last row
else
select row 1
end if
activate
click
end if
select row newProfileRow
activate
click
if selected of row newProfileRow is false then
error "Could not set Profile row."
end if
else
--newProfile specifies Profile name.
if newProfile is not equal to -1 then
try
if selected of ¬
(row 1 where value of static text 1 is newProfile) then
if oldProfileRow is equal to 1 then
select last row
else
select row 1
end if
activate
end if
select (row 1 where value of static text 1 is newProfile)
activate
click
on error
error "Could not select Profile '" & newProfile & "' by name."
end try
if newProfile is not equal to value ¬
of static text 1 of (row 1 where selected is true) then
error "Could not select Profile '" & newProfile & "' by name."
end if
end if
end if
end tell
set profileOk to true
on error errorMessage number errorNumber
set profileOk to false
set errorMsg to errorMessage
end try
end tell
end tell
end tell
-- NIGHT SHIFT PANEL
tell application "System Preferences"
reveal anchor "displaysNightShiftTab" of pane id "com.apple.preference.displays"
end tell
tell application "System Events"
tell process "System Preferences"
repeat until exists tab group 1 of theWindow
delay 0.05
end repeat
tell tab group 1 of theWindow
-- NIGHT SHIFT MANUAL
try
tell checkbox 1 -- Enable/disable Night Shift Manual
set oldNightShiftManual to value
--display alert "4 Read!"
if newNightShiftManual is in {0, 1} and ¬
newNightShiftManual is not oldNightShiftManual then
click -- It's stale, so update it.
--display alert "5 Wrote!"
end if
end tell
--Succeeded with Night Shift Manual.
set manualOk to true
on error
set manualOk to false
end try
-- NIGHT SHIFT SCHEDULE
try
repeat until exists pop up button 1
delay 0.05
end repeat
tell pop up button 1 -- Select Night Shift Schedule
-- We get the selection value, i.e. text which may
-- be in foreign language.
set theLabel to value
-- Then we find it in the pop up menu and keep its index.
-- The nested repeat loops are my attempt to
-- eliminate a hang that I think was due to waiting
-- forever, after a click, for the menu to appear.
-- When I manually click a pop-up menu the menu appears
-- and remains forever. But after the applescript "click"
-- command, the menu appears only briefly.
-- My hypothesis is that perhaps the menu came and went
-- before my loop started waiting for it to appear. The new
-- code waits for up to 500 ms, and then tries again
-- (up to twice more) to click and wait. If, after three tries,
-- the menu still hasn't appeared, then we fail with an
-- applescript error, so i'll get some diagnostic information.
repeat 3 times
click -- reveal pop up menu
repeat 10 times
if exists menu 1 then exit repeat
delay 0.05
end repeat
if exists menu 1 then exit repeat
end repeat
repeat with i from 1 to 3
set x to name of menu item i of menu 1
if theLabel is x then
set oldNightShiftSchedule to i
exit repeat
end if
end repeat
--Hit escape key to hide the menu.
key code 53
if newNightShiftSchedule > 0 then
repeat 3 times
click -- reveal pop up menu
repeat 10 times
if exists menu 1 then exit repeat
delay 0.05
end repeat
if exists menu 1 then exit repeat
end repeat
click menu item newNightShiftSchedule of menu 1
end if
end tell
--Succeeded with Night Shift Schedule.
set scheduleOk to true
on error
set scheduleOk to false
end try
end tell
end tell
end tell
--SHOW MAIN DISPLAYS PANEL AS WE LEAVE
tell application "System Preferences"
reveal anchor "displaysDisplayTab" of pane id "com.apple.preference.displays"
end tell
if wasRunning or leaveSystemPrefsRunning then
-- Leave it running.
else
quit application "System Preferences"
end if
if errorMsg as string is equal to "" then
if not profileOk then set errorMsg to "Could not peek/poke Profile selection."
if isNightShiftAvailable then
if not manualOk then set errorMsg to "Could not peek/poke Night Shift manual."
if not scheduleOk then set errorMsg to "Could not peek/poke Night Shift schedule."
end if
-- Many computers don't support True Tone, so we don't flag this as an error.
-- It's enough that the field is left empty.
--if not trueToneOk then set errorMsg to "Could not peek/poke True Tone."
if not brightnessOk then set errorMsg to "Could not peek/poke Brightness and Automatically."
end if
-- RESTORE FRONTMOST APPLICATION (PROBABLY MATLAB).
activate application currentApp -- Restore active application.
--delay 0.1 --Not sure if we need this at all.
return {oldBrightness, oldAutomatically, ¬
oldTrueTone, oldNightShiftSchedule, oldNightShiftManual, ¬
oldShowProfilesForThisDisplayOnly, oldProfileRow, ¬
"|" & oldProfile & "|", "|" & errorMsg & "|"}
end run
|
data/wildPokemon/seafoamisland1.asm | adhi-thirumala/EvoYellow | 0 | 10926 | <gh_stars>0
IslandMons1:
db $0F
db 28,GLIGAR
db 25,KRABBY
db 27,KRABBY
db 27,SNEASEL
db 36,SNEASEL
db 28,SLOWPOKE
db 30,SLOWPOKE
db 28,JYNX
db 27,BOMBSEEKER
db 36,GOLBAT
db $00
|
oeis/321/A321349.asm | neoneye/loda-programs | 11 | 171546 | <filename>oeis/321/A321349.asm<gh_stars>10-100
; A321349: a(n) = Sum_{d|n} phi(d^n), where phi() is the Euler totient function (A000010).
; Submitted by <NAME>(s3)
; 1,3,19,137,2501,16071,705895,8421505,258293449,4007813013,259374246011,2972767821815,279577021469773,4762869973595499,233543432626753439,9223512776490647553,778579070010669895697,13115569455375954492093,1874292305362402347591139,41943080000076843701650677,3338621153842172188405597621,155194563713508332307351619983,19972621565071915858948292349239,444578618784739872122781915009175,71054273576010018825531005859375001,2841286044772531244923341971664063261,295617658828730613123501785536291845307
add $0,1
mov $2,$0
lpb $0
mov $3,$2
gcd $3,$0
sub $0,1
mov $4,$2
div $4,$3
mov $3,$4
mov $4,$2
sub $4,1
pow $3,$4
add $1,$3
lpe
mov $0,$1
|
home/clear_sprites.asm | opiter09/ASM-Machina | 1 | 170986 | <gh_stars>1-10
ClearSprites::
xor a
ld hl, wOAMBuffer
ld b, wOAMBufferEnd - wOAMBuffer
.loop
ld [hli], a
dec b
jr nz, .loop
ret
HideSprites::
ld a, 160
ld hl, wOAMBuffer
ld de, 4
ld b, 40
.loop
ld [hl], a
add hl, de
dec b
jr nz, .loop
ret
|
alloy4fun_models/trashltl/models/11/vS5tsgbxYQFfKEv5Q.als | Kaixi26/org.alloytools.alloy | 0 | 3012 | <gh_stars>0
open main
pred idvS5tsgbxYQFfKEv5Q_prop12 {
always( some f:File | eventually f in Trash)
}
pred __repair { idvS5tsgbxYQFfKEv5Q_prop12 }
check __repair { idvS5tsgbxYQFfKEv5Q_prop12 <=> prop12o } |
src/aids-env.ads | OneWingedShark/ada-probe | 0 | 16795 | with Ada.Containers.Indefinite_Hashed_Maps;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.strings.Hash;
-- Basic support for .env files in Ada everyone was waiting for
package Aids.Env is
Syntax_Error : exception;
-- Indefinite hashed map can have unconstrained strinfs as keys or elements.
package Env_Hashed_Map is new Ada.Containers.Indefinite_Hashed_Maps
(Key_Type => String,
Element_Type => String,
Hash => Ada.Strings.Hash,
Equivalent_Keys => "="
);
subtype Typ is Env_Hashed_Map.Map;
function Slurp(File_Path: String) return Typ;
-- Retrieve a value given some key.
function Find(Env : in Typ;
Key : in Unbounded_String;
Value : out Unbounded_String
) return Boolean;
function Find(Env : in Typ;
Key : in String;
Found : in out Boolean
) return String;
end Aids.Env;
|
testsuite/soap/soapconf-driver.adb | svn2github/matreshka | 24 | 20090 | <gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Testsuite Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2013, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Ada.Wide_Wide_Text_IO;
with League.Stream_Element_Vectors;
with League.Strings;
with League.Text_Codecs;
with Web_Services.SOAP.Dispatcher;
with Web_Services.SOAP.Reply_Streams;
with SOAPConf.Reply_Streams;
with SOAPConf.Testcases.Test_T24;
with SOAPConf.Testcases.Test_T25;
with SOAPConf.Testcases.Test_T26;
with SOAPConf.Testcases.Test_T28;
with SOAPConf.Testcases.Test_T29;
with SOAPConf.Testcases.Test_T34;
with SOAPConf.Testcases.Test_T37;
with SOAPConf.Testcases.Test_T40;
with SOAPConf.Decoders;
pragma Unreferenced (SOAPConf.Decoders);
with SOAPConf.Encoders;
pragma Unreferenced (SOAPConf.Encoders);
with SOAPConf.Handlers;
pragma Unreferenced (SOAPConf.Handlers);
procedure SOAPConf.Driver is
use type League.Strings.Universal_String;
Codec : constant League.Text_Codecs.Text_Codec
:= League.Text_Codecs.Codec
(League.Strings.To_Universal_String ("utf-8"));
procedure Do_Simple_Test
(Source : League.Strings.Universal_String;
Expected : League.Strings.Universal_String);
--------------------
-- Do_Simple_Test --
--------------------
procedure Do_Simple_Test
(Source : League.Strings.Universal_String;
Expected : League.Strings.Universal_String)
is
Reply : aliased SOAPConf.Reply_Streams.Reply_Stream;
begin
Web_Services.SOAP.Dispatcher.Dispatch
(Codec.Encode (Source).To_Stream_Element_Array,
League.Strings.Empty_Universal_String,
Reply'Unchecked_Access);
if Codec.Decode (Reply.Output_Data) /= Expected then
Ada.Wide_Wide_Text_IO.Put_Line
(''' & Expected.To_Wide_Wide_String & ''');
Ada.Wide_Wide_Text_IO.Put_Line
(''' & Codec.Decode (Reply.Output_Data).To_Wide_Wide_String & ''');
raise Program_Error;
end if;
end Do_Simple_Test;
begin
Do_Simple_Test
(SOAPConf.Testcases.Test_T24.Scenario.Message_A,
SOAPConf.Testcases.Test_T24.Scenario.Message_C);
Do_Simple_Test
(SOAPConf.Testcases.Test_T25.Scenario.Message_A,
SOAPConf.Testcases.Test_T25.Scenario.Message_C);
Do_Simple_Test
(SOAPConf.Testcases.Test_T26.Scenario.Message_A,
SOAPConf.Testcases.Test_T26.Scenario.Message_C);
Do_Simple_Test
(SOAPConf.Testcases.Test_T28.Scenario.Message_A,
SOAPConf.Testcases.Test_T28.Scenario.Message_C);
Do_Simple_Test
(SOAPConf.Testcases.Test_T29.Scenario.Message_A,
SOAPConf.Testcases.Test_T29.Scenario.Message_C);
Do_Simple_Test
(SOAPConf.Testcases.Test_T34.Scenario.Message_A,
SOAPConf.Testcases.Test_T34.Scenario.Message_C);
Do_Simple_Test
(SOAPConf.Testcases.Test_T37.Scenario.Message_A,
SOAPConf.Testcases.Test_T37.Scenario.Message_C);
Do_Simple_Test
(SOAPConf.Testcases.Test_T40.Scenario.Message_A,
SOAPConf.Testcases.Test_T40.Scenario.Message_C);
end SOAPConf.Driver;
|
arch/ARM/Nordic/svd/nrf52/nrf_svd-twis.ads | rocher/Ada_Drivers_Library | 192 | 7882 | -- Copyright (c) 2010 - 2018, Nordic Semiconductor ASA
--
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without modification,
-- are permitted provided that the following conditions are met:
--
-- 1. Redistributions of source code must retain the above copyright notice, this
-- list of conditions and the following disclaimer.
--
-- 2. Redistributions in binary form, except as embedded into a Nordic
-- Semiconductor ASA integrated circuit in a product or a software update for
-- such product, 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 Nordic Semiconductor ASA nor the names of its
-- contributors may be used to endorse or promote products derived from this
-- software without specific prior written permission.
--
-- 4. This software, with or without modification, must only be used with a
-- Nordic Semiconductor ASA integrated circuit.
--
-- 5. Any software provided in binary form under this license must not be reverse
-- engineered, decompiled, modified and/or disassembled.
--
-- THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
-- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-- OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
-- DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
-- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--
-- This spec has been automatically generated from nrf52.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package NRF_SVD.TWIS is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- Shortcut between WRITE event and SUSPEND task
type SHORTS_WRITE_SUSPEND_Field is
(-- Disable shortcut
Disabled,
-- Enable shortcut
Enabled)
with Size => 1;
for SHORTS_WRITE_SUSPEND_Field use
(Disabled => 0,
Enabled => 1);
-- Shortcut between READ event and SUSPEND task
type SHORTS_READ_SUSPEND_Field is
(-- Disable shortcut
Disabled,
-- Enable shortcut
Enabled)
with Size => 1;
for SHORTS_READ_SUSPEND_Field use
(Disabled => 0,
Enabled => 1);
-- Shortcut register
type SHORTS_Register is record
-- unspecified
Reserved_0_12 : HAL.UInt13 := 16#0#;
-- Shortcut between WRITE event and SUSPEND task
WRITE_SUSPEND : SHORTS_WRITE_SUSPEND_Field := NRF_SVD.TWIS.Disabled;
-- Shortcut between READ event and SUSPEND task
READ_SUSPEND : SHORTS_READ_SUSPEND_Field := NRF_SVD.TWIS.Disabled;
-- unspecified
Reserved_15_31 : HAL.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for SHORTS_Register use record
Reserved_0_12 at 0 range 0 .. 12;
WRITE_SUSPEND at 0 range 13 .. 13;
READ_SUSPEND at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
-- Enable or disable interrupt for STOPPED event
type INTEN_STOPPED_Field is
(-- Disable
Disabled,
-- Enable
Enabled)
with Size => 1;
for INTEN_STOPPED_Field use
(Disabled => 0,
Enabled => 1);
-- Enable or disable interrupt for ERROR event
type INTEN_ERROR_Field is
(-- Disable
Disabled,
-- Enable
Enabled)
with Size => 1;
for INTEN_ERROR_Field use
(Disabled => 0,
Enabled => 1);
-- Enable or disable interrupt for RXSTARTED event
type INTEN_RXSTARTED_Field is
(-- Disable
Disabled,
-- Enable
Enabled)
with Size => 1;
for INTEN_RXSTARTED_Field use
(Disabled => 0,
Enabled => 1);
-- Enable or disable interrupt for TXSTARTED event
type INTEN_TXSTARTED_Field is
(-- Disable
Disabled,
-- Enable
Enabled)
with Size => 1;
for INTEN_TXSTARTED_Field use
(Disabled => 0,
Enabled => 1);
-- Enable or disable interrupt for WRITE event
type INTEN_WRITE_Field is
(-- Disable
Disabled,
-- Enable
Enabled)
with Size => 1;
for INTEN_WRITE_Field use
(Disabled => 0,
Enabled => 1);
-- Enable or disable interrupt for READ event
type INTEN_READ_Field is
(-- Disable
Disabled,
-- Enable
Enabled)
with Size => 1;
for INTEN_READ_Field use
(Disabled => 0,
Enabled => 1);
-- Enable or disable interrupt
type INTEN_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- Enable or disable interrupt for STOPPED event
STOPPED : INTEN_STOPPED_Field := NRF_SVD.TWIS.Disabled;
-- unspecified
Reserved_2_8 : HAL.UInt7 := 16#0#;
-- Enable or disable interrupt for ERROR event
ERROR : INTEN_ERROR_Field := NRF_SVD.TWIS.Disabled;
-- unspecified
Reserved_10_18 : HAL.UInt9 := 16#0#;
-- Enable or disable interrupt for RXSTARTED event
RXSTARTED : INTEN_RXSTARTED_Field := NRF_SVD.TWIS.Disabled;
-- Enable or disable interrupt for TXSTARTED event
TXSTARTED : INTEN_TXSTARTED_Field := NRF_SVD.TWIS.Disabled;
-- unspecified
Reserved_21_24 : HAL.UInt4 := 16#0#;
-- Enable or disable interrupt for WRITE event
WRITE : INTEN_WRITE_Field := NRF_SVD.TWIS.Disabled;
-- Enable or disable interrupt for READ event
READ : INTEN_READ_Field := NRF_SVD.TWIS.Disabled;
-- unspecified
Reserved_27_31 : HAL.UInt5 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for INTEN_Register use record
Reserved_0_0 at 0 range 0 .. 0;
STOPPED at 0 range 1 .. 1;
Reserved_2_8 at 0 range 2 .. 8;
ERROR at 0 range 9 .. 9;
Reserved_10_18 at 0 range 10 .. 18;
RXSTARTED at 0 range 19 .. 19;
TXSTARTED at 0 range 20 .. 20;
Reserved_21_24 at 0 range 21 .. 24;
WRITE at 0 range 25 .. 25;
READ at 0 range 26 .. 26;
Reserved_27_31 at 0 range 27 .. 31;
end record;
-- Write '1' to Enable interrupt for STOPPED event
type INTENSET_STOPPED_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_STOPPED_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable interrupt for STOPPED event
type INTENSET_STOPPED_Field_1 is
(-- Reset value for the field
Intenset_Stopped_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_STOPPED_Field_1 use
(Intenset_Stopped_Field_Reset => 0,
Set => 1);
-- Write '1' to Enable interrupt for ERROR event
type INTENSET_ERROR_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_ERROR_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable interrupt for ERROR event
type INTENSET_ERROR_Field_1 is
(-- Reset value for the field
Intenset_Error_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_ERROR_Field_1 use
(Intenset_Error_Field_Reset => 0,
Set => 1);
-- Write '1' to Enable interrupt for RXSTARTED event
type INTENSET_RXSTARTED_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_RXSTARTED_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable interrupt for RXSTARTED event
type INTENSET_RXSTARTED_Field_1 is
(-- Reset value for the field
Intenset_Rxstarted_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_RXSTARTED_Field_1 use
(Intenset_Rxstarted_Field_Reset => 0,
Set => 1);
-- Write '1' to Enable interrupt for TXSTARTED event
type INTENSET_TXSTARTED_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_TXSTARTED_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable interrupt for TXSTARTED event
type INTENSET_TXSTARTED_Field_1 is
(-- Reset value for the field
Intenset_Txstarted_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_TXSTARTED_Field_1 use
(Intenset_Txstarted_Field_Reset => 0,
Set => 1);
-- Write '1' to Enable interrupt for WRITE event
type INTENSET_WRITE_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_WRITE_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable interrupt for WRITE event
type INTENSET_WRITE_Field_1 is
(-- Reset value for the field
Intenset_Write_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_WRITE_Field_1 use
(Intenset_Write_Field_Reset => 0,
Set => 1);
-- Write '1' to Enable interrupt for READ event
type INTENSET_READ_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_READ_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable interrupt for READ event
type INTENSET_READ_Field_1 is
(-- Reset value for the field
Intenset_Read_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_READ_Field_1 use
(Intenset_Read_Field_Reset => 0,
Set => 1);
-- Enable interrupt
type INTENSET_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- Write '1' to Enable interrupt for STOPPED event
STOPPED : INTENSET_STOPPED_Field_1 :=
Intenset_Stopped_Field_Reset;
-- unspecified
Reserved_2_8 : HAL.UInt7 := 16#0#;
-- Write '1' to Enable interrupt for ERROR event
ERROR : INTENSET_ERROR_Field_1 := Intenset_Error_Field_Reset;
-- unspecified
Reserved_10_18 : HAL.UInt9 := 16#0#;
-- Write '1' to Enable interrupt for RXSTARTED event
RXSTARTED : INTENSET_RXSTARTED_Field_1 :=
Intenset_Rxstarted_Field_Reset;
-- Write '1' to Enable interrupt for TXSTARTED event
TXSTARTED : INTENSET_TXSTARTED_Field_1 :=
Intenset_Txstarted_Field_Reset;
-- unspecified
Reserved_21_24 : HAL.UInt4 := 16#0#;
-- Write '1' to Enable interrupt for WRITE event
WRITE : INTENSET_WRITE_Field_1 := Intenset_Write_Field_Reset;
-- Write '1' to Enable interrupt for READ event
READ : INTENSET_READ_Field_1 := Intenset_Read_Field_Reset;
-- unspecified
Reserved_27_31 : HAL.UInt5 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for INTENSET_Register use record
Reserved_0_0 at 0 range 0 .. 0;
STOPPED at 0 range 1 .. 1;
Reserved_2_8 at 0 range 2 .. 8;
ERROR at 0 range 9 .. 9;
Reserved_10_18 at 0 range 10 .. 18;
RXSTARTED at 0 range 19 .. 19;
TXSTARTED at 0 range 20 .. 20;
Reserved_21_24 at 0 range 21 .. 24;
WRITE at 0 range 25 .. 25;
READ at 0 range 26 .. 26;
Reserved_27_31 at 0 range 27 .. 31;
end record;
-- Write '1' to Disable interrupt for STOPPED event
type INTENCLR_STOPPED_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_STOPPED_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable interrupt for STOPPED event
type INTENCLR_STOPPED_Field_1 is
(-- Reset value for the field
Intenclr_Stopped_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_STOPPED_Field_1 use
(Intenclr_Stopped_Field_Reset => 0,
Clear => 1);
-- Write '1' to Disable interrupt for ERROR event
type INTENCLR_ERROR_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_ERROR_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable interrupt for ERROR event
type INTENCLR_ERROR_Field_1 is
(-- Reset value for the field
Intenclr_Error_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_ERROR_Field_1 use
(Intenclr_Error_Field_Reset => 0,
Clear => 1);
-- Write '1' to Disable interrupt for RXSTARTED event
type INTENCLR_RXSTARTED_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_RXSTARTED_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable interrupt for RXSTARTED event
type INTENCLR_RXSTARTED_Field_1 is
(-- Reset value for the field
Intenclr_Rxstarted_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_RXSTARTED_Field_1 use
(Intenclr_Rxstarted_Field_Reset => 0,
Clear => 1);
-- Write '1' to Disable interrupt for TXSTARTED event
type INTENCLR_TXSTARTED_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_TXSTARTED_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable interrupt for TXSTARTED event
type INTENCLR_TXSTARTED_Field_1 is
(-- Reset value for the field
Intenclr_Txstarted_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_TXSTARTED_Field_1 use
(Intenclr_Txstarted_Field_Reset => 0,
Clear => 1);
-- Write '1' to Disable interrupt for WRITE event
type INTENCLR_WRITE_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_WRITE_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable interrupt for WRITE event
type INTENCLR_WRITE_Field_1 is
(-- Reset value for the field
Intenclr_Write_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_WRITE_Field_1 use
(Intenclr_Write_Field_Reset => 0,
Clear => 1);
-- Write '1' to Disable interrupt for READ event
type INTENCLR_READ_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_READ_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable interrupt for READ event
type INTENCLR_READ_Field_1 is
(-- Reset value for the field
Intenclr_Read_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_READ_Field_1 use
(Intenclr_Read_Field_Reset => 0,
Clear => 1);
-- Disable interrupt
type INTENCLR_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- Write '1' to Disable interrupt for STOPPED event
STOPPED : INTENCLR_STOPPED_Field_1 :=
Intenclr_Stopped_Field_Reset;
-- unspecified
Reserved_2_8 : HAL.UInt7 := 16#0#;
-- Write '1' to Disable interrupt for ERROR event
ERROR : INTENCLR_ERROR_Field_1 := Intenclr_Error_Field_Reset;
-- unspecified
Reserved_10_18 : HAL.UInt9 := 16#0#;
-- Write '1' to Disable interrupt for RXSTARTED event
RXSTARTED : INTENCLR_RXSTARTED_Field_1 :=
Intenclr_Rxstarted_Field_Reset;
-- Write '1' to Disable interrupt for TXSTARTED event
TXSTARTED : INTENCLR_TXSTARTED_Field_1 :=
Intenclr_Txstarted_Field_Reset;
-- unspecified
Reserved_21_24 : HAL.UInt4 := 16#0#;
-- Write '1' to Disable interrupt for WRITE event
WRITE : INTENCLR_WRITE_Field_1 := Intenclr_Write_Field_Reset;
-- Write '1' to Disable interrupt for READ event
READ : INTENCLR_READ_Field_1 := Intenclr_Read_Field_Reset;
-- unspecified
Reserved_27_31 : HAL.UInt5 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for INTENCLR_Register use record
Reserved_0_0 at 0 range 0 .. 0;
STOPPED at 0 range 1 .. 1;
Reserved_2_8 at 0 range 2 .. 8;
ERROR at 0 range 9 .. 9;
Reserved_10_18 at 0 range 10 .. 18;
RXSTARTED at 0 range 19 .. 19;
TXSTARTED at 0 range 20 .. 20;
Reserved_21_24 at 0 range 21 .. 24;
WRITE at 0 range 25 .. 25;
READ at 0 range 26 .. 26;
Reserved_27_31 at 0 range 27 .. 31;
end record;
-- RX buffer overflow detected, and prevented
type ERRORSRC_OVERFLOW_Field is
(-- Error did not occur
Notdetected,
-- Error occurred
Detected)
with Size => 1;
for ERRORSRC_OVERFLOW_Field use
(Notdetected => 0,
Detected => 1);
-- NACK sent after receiving a data byte
type ERRORSRC_DNACK_Field is
(-- Error did not occur
Notreceived,
-- Error occurred
Received)
with Size => 1;
for ERRORSRC_DNACK_Field use
(Notreceived => 0,
Received => 1);
-- TX buffer over-read detected, and prevented
type ERRORSRC_OVERREAD_Field is
(-- Error did not occur
Notdetected,
-- Error occurred
Detected)
with Size => 1;
for ERRORSRC_OVERREAD_Field use
(Notdetected => 0,
Detected => 1);
-- Error source
type ERRORSRC_Register is record
-- RX buffer overflow detected, and prevented
OVERFLOW : ERRORSRC_OVERFLOW_Field := NRF_SVD.TWIS.Notdetected;
-- unspecified
Reserved_1_1 : HAL.Bit := 16#0#;
-- NACK sent after receiving a data byte
DNACK : ERRORSRC_DNACK_Field := NRF_SVD.TWIS.Notreceived;
-- TX buffer over-read detected, and prevented
OVERREAD : ERRORSRC_OVERREAD_Field := NRF_SVD.TWIS.Notdetected;
-- unspecified
Reserved_4_31 : HAL.UInt28 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for ERRORSRC_Register use record
OVERFLOW at 0 range 0 .. 0;
Reserved_1_1 at 0 range 1 .. 1;
DNACK at 0 range 2 .. 2;
OVERREAD at 0 range 3 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
-- Status register indicating which address had a match
type MATCH_Register is record
-- Read-only. Which of the addresses in {ADDRESS} matched the incoming
-- address
MATCH : Boolean;
-- unspecified
Reserved_1_31 : HAL.UInt31;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for MATCH_Register use record
MATCH at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-- Enable or disable TWIS
type ENABLE_ENABLE_Field is
(-- Disable TWIS
Disabled,
-- Enable TWIS
Enabled)
with Size => 4;
for ENABLE_ENABLE_Field use
(Disabled => 0,
Enabled => 9);
-- Enable TWIS
type ENABLE_Register is record
-- Enable or disable TWIS
ENABLE : ENABLE_ENABLE_Field := NRF_SVD.TWIS.Disabled;
-- unspecified
Reserved_4_31 : HAL.UInt28 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for ENABLE_Register use record
ENABLE at 0 range 0 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
-----------------------------------
-- TWIS_PSEL cluster's Registers --
-----------------------------------
subtype SCL_PSEL_PIN_Field is HAL.UInt5;
-- Connection
type SCL_CONNECT_Field is
(-- Connect
Connected,
-- Disconnect
Disconnected)
with Size => 1;
for SCL_CONNECT_Field use
(Connected => 0,
Disconnected => 1);
-- Pin select for SCL signal
type SCL_PSEL_Register is record
-- Pin number
PIN : SCL_PSEL_PIN_Field := 16#1F#;
-- unspecified
Reserved_5_30 : HAL.UInt26 := 16#3FFFFFF#;
-- Connection
CONNECT : SCL_CONNECT_Field := NRF_SVD.TWIS.Disconnected;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for SCL_PSEL_Register use record
PIN at 0 range 0 .. 4;
Reserved_5_30 at 0 range 5 .. 30;
CONNECT at 0 range 31 .. 31;
end record;
subtype SDA_PSEL_PIN_Field is HAL.UInt5;
-- Connection
type SDA_CONNECT_Field is
(-- Connect
Connected,
-- Disconnect
Disconnected)
with Size => 1;
for SDA_CONNECT_Field use
(Connected => 0,
Disconnected => 1);
-- Pin select for SDA signal
type SDA_PSEL_Register is record
-- Pin number
PIN : SDA_PSEL_PIN_Field := 16#1F#;
-- unspecified
Reserved_5_30 : HAL.UInt26 := 16#3FFFFFF#;
-- Connection
CONNECT : SDA_CONNECT_Field := NRF_SVD.TWIS.Disconnected;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for SDA_PSEL_Register use record
PIN at 0 range 0 .. 4;
Reserved_5_30 at 0 range 5 .. 30;
CONNECT at 0 range 31 .. 31;
end record;
-- Unspecified
type TWIS_PSEL_Cluster is record
-- Pin select for SCL signal
SCL : aliased SCL_PSEL_Register;
-- Pin select for SDA signal
SDA : aliased SDA_PSEL_Register;
end record
with Size => 64;
for TWIS_PSEL_Cluster use record
SCL at 16#0# range 0 .. 31;
SDA at 16#4# range 0 .. 31;
end record;
----------------------------------
-- TWIS_RXD cluster's Registers --
----------------------------------
subtype MAXCNT_RXD_MAXCNT_Field is HAL.UInt8;
-- Maximum number of bytes in RXD buffer
type MAXCNT_RXD_Register is record
-- Maximum number of bytes in RXD buffer
MAXCNT : MAXCNT_RXD_MAXCNT_Field := 16#0#;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for MAXCNT_RXD_Register use record
MAXCNT at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype AMOUNT_RXD_AMOUNT_Field is HAL.UInt8;
-- Number of bytes transferred in the last RXD transaction
type AMOUNT_RXD_Register is record
-- Read-only. Number of bytes transferred in the last RXD transaction
AMOUNT : AMOUNT_RXD_AMOUNT_Field;
-- unspecified
Reserved_8_31 : HAL.UInt24;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for AMOUNT_RXD_Register use record
AMOUNT at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- RXD EasyDMA channel
type TWIS_RXD_Cluster is record
-- RXD Data pointer
PTR : aliased HAL.UInt32;
-- Maximum number of bytes in RXD buffer
MAXCNT : aliased MAXCNT_RXD_Register;
-- Number of bytes transferred in the last RXD transaction
AMOUNT : aliased AMOUNT_RXD_Register;
end record
with Size => 96;
for TWIS_RXD_Cluster use record
PTR at 16#0# range 0 .. 31;
MAXCNT at 16#4# range 0 .. 31;
AMOUNT at 16#8# range 0 .. 31;
end record;
----------------------------------
-- TWIS_TXD cluster's Registers --
----------------------------------
subtype MAXCNT_TXD_MAXCNT_Field is HAL.UInt8;
-- Maximum number of bytes in TXD buffer
type MAXCNT_TXD_Register is record
-- Maximum number of bytes in TXD buffer
MAXCNT : MAXCNT_TXD_MAXCNT_Field := 16#0#;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for MAXCNT_TXD_Register use record
MAXCNT at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype AMOUNT_TXD_AMOUNT_Field is HAL.UInt8;
-- Number of bytes transferred in the last TXD transaction
type AMOUNT_TXD_Register is record
-- Read-only. Number of bytes transferred in the last TXD transaction
AMOUNT : AMOUNT_TXD_AMOUNT_Field;
-- unspecified
Reserved_8_31 : HAL.UInt24;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for AMOUNT_TXD_Register use record
AMOUNT at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- TXD EasyDMA channel
type TWIS_TXD_Cluster is record
-- TXD Data pointer
PTR : aliased HAL.UInt32;
-- Maximum number of bytes in TXD buffer
MAXCNT : aliased MAXCNT_TXD_Register;
-- Number of bytes transferred in the last TXD transaction
AMOUNT : aliased AMOUNT_TXD_Register;
end record
with Size => 96;
for TWIS_TXD_Cluster use record
PTR at 16#0# range 0 .. 31;
MAXCNT at 16#4# range 0 .. 31;
AMOUNT at 16#8# range 0 .. 31;
end record;
subtype ADDRESS_ADDRESS_Field is HAL.UInt7;
-- Description collection[0]: TWI slave address 0
type ADDRESS_Register is record
-- TWI slave address
ADDRESS : ADDRESS_ADDRESS_Field := 16#0#;
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for ADDRESS_Register use record
ADDRESS at 0 range 0 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-- Description collection[0]: TWI slave address 0
type ADDRESS_Registers is array (0 .. 1) of ADDRESS_Register;
-- Enable or disable address matching on ADDRESS[0]
type CONFIG_ADDRESS0_Field is
(-- Disabled
Disabled,
-- Enabled
Enabled)
with Size => 1;
for CONFIG_ADDRESS0_Field use
(Disabled => 0,
Enabled => 1);
-- CONFIG_ADDRESS array
type CONFIG_ADDRESS_Field_Array is array (0 .. 1) of CONFIG_ADDRESS0_Field
with Component_Size => 1, Size => 2;
-- Type definition for CONFIG_ADDRESS
type CONFIG_ADDRESS_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- ADDRESS as a value
Val : HAL.UInt2;
when True =>
-- ADDRESS as an array
Arr : CONFIG_ADDRESS_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for CONFIG_ADDRESS_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Configuration register for the address match mechanism
type CONFIG_Register is record
-- Enable or disable address matching on ADDRESS[0]
ADDRESS : CONFIG_ADDRESS_Field :=
(As_Array => False, Val => 16#1#);
-- unspecified
Reserved_2_31 : HAL.UInt30 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CONFIG_Register use record
ADDRESS at 0 range 0 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
subtype ORC_ORC_Field is HAL.UInt8;
-- Over-read character. Character sent out in case of an over-read of the
-- transmit buffer.
type ORC_Register is record
-- Over-read character. Character sent out in case of an over-read of
-- the transmit buffer.
ORC : ORC_ORC_Field := 16#0#;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for ORC_Register use record
ORC at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-----------------------------------
-- TWIS_PSEL cluster's Registers --
-----------------------------------
----------------------------------
-- TWIS_RXD cluster's Registers --
----------------------------------
----------------------------------
-- TWIS_TXD cluster's Registers --
----------------------------------
-----------------
-- Peripherals --
-----------------
-- I2C compatible Two-Wire Slave Interface with EasyDMA 0
type TWIS_Peripheral is record
-- Stop TWI transaction
TASKS_STOP : aliased HAL.UInt32;
-- Suspend TWI transaction
TASKS_SUSPEND : aliased HAL.UInt32;
-- Resume TWI transaction
TASKS_RESUME : aliased HAL.UInt32;
-- Prepare the TWI slave to respond to a write command
TASKS_PREPARERX : aliased HAL.UInt32;
-- Prepare the TWI slave to respond to a read command
TASKS_PREPARETX : aliased HAL.UInt32;
-- TWI stopped
EVENTS_STOPPED : aliased HAL.UInt32;
-- TWI error
EVENTS_ERROR : aliased HAL.UInt32;
-- Receive sequence started
EVENTS_RXSTARTED : aliased HAL.UInt32;
-- Transmit sequence started
EVENTS_TXSTARTED : aliased HAL.UInt32;
-- Write command received
EVENTS_WRITE : aliased HAL.UInt32;
-- Read command received
EVENTS_READ : aliased HAL.UInt32;
-- Shortcut register
SHORTS : aliased SHORTS_Register;
-- Enable or disable interrupt
INTEN : aliased INTEN_Register;
-- Enable interrupt
INTENSET : aliased INTENSET_Register;
-- Disable interrupt
INTENCLR : aliased INTENCLR_Register;
-- Error source
ERRORSRC : aliased ERRORSRC_Register;
-- Status register indicating which address had a match
MATCH : aliased MATCH_Register;
-- Enable TWIS
ENABLE : aliased ENABLE_Register;
-- Unspecified
PSEL : aliased TWIS_PSEL_Cluster;
-- RXD EasyDMA channel
RXD : aliased TWIS_RXD_Cluster;
-- TXD EasyDMA channel
TXD : aliased TWIS_TXD_Cluster;
-- Description collection[0]: TWI slave address 0
ADDRESS : aliased ADDRESS_Registers;
-- Configuration register for the address match mechanism
CONFIG : aliased CONFIG_Register;
-- Over-read character. Character sent out in case of an over-read of
-- the transmit buffer.
ORC : aliased ORC_Register;
end record
with Volatile;
for TWIS_Peripheral use record
TASKS_STOP at 16#14# range 0 .. 31;
TASKS_SUSPEND at 16#1C# range 0 .. 31;
TASKS_RESUME at 16#20# range 0 .. 31;
TASKS_PREPARERX at 16#30# range 0 .. 31;
TASKS_PREPARETX at 16#34# range 0 .. 31;
EVENTS_STOPPED at 16#104# range 0 .. 31;
EVENTS_ERROR at 16#124# range 0 .. 31;
EVENTS_RXSTARTED at 16#14C# range 0 .. 31;
EVENTS_TXSTARTED at 16#150# range 0 .. 31;
EVENTS_WRITE at 16#164# range 0 .. 31;
EVENTS_READ at 16#168# range 0 .. 31;
SHORTS at 16#200# range 0 .. 31;
INTEN at 16#300# range 0 .. 31;
INTENSET at 16#304# range 0 .. 31;
INTENCLR at 16#308# range 0 .. 31;
ERRORSRC at 16#4D0# range 0 .. 31;
MATCH at 16#4D4# range 0 .. 31;
ENABLE at 16#500# range 0 .. 31;
PSEL at 16#508# range 0 .. 63;
RXD at 16#534# range 0 .. 95;
TXD at 16#544# range 0 .. 95;
ADDRESS at 16#588# range 0 .. 63;
CONFIG at 16#594# range 0 .. 31;
ORC at 16#5C0# range 0 .. 31;
end record;
-- I2C compatible Two-Wire Slave Interface with EasyDMA 0
TWIS0_Periph : aliased TWIS_Peripheral
with Import, Address => TWIS0_Base;
-- I2C compatible Two-Wire Slave Interface with EasyDMA 1
TWIS1_Periph : aliased TWIS_Peripheral
with Import, Address => TWIS1_Base;
end NRF_SVD.TWIS;
|
programs/oeis/047/A047470.asm | neoneye/loda | 22 | 2575 | <filename>programs/oeis/047/A047470.asm
; A047470: Numbers that are congruent to {0, 3} mod 8.
; 0,3,8,11,16,19,24,27,32,35,40,43,48,51,56,59,64,67,72,75,80,83,88,91,96,99,104,107,112,115,120,123,128,131,136,139,144,147,152,155,160,163,168,171,176,179,184,187,192,195,200,203,208,211,216,219,224,227,232,235,240,243,248,251,256,259,264,267,272,275,280,283,288,291,296,299,304,307,312,315,320,323,328,331,336,339,344,347,352,355,360,363,368,371,376,379,384,387,392,395
mov $1,4
mul $1,$0
mod $0,2
sub $1,$0
mov $0,$1
|
oeis/280/A280294.asm | neoneye/loda-programs | 11 | 20480 | ; A280294: a(n) = a(n-1) + 2^n * a(n-2) with a(0) = 1 and a(1) = 1.
; Submitted by <NAME>
; 1,1,5,13,93,509,6461,71613,1725629,38391485,1805435581,80431196861,7475495336637,666367860021949,123144883455482557,21958686920654707389,8092381769059159562941,2886261393833112966453949,2124255587862077437434059453,1515356469237837208393642072765,2228958783767303548243249967061693,3180161808958836080805386510150326973,9352110904399295177691661696356877523645,26686482902830963313310403383835470925847229,156929071181965156407204700082089582770663119549
mov $1,1
mov $2,1
lpb $0
sub $0,1
mov $3,$2
mul $2,2
mul $3,$4
add $3,$4
mov $4,$1
add $1,$3
add $2,1
lpe
mov $0,$1
|
Transynther/x86/_processed/NONE/_ht_zr_un_/i9-9900K_12_0xa0.log_21829_179.asm | ljhsiun2/medusa | 9 | 100482 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %r14
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0xd8a8, %rsi
lea addresses_UC_ht+0x1e8a8, %rdi
nop
nop
nop
nop
and $3098, %r14
mov $123, %rcx
rep movsq
nop
nop
xor $47154, %rdi
lea addresses_WC_ht+0x16028, %rsi
lea addresses_normal_ht+0xd788, %rdi
clflush (%rsi)
nop
nop
nop
mfence
mov $63, %rcx
rep movsq
nop
nop
nop
nop
nop
add $46886, %rcx
lea addresses_normal_ht+0x4b90, %rax
cmp %r13, %r13
mov (%rax), %r11
nop
nop
nop
sub $51250, %rax
lea addresses_A_ht+0x78c8, %rsi
lea addresses_UC_ht+0x8648, %rdi
nop
nop
xor $53932, %r10
mov $38, %rcx
rep movsw
nop
sub %rcx, %rcx
lea addresses_WC_ht+0xa4c8, %rsi
lea addresses_UC_ht+0x11100, %rdi
clflush (%rdi)
sub %rax, %rax
mov $56, %rcx
rep movsq
cmp $34831, %r10
lea addresses_A_ht+0x1a0a8, %rsi
lea addresses_WT_ht+0x184a8, %rdi
sub $20874, %r11
mov $114, %rcx
rep movsq
nop
nop
nop
nop
nop
sub $17251, %rcx
lea addresses_WC_ht+0x4684, %rsi
lea addresses_normal_ht+0x19468, %rdi
and $44881, %r13
mov $54, %rcx
rep movsl
nop
nop
nop
add %rdi, %rdi
lea addresses_UC_ht+0x13b20, %r10
nop
cmp $50819, %r14
mov (%r10), %edi
nop
dec %rdi
lea addresses_A_ht+0xe8a8, %rsi
lea addresses_WC_ht+0x138a8, %rdi
nop
nop
cmp $6077, %r10
mov $114, %rcx
rep movsq
nop
nop
nop
sub $28940, %r10
lea addresses_A_ht+0x16bd8, %rsi
lea addresses_D_ht+0x110d0, %rdi
nop
nop
nop
nop
nop
dec %r13
mov $23, %rcx
rep movsb
dec %rax
lea addresses_UC_ht+0x1d140, %rsi
lea addresses_D_ht+0x120a8, %rdi
nop
nop
nop
nop
inc %r14
mov $63, %rcx
rep movsl
nop
nop
nop
nop
nop
add $24778, %rax
lea addresses_A_ht+0x7af8, %rax
nop
nop
nop
nop
nop
xor $33853, %rcx
movb $0x61, (%rax)
nop
nop
nop
nop
nop
xor %rsi, %rsi
lea addresses_UC_ht+0x68f4, %r14
nop
nop
nop
xor %rsi, %rsi
vmovups (%r14), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $0, %xmm7, %rdi
nop
nop
nop
nop
dec %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r14
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r15
push %rax
push %rcx
push %rsi
// Faulty Load
lea addresses_WC+0x18a8, %rsi
nop
nop
nop
nop
nop
and $48637, %rax
vmovups (%rsi), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $1, %xmm5, %r12
lea oracles, %rsi
and $0xff, %r12
shlq $12, %r12
mov (%rsi,%r12,1), %r12
pop %rsi
pop %rcx
pop %rax
pop %r15
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_WC', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_WC', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 6, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}}
{'src': {'same': True, 'congruent': 7, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_normal_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 2, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_UC_ht'}}
{'src': {'same': False, 'congruent': 5, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_UC_ht'}}
{'src': {'same': False, 'congruent': 11, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 4, 'type': 'addresses_WT_ht'}}
{'src': {'same': False, 'congruent': 0, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'src': {'same': True, 'congruent': 10, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_WC_ht'}}
{'src': {'same': False, 'congruent': 2, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_D_ht'}}
{'src': {'same': False, 'congruent': 2, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_D_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 4, 'type': 'addresses_A_ht', 'AVXalign': True, 'size': 1}}
{'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'48': 1779, '49': 3812, '00': 11036, '45': 4796, '47': 401, 'bc': 1, '08': 3, 'fa': 1}
49 00 49 47 00 00 45 00 48 49 49 00 00 45 45 45 00 00 00 47 49 00 00 45 45 00 00 00 48 49 47 00 00 45 00 00 49 00 00 00 45 00 49 00 00 45 00 00 49 49 00 00 45 45 00 00 00 48 49 49 00 00 45 45 00 00 00 49 00 48 45 45 00 48 49 49 00 00 45 00 00 48 49 49 00 45 45 00 00 48 49 00 00 48 45 00 00 48 49 00 45 45 45 00 00 49 49 49 00 45 45 00 48 00 49 00 45 45 00 48 49 47 00 00 45 00 00 48 49 00 00 00 45 00 00 00 49 00 00 00 45 45 00 00 00 48 00 49 00 48 45 00 48 49 49 00 00 45 45 00 00 00 48 49 00 00 00 45 00 00 00 49 00 00 00 45 00 48 49 49 00 00 45 45 00 00 45 48 49 00 00 48 45 00 00 00 49 00 45 45 00 49 49 00 00 45 45 00 00 45 00 49 00 00 45 45 00 48 49 00 48 45 45 00 45 49 49 00 00 45 45 00 45 00 49 00 00 00 45 00 00 49 49 00 00 45 45 00 00 00 00 49 47 00 00 45 45 00 48 49 00 00 45 00 00 49 49 00 00 45 45 00 00 00 48 49 47 00 00 45 00 48 49 00 00 45 45 00 45 00 49 00 00 45 45 00 49 49 00 00 45 45 00 45 00 49 47 00 00 45 45 00 00 00 00 49 47 00 00 45 45 00 00 48 49 47 00 45 45 45 00 00 45 00 49 00 00 45 45 00 45 49 49 45 00 45 00 00 00 49 49 00 00 45 00 00 00 48 49 47 00 00 45 45 00 00 00 49 47 00 00 45 45 00 00 00 49 00 00 00 45 00 45 49 49 00 00 00 45 00 48 49 00 48 45 00 00 00 49 00 00 45 45 00 48 49 00 00 45 45 45 00 00 49 47 00 00 45 00 00 49 49 00 00 45 00 00 49 47 00 48 45 00 00 48 49 00 00 45 45 00 48 00 49 00 00 45 45 00 48 49 00 00 00 45 00 00 00 49 00 00 45 45 00 48 49 49 00 00 45 00 45 00 49 00 00 00 45 00 00 48 49 00 00 00 45 00 00 49 49 00 45 45 00 00 00 48 49 00 45 45 00 00 49 49 00 00 45 45 00 49 00 45 45 00 00 49 49 00 00 45 45 00 00 48 49 47 00 48 45 00 00 00 49 00 00 00 45 45 00 48 49 49 00 45 45 00 00 00 48 49 49 00 00 45 45 00 00 49 00 00 00 45 00 00 00 49 00 48 45 00 48 49 49 00 45 45 00 00 00 00 49 00 00 00 45 00 00 48 49 00 48 45 45 00 00 49 49 00 00 45 45 00 00 00 00 49 47 00 00 45 45 00 00 00 00 49 00 00 00 45 45 00 48 49 00 00 45 45 00 00 49 00 00 45 45 00 48 49 00 00 00 45 00 45 00 49 00 48 00 45 00 00 49 49 00 00 45 45 00 00 00 48 49 00 48 45 00 00 49 49 00 00 45 45 00 49 49 00 00 45 45 00 00 49 49 00 00 45 45 00 00 00 49 00 00 48 45 00 45 49 49 00 00 45 00 00 49 00 48 45 45 00 48 49 49 00 00 45 00 00 00 49 00 00 48 45 45 00 48 49 00 00 00 45 45 00 00 00 49 00 00 00 45 00 00 48 49 00 48 00 45 00 00 00 49 49 00 45 00 49 49 00 00 45 45 45 00 00 49 00 00 45 45 00 00 00 47 00 00 00 45 00 00 49 49 00 00 45 45 00 00 00 49 49 00 00 45 45 00 00 00 49 47 00 00 45 45 00 00 49 00 00 45 00 00 00 49 00 00 00 45 00 00 48 49 00 00 45 45 00 47 00 48 45 00 00 00 49 00 00 00 45 00 00 00 49 49 00 48 45 00 00 00 49 49 00 45 45 00 00 00 49 49 47 00 45 45 00 48 49 47 00 45 45 00 48 48 49 49 00 00 45 00 49 49 00 45 45 00 45 00 49 00 45 45 45 00 48 49 49 00 45 45 00 48 00 49 00 00 00 45 00 00 00 47 00 48 00 48 49 49 00 00 45 45 00 00 00 49 00 00 00 45 00 00 48 49 00 48 45 45 00 49 47 00 48 45 00 00 00 49 00 00 45 45 00 48 49 49 00 00 45 45 00 00 00 00 49 47 00 00 45 45 00 48 49 00 00 00 45 45 00 00 48 49 00 00 45 45 00 48 49 49 00 00 45 00 00 49
*/
|
src/helios-monitor.ads | stcarrez/helios | 1 | 13779 | -----------------------------------------------------------------------
-- helios-monitor -- Helios monitor
-- Copyright (C) 2017 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Finalization;
with Ada.Real_Time;
with Util.Properties;
with Util.Events.Timers;
with Helios.Schemas;
with Helios.Datas;
package Helios.Monitor is
type Agent_Type;
type Agent_Type_Access is access all Agent_Type'Class;
type Agent_Type is new Ada.Finalization.Limited_Controlled
and Util.Events.Timers.Timer with record
Next : Agent_Type_Access;
Index : Helios.Schemas.Monitor_Index;
Node : Schemas.Definition_Type_Access;
Period : Ada.Real_Time.Time_Span;
Data : Helios.Datas.Snapshot_Queue_Type;
end record;
-- The timer handler executed when the timer deadline has passed.
overriding
procedure Time_Handler (Agent : in out Agent_Type;
Event : in out Util.Events.Timers.Timer_Ref'Class);
-- Create a new definition with the given name. The filter parameter allows to control
-- which definition values are really needed. The "*" indicates that all values are required.
-- Otherwise, it is a comma separated list of strings. A null definition is returned if
-- the filter does not contain the definition name.
function Create_Definition (Agent : in Agent_Type;
Name : in String;
Filter : in String := "*") return Schemas.Definition_Type_Access;
-- Add a definition to the agent.
procedure Add_Definition (Agent : in out Agent_Type;
Def : in Schemas.Definition_Type_Access);
-- Find a child definition with the given name.
-- Returns null if there is no such definition.
function Find_Definition (Agent : in Agent_Type;
Name : in String) return Schemas.Definition_Type_Access;
-- Register the agent.
procedure Register (Agent : in Agent_Type_Access;
Name : in String;
Config : in Util.Properties.Manager);
-- Start the agent and build the definition tree.
procedure Start (Agent : in out Agent_Type;
Config : in Util.Properties.Manager) is null;
-- Collect the values in the snapshot.
procedure Collect (Agent : in out Agent_Type;
Values : in out Datas.Snapshot_Type) is null;
-- Get a period configuration parameter.
function Get_Period (Config : in Util.Properties.Manager;
Name : in String;
Default : in Natural) return Ada.Real_Time.Time_Span;
-- Get the current report and prepare the plugin agents for a new snapshot.
function Get_Report return Helios.Datas.Report_Queue_Type;
private
-- Iterate over the plugin agents that are registered and execute
-- the <tt>Process</tt> procedure.
procedure Iterate (Process : not null access procedure (Agent : in out Agent_Type'Class));
end Helios.Monitor;
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/ce/ce2102a.ada | best08618/asylo | 7 | 18463 | -- CE2102A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK TO SEE THAT STATUS_ERROR IS RAISED WHEN PERFORMING ILLEGAL
-- OPERATIONS ON OPENED OR UNOPENED FILES OF TYPE SEQUENTIAL_IO.
-- A) OPENED FILES
-- APPLICABILITY CRITERIA:
-- THIS TEST IS APPLICABLE ONLY TO IMPLEMENTATIONS WHICH SUPPORT
-- CREATE WITH OUT_FILE MODE FOR SEQUENTIAL FILES.
-- HISTORY:
-- DLD 08/10/82
-- JBG 02/22/84
-- SPW 07/29/87 SPLIT CASE FOR UNOPENED FILES INTO CE2102L.ADA.
WITH REPORT; USE REPORT;
WITH SEQUENTIAL_IO;
PROCEDURE CE2102A IS
PACKAGE SEQ_IO IS NEW SEQUENTIAL_IO(INTEGER);
USE SEQ_IO;
TEST_FILE_ONE : SEQ_IO.FILE_TYPE;
BEGIN
TEST ("CE2102A", "CHECK THAT STATUS_ERROR IS RAISED WHEN " &
"PERFORMING ILLEGAL OPERATIONS ON OPENED FILES " &
"OF TYPE SEQUENTIAL_IO");
BEGIN
CREATE (TEST_FILE_ONE, OUT_FILE, LEGAL_FILE_NAME);
-- CHECK THAT OPEN STATEMENT RAISES EXCEPTION WHEN FILE IS ALREADY OPEN
BEGIN
OPEN (TEST_FILE_ONE, OUT_FILE, LEGAL_FILE_NAME);
FAILED ("STATUS_ERROR NOT RAISED WHEN FILE IS " &
"ALREADY OPEN - 1");
EXCEPTION
WHEN STATUS_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED ON OPEN - 1");
END;
BEGIN
OPEN (TEST_FILE_ONE, IN_FILE, LEGAL_FILE_NAME);
FAILED ("STATUS_ERROR NOT RAISED WHEN FILE IS " &
"ALREADY OPEN - 2");
EXCEPTION
WHEN STATUS_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED ON OPEN - 2");
END;
-- CHECK THAT CREATE STATEMENT RAISES EXCEPTION WHEN FILE
-- IS ALREADY OPEN
BEGIN
CREATE (TEST_FILE_ONE, IN_FILE, LEGAL_FILE_NAME);
FAILED ("STATUS_ERROR NOT RAISED WHEN AN OPEN " &
"FILE IS USED IN A CREATE - 1");
EXCEPTION
WHEN STATUS_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED ON CREATE - 1");
END;
BEGIN
CREATE (TEST_FILE_ONE, OUT_FILE, LEGAL_FILE_NAME);
FAILED ("STATUS_ERROR NOT RAISED WHEN AN OPEN " &
"FILE IS USED IN A CREATE - 2");
EXCEPTION
WHEN STATUS_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED ON CREATE - 2");
END;
--DELETE TEST FILE
BEGIN
DELETE (TEST_FILE_ONE);
EXCEPTION
WHEN USE_ERROR =>
COMMENT ("DELETION OF EXTERNAL FILE APPEARS NOT " &
"TO BE SUPPORTED");
WHEN OTHERS =>
FAILED ("UNEXPECTED EXCEPTION RAISED " &
"FOR DELETE");
END;
EXCEPTION
WHEN USE_ERROR =>
NOT_APPLICABLE ("USE_ERROR RAISED FOR CREATE " &
"WITH OUT_FILE MODE");
WHEN NAME_ERROR =>
NOT_APPLICABLE ("NAME_ERROR RAISED FOR CREATE " &
"WITH OUT_FILE MODE");
WHEN OTHERS =>
FAILED ("OTHER EXCEPTION RAISED FOR CREATE");
END;
RESULT;
END CE2102A;
|
libsrc/stdio/__scanf_handle_s.asm | jpoikela/z88dk | 38 | 173512 |
MODULE __scanf_handle_s
SECTION code_clib
PUBLIC __scanf_handle_s
EXTERN __scanf_common_start
EXTERN __scanf_nextarg
EXTERN __scanf_consume_whitespace
EXTERN scanf_exit
EXTERN __scanf_ungetchar
EXTERN __scanf_getchar
EXTERN scanf_loop
EXTERN asm_isspace
__scanf_handle_s:
bit 3,(ix-3)
call z,__scanf_nextarg ;de=destination
ld b,(ix-4) ;b=width
scanf_fmt_s_width_specified:
call __scanf_consume_whitespace
jp c,scanf_exit
call __scanf_getchar
jr nc,scanf_fmt_s_join
jp scanf_exit
scanf_fmt_s_loop:
call __scanf_getchar
jr c,scanf_fmt_s_done
call asm_isspace
jr nc,scanf_fmt_s_success
scanf_fmt_s_join:
bit 3,(ix-3) ;we're not setting
jr nz,scanf_fmt_s_suppress
ld (de),a
inc de
scanf_fmt_s_suppress:
bit 2,(ix-3) ;if no width specifier just loop
jr z,scanf_fmt_s_loop
djnz scanf_fmt_s_loop
scanf_fmt_s_done:
xor a
bit 3,(ix-1) ;suppress setting
jp nz,scanf_loop
ld (de),a ;terminating \0
inc (ix-1) ;increase number of conversions done
jp scanf_loop
scanf_fmt_s_success:
call __scanf_ungetchar
jr scanf_fmt_s_done
|
Appl/FileMgrs2/CommonDesktop/CFolder/cfolderCursor.asm | steakknife/pcgeos | 504 | 162852 | COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1992 -- All Rights Reserved
PROJECT: PC GEOS
MODULE:
FILE: cfolderCursor.asm
AUTHOR: <NAME>
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
cdb 7/13/92 Initial version.
DESCRIPTION:
Routines for drawing the "cursor"
$Id: cfolderCursor.asm,v 1.3 98/06/03 13:26:44 joon Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CURSOR_MARGIN equ 3
FolderCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SetCursor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set the cursor
CALLED BY:
PASS: *ds:si - FolderClass object
es:di - FolderRecord to make cursor, or di = NIL to
set none
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
cdb 7/13/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SetCursor proc far
class FolderClass
;
; no cursor for ZMGR - brianc 7/15/93
;
if not _ZMGR
uses ax,bx,cx,dx,di
.enter
DerefFolderObject ds, si, bx
cmp di, ds:[bx].FOI_cursor
je done
test ds:[bx].FOI_folderState, mask FOS_UPDATE_PENDING
jnz noOld
pushf
call FolderDrawCursor ; erase the old
popf
noOld:
mov ds:[bx].FOI_cursor, di
jnz done
call FolderDrawCursor ; draw the new
done:
.leave
endif
ret
SetCursor endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FolderDrawCursor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Draw or erase the current cursor
CALLED BY: UTILITY -
FolderLockAndDrawCursor,
SetCursor,
FolderRepositionSingleIcon
PASS: *ds:si - FolderClass object
es - segment of FolderBuffer
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
Can either "draw" or "erase" the current cursor, so be
careful...
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
cdb 7/13/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FolderDrawCursor proc far
class FolderClass
uses ax,bx,cx,dx,bp,di
.enter
DerefFolderObject ds, si, bx
mov di, ds:[bx].DVI_gState
tst di
jz done
mov bp, ds:[bx].FOI_cursor
cmp bp, NIL
je done
call FolderDrawCursorLow
done:
.leave
ret
FolderDrawCursor endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FolderLockAndDrawCursor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Lock the FolderRecord block and draw the cursor
CALLED BY: FolderTargetCommon
PASS: *ds:si - FolderClass object
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
cdb 7/17/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FolderLockAndDrawCursor proc near
uses ax, bx, si
class FolderClass
.enter
call FolderLockBuffer
jz done
call FolderDrawCursor
call FolderUnlockBuffer
done:
.leave
ret
FolderLockAndDrawCursor endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FolderDrawCursorLow
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Actual routine to draw or erase the cursor
CALLED BY: FolderLockAndDrawCursor
PASS: *ds:si - FolderClass object
es:bp - FolderRecord
di - gstate handle
RETURN: nothing
DESTROYED: ax,bx,cx,dx
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
cdb 7/13/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FolderDrawCursorLow proc near
class FolderClass
EC < xchg di, bp >
EC < call ECCheckFolderRecordESDI >
EC < xchg di, bp >
mov al, MM_INVERT ; set invert draw mode
call GrSetMixMode
mov al, SDM_50
call GrSetLineMask
mov bx, ds:[si]
test ds:[bx].FOI_displayMode, mask FIDM_LICON or mask FIDM_SICON
jz notIconMode
if _NEWDESK
call LoadNameBounds
else
call LoadIconBounds
endif
sub ax, 2
sub bx, 2
inc cx
inc dx
jmp drawCursor
notIconMode:
call LoadBoundBox
drawCursor:
call GrDrawRect
mov al, SDM_100
call GrSetLineMask
mov al, MM_COPY ; restore draw mode
call GrSetMixMode
ret
FolderDrawCursorLow endp
FolderCode ends
|
oeis/040/A040378.asm | neoneye/loda-programs | 11 | 6740 | ; A040378: Continued fraction for sqrt(398).
; Submitted by <NAME>(s3)
; 19,1,18,1,38,1,18,1,38,1,18,1,38,1,18,1,38,1,18,1,38,1,18,1,38,1,18,1,38,1,18,1,38,1,18,1,38,1,18,1,38,1,18,1,38,1,18,1,38,1,18,1,38,1,18,1,38,1,18,1,38,1,18,1,38,1,18,1,38,1,18,1,38,1,18
gcd $0,262156
mul $0,42
mod $0,13
mov $1,$0
div $1,5
mul $1,14
add $0,$1
sub $0,2
|
Lab3/Lab33.asm | siwasilp/Micro | 0 | 5411 | <reponame>siwasilp/Micro
;Lab33.asm
ORG 0000H ;1
START33: MOV A,R0 ;2
MOV A,R1 ;3
MOV A,R2 ;4
MOV A,R3 ;5
MOV A,R4 ;6
MOV A,R5 ;7
MOV A,R6 ;8
MOV A,R7 ;9
MOV R0,A ;10
JMP $ ;11
END ;12 |
A3 - Estruturas de fluxo/add2c.asm | ZePaiva/ACI | 0 | 81987 | <filename>A3 - Estruturas de fluxo/add2c.asm
.data
str1: .asciiz "Introduza dois numeros:\n"
str2: .asciiz "num1: "
str3: .asciiz "num2: "
str4: .asciiz "Resultado: "
.eqv print_str, 4
.eqv read_int, 5
.eqv print_int10, 1
.eqv i, $t0
.eqv res, $t1
.eqv mdo, $t2
.eqv mdor, $t3
.eqv func, $v0
.eqv arg1, $a0
.text
.globl main
main:
# nao deixar lixo
li i, 0
li res, 0
li mdor, 0
li mdo, 0
# print string 1
li func, print_str
la arg1, str1
syscall
# read int mdor and apply 0x0f bitwise and
li func, print_str
la arg1, str2
syscall
li func, read_int
syscall
move mdor, func
# read int mdo and apply 0x0f bitwise and
li func, print_str
la arg1, str3
syscall
li func, read_int
syscall
move mdo, func
while: # while cycle to calculate result
beq mdor, 0, endWhile
bge i, 16, endWhile
addi i, i, 1
andi $t4, mdor, 0x1
beq $t4, $0, else
addu res, res, mdo
else: # if mdor last bit != 0
sll mdo, mdo, 4
srl mdor,mdor, 4
j while
endWhile: # after cycle
# cast string
li func, print_str
la arg1, str4
syscall
# show result
li func, print_int10
or arg1, res, $0
syscall
jr $ra |
.emacs.d/elpa/wisi-3.1.3/wisitoken-bnf-output_ada_common.ads | caqg/linux-home | 0 | 30596 | -- Abstract :
--
-- Types and operations shared by Ada and Ada_Emacs outputs.
--
-- Copyright (C) 2017, 2018 Free Software Foundation, Inc.
--
-- This library is free software; you can redistribute it and/or modify it
-- under terms of the GNU General Public License as published by the Free
-- Software Foundation; either version 3, or (at your option) any later
-- version. This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-- As a special exception under Section 7 of GPL version 3, you are granted
-- additional permissions described in the GCC Runtime Library Exception,
-- version 3.1, as published by the Free Software Foundation.
pragma License (Modified_GPL);
with WisiToken.BNF.Generate_Utils;
with WisiToken.Generate.Packrat;
with WisiToken_Grammar_Runtime;
package WisiToken.BNF.Output_Ada_Common is
function To_Token_Ada_Name (WY_Name : in String) return String;
type Common_Data is limited record
-- Validated versions of Tuple values
Generate_Algorithm : WisiToken.BNF.Valid_Generate_Algorithm;
Lexer : Lexer_Type; -- 'none' valid for Libadalang
Output_Language : Ada_Output_Language;
Interface_Kind : Valid_Interface;
Text_Rep : Boolean;
Lower_File_Name_Root : Standard.Ada.Strings.Unbounded.Unbounded_String;
end record;
function Initialize
(Input_Data : in WisiToken_Grammar_Runtime.User_Data_Type;
Tuple : in Generate_Tuple;
Output_File_Root : in String;
Check_Interface : in Boolean)
return Common_Data;
function File_Name_To_Ada (File_Name : in String) return String;
procedure Create_Ada_Actions_Spec
(Output_File_Name : in String;
Package_Name : in String;
Input_Data : in WisiToken_Grammar_Runtime.User_Data_Type;
Common_Data : in Output_Ada_Common.Common_Data;
Generate_Data : aliased in WisiToken.BNF.Generate_Utils.Generate_Data);
procedure Create_Ada_Main_Spec
(Output_File_Name : in String;
Main_Package_Name : in String;
Input_Data : in WisiToken_Grammar_Runtime.User_Data_Type;
Common_Data : in Output_Ada_Common.Common_Data)
with Pre => Common_Data.Generate_Algorithm /= External;
procedure Create_External_Main_Spec
(Main_Package_Name : in String;
Tuple : in Generate_Tuple;
Input_Data : in WisiToken_Grammar_Runtime.User_Data_Type);
procedure LR_Create_Create_Parser
(Input_Data : in WisiToken_Grammar_Runtime.User_Data_Type;
Common_Data : in out Output_Ada_Common.Common_Data;
Generate_Data : aliased in WisiToken.BNF.Generate_Utils.Generate_Data);
-- If not Common_Data.Text_Rep, includes LR parse table in generated
-- source. Otherwise, includes call to LR.Get_Text_Rep; caller must
-- call Put_Text_Rep to create file.
procedure Packrat_Create_Create_Parser
(Common_Data : in out Output_Ada_Common.Common_Data;
Generate_Data : aliased in WisiToken.BNF.Generate_Utils.Generate_Data;
Packrat_Data : in WisiToken.Generate.Packrat.Data);
procedure External_Create_Create_Grammar
(Generate_Data : in WisiToken.BNF.Generate_Utils.Generate_Data);
procedure Create_re2c
(Input_Data : in WisiToken_Grammar_Runtime.User_Data_Type;
Tuple : in Generate_Tuple;
Generate_Data : aliased in WisiToken.BNF.Generate_Utils.Generate_Data;
Output_File_Name_Root : in String);
-- Create_re2c is called from wisitoken-bnf-generate, which does not declare
-- Common_Data.
end WisiToken.BNF.Output_Ada_Common;
|
core/lib/groups/Unit.agda | mikeshulman/HoTT-Agda | 0 | 9244 | {-# OPTIONS --without-K --rewriting #-}
open import lib.Basics
open import lib.types.Group
open import lib.types.Unit
open import lib.groups.SubgroupProp
open import lib.groups.Homomorphism
open import lib.groups.Isomorphism
open import lib.groups.Lift
module lib.groups.Unit where
Unit-group-structure : GroupStructure Unit
Unit-group-structure = record
{ ident = unit
; inv = λ _ → unit
; comp = λ _ _ → unit
; unit-l = λ _ → idp
; assoc = λ _ _ _ → idp
; inv-l = λ _ → idp
}
Unit-group : Group lzero
Unit-group = group _ Unit-is-set Unit-group-structure
0ᴳ = Unit-group
abstract
Unit-group-is-trivial : is-trivialᴳ Unit-group
Unit-group-is-trivial = λ _ → idp
iso-Unit-is-trivial : ∀ {i} {G : Group i} → G ≃ᴳ Unit-group → is-trivialᴳ G
iso-Unit-is-trivial G-iso-0 = iso-preserves'-trivial G-iso-0 Unit-group-is-trivial
0ᴳ-is-trivial = Unit-group-is-trivial
iso-0ᴳ-is-trivial = iso-Unit-is-trivial
trivial-iso-Unit : ∀ {i} {G : Group i} → is-trivialᴳ G → G ≃ᴳ Unit-group
trivial-iso-Unit {G = G} G-triv = group-hom (λ _ → tt) (λ _ _ → idp) ,
is-eq _ (λ _ → Group.ident G) (λ _ → idp) (λ _ → ! (G-triv _))
trivial-iso-0ᴳ = trivial-iso-Unit
{- the following should be replaced by [is-trivial] completely -}
abstract
contr-iso-Unit : ∀ {i} (G : Group i) → is-contr (Group.El G) → G ≃ᴳ Unit-group
contr-iso-Unit G pA = ≃-to-≃ᴳ (contr-equiv-Unit pA) (λ _ _ → idp)
contr-iso-0ᴳ = contr-iso-Unit
Unit-group-is-abelian : is-abelian 0ᴳ
Unit-group-is-abelian _ _ = idp
0ᴳ-is-abelian = Unit-group-is-abelian
Unit-abgroup : AbGroup₀
Unit-abgroup = Unit-group , Unit-group-is-abelian
0ᴳ-abgroup = Unit-abgroup
abstract
hom₁-Unit-is-trivial : ∀ {i} (G : AbGroup i) → is-trivialᴳ (hom-group Unit-group G)
hom₁-Unit-is-trivial G φ = group-hom= $ λ= λ _ → GroupHom.pres-ident φ
hom₁-0ᴳ-is-trivial = hom₁-Unit-is-trivial
|
code/6502/tests/tms/tms9918mctest.asm | visrealm/hbc-56 | 65 | 247625 | <filename>code/6502/tests/tms/tms9918mctest.asm<gh_stars>10-100
; Troy's HBC-56 - TMS9918 Multicolor mode test
;
; Copyright (c) 2021 <NAME>
;
; This code is licensed under the MIT license
;
; https://github.com/visrealm/hbc-56
;
!src "hbc56kernel.inc"
hbc56Meta:
+setHbcMetaTitle "TMS MULTICOLOR"
+setHbcMetaNES
rts
hbc56Main:
sei
jsr tmsModeMulticolor
+tmsColorFgBg TMS_WHITE, TMS_BLACK
jsr tmsSetBackground
+tmsSetAddrNameTable
+tmsSendData TMS_NAME_DATA, $300
+tmsEnableOutput
+tmsEnableInterrupts
loop:
sei
+tmsSetAddrPattTable
+tmsSendData TMS_BIRD_DATA, $800
cli
jsr medDelay
jsr medDelay
jsr medDelay
jsr medDelay
sei
+tmsSetAddrPattTable
+tmsSendData TMS_PATTERN_DATA, $800
cli
jsr medDelay
jsr medDelay
jsr medDelay
jsr medDelay
jmp loop
medDelay:
jsr delay
jsr delay
jsr delay
jsr delay
delay:
ldy #0
customDelay:
ldx #0
-
dex
bne -
ldx #0
dey
bne -
rts
TMS_NAME_DATA:
!for .y, 0, 23 {
!for .x, 0, 31 {
!byte .x + ((.y & $fc) << 3)
}
}
TMS_BIRD_DATA:
!bin "bird.bin"
TMS_PATTERN_DATA:
!bin "mcmode.bin"
|
libsrc/stdio/ansi/ticalc/f_ansi_scrollup.asm | grancier/z180 | 0 | 81976 | ;
; ANSI Video handling for the TI calculators
; By <NAME> - Dec. 2000
;
; Scrollup
;
;
; $Id: f_ansi_scrollup.asm,v 1.8 2016/06/12 16:06:43 dom Exp $
;
INCLUDE "stdio/ansi/ticalc/ticalc.inc"
SECTION code_clib
PUBLIC ansi_SCROLLUP
EXTERN base_graphics
EXTERN tidi
EXTERN tiei
EXTERN ansi_del_line
EXTERN fgetc_cons
.ansi_SCROLLUP
; These are called before scrolling: we wait for any keypress.
; We don't use getkey when possible.
call tiei
IF FORti82
.kloop
ld hl,$8004
bit 2,(hl)
jr z,kloop
ENDIF
IF FORti83 ; Thanks to <NAME> (<NAME>) for his dirinput.inc
; We use getkey to wait for a key
.kloop
ld hl,krowptr
.kloop1
ld a,$ff ; Reset the keyport (kinda)
out (1),a
ld a,(hl)
and a
jr z,kloop
out (1),a
in a,(1)
cp 255
jr nz,kok
inc hl
jr kloop1
.krowptr
defb $fe
defb $fd
defb $fb
defb $f7
defb $ef
defb $df
defb $bf
defb 0
.kok
ENDIF
IF FORti83p
.kloop
ld a,($843F) ; Keyboard ScanCODE address
and a
jr z,kloop
ENDIF
IF FORti85
.kloop
ld a,($8001)
and a
jr z,kloop
ENDIF
IF FORti86
; We use getkey to wait for a key
.kloop
call getkey
and a
jr z,kloop
ENDIF
call tidi
ld hl,8*row_bytes
ld de,(base_graphics)
add hl,de
ld bc,row_bytes*8*7
ldir
ld a,7
jp ansi_del_line
|
engine/events/hidden_objects/bench_guys.asm | opiter09/ASM-Machina | 1 | 102732 | PrintBenchGuyText:
call EnableAutoTextBoxDrawing
ld hl, BenchGuyTextPointers
ld a, [wCurMap]
ld b, a
.loop
ld a, [hli]
cp -1
ret z
cp b
jr z, .match
inc hl
inc hl
jr .loop
.match
ld a, [hli]
ld b, a
ld a, [wSpritePlayerStateData1FacingDirection]
cp b
jr nz, .loop ; player isn't facing the bench guy
ld a, [hl]
jp PrintPredefTextID
INCLUDE "data/events/bench_guys.asm"
ViridianCityPokecenterBenchGuyText::
text_far _ViridianCityPokecenterGuyText
text_end
PewterCityPokecenterBenchGuyText::
text_far _PewterCityPokecenterGuyText
text_end
CeruleanCityPokecenterBenchGuyText::
text_far _CeruleanPokecenterGuyText
text_end
LavenderCityPokecenterBenchGuyText::
text_far _LavenderPokecenterGuyText
text_end
MtMoonPokecenterBenchGuyText::
text_far _MtMoonPokecenterBenchGuyText
text_end
RockTunnelPokecenterBenchGuyText::
text_far _RockTunnelPokecenterGuyText
text_end
UnusedBenchGuyText1::
text_far _UnusedBenchGuyText1
text_end
UnusedBenchGuyText2::
text_far _UnusedBenchGuyText2
text_end
UnusedBenchGuyText3::
text_far _UnusedBenchGuyText3
text_end
VermilionCityPokecenterBenchGuyText::
text_far _VermilionPokecenterGuyText
text_end
CeladonCityPokecenterBenchGuyText::
text_far _CeladonCityPokecenterGuyText
text_end
FuchsiaCityPokecenterBenchGuyText::
text_far _FuchsiaCityPokecenterGuyText
text_end
CinnabarIslandPokecenterBenchGuyText::
text_far _CinnabarPokecenterGuyText
text_end
SaffronCityPokecenterBenchGuyText::
text_asm
CheckEvent EVENT_BEAT_SILPH_CO_GIOVANNI
ld hl, SaffronCityPokecenterBenchGuyText2
jr nz, .asm_624f2
ld hl, SaffronCityPokecenterBenchGuyText1
.asm_624f2
call PrintText
jp TextScriptEnd
SaffronCityPokecenterBenchGuyText1:
text_far _SaffronCityPokecenterGuyText1
text_end
SaffronCityPokecenterBenchGuyText2:
text_far _SaffronCityPokecenterGuyText2
text_end
CeladonCityHotelText::
text_far _CeladonCityHotelText
text_end
|
src/beziertostl.adb | SKNZ/BezierToSTL | 0 | 7697 | with Ada.Command_Line; use Ada.Command_Line;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Exceptions; use Ada.Exceptions;
with STL; use STL;
with Parser_Svg; use Parser_Svg;
with Normalisation; use Normalisation;
with Courbes; use Courbes;
with Interpolations_Lineaires; use Interpolations_Lineaires;
with Vecteurs; use Vecteurs;
with Helper; use Helper;
procedure BezierToSTL is
Courbes : Liste_Courbes.Liste;
Segments : Liste_Points.Liste;
Facettes : Liste_Facettes.Liste;
-- Active l'affichage de la sortie Debug
Activer_Debug : constant Boolean := True;
-- Nombre de points à utiliser pour la discretisation
Nombre_Points_Interpolation : constant Positive := 50;
-- Faut il interpoler les droites
-- ou laisser cette tâche à l'affichage ?
-- WARNING: Ne pas activer avec De Casteljau
-- Sinon risque de trop grand nombre de points
-- rendant stlviewer inutilisable
Interpoler_Droites : constant Boolean := false;
-- Utiliser l'algorithme de De Casteljau
-- pour interpoler les courbes de Bezier cubiques
-- => Courbes plus jolies/lisses
-- => Le nombre de point est ignoré pour les courbes concernées
-- => car il est déterminé automatiquement
-- WARNING: Ne pas activer avec Interpoler_Droites
-- Sinon risque de trop grand nombre de points
-- rendant stlviewer inutilisable
Utiliser_DeCasteljau : constant Boolean := true;
-- Tolérance utilisée si Utiliser_DeCasteljau
-- Définit une tolérance pour
-- savoir quand une courbe peut être
-- considérée "droite"
-- Plus petit = tolérance plus strict
-- => Approximation plus précise
-- et inversement.
-- A valeur entre 0.01 et 1.0.
Tolerance_DeCasteljau : constant Tolerance := 0.1;
-- Permet de libérer la mémoire allouée pour
-- toutes les courbes d'une liste
procedure Liberer_Liste_Courbes is new Liste_Courbes.Parcourir(Liberer_Courbe);
-- Nombre de facette à générer pendant la rotation
Nombre_Facettes : constant Positive := 200;
begin
if Argument_Count /= 2 then
Put_Line(Standard_Error,
"usage : " & Command_Name &
" fichier_entree.svg fichier_sortie.stl");
Set_Exit_Status(Failure);
return;
end if;
Afficher_Debug (Activer_Debug);
Put_Line("Chargement de la figure...");
-- On charge la figure contenue dans le SVG
Charger_SVG(Argument(1), Courbes);
Put_Line("Interpolation linéaire...");
-- Approximation des courbes par des segments
Interpolation_Lineaire (
Courbes => Courbes,
Segments => Segments,
Nombre_Points => Nombre_Points_Interpolation,
Interpoler_Droites => Interpoler_Droites,
Utiliser_DeCasteljau => Utiliser_DeCasteljau,
Tolerance_DeCasteljau => Tolerance_DeCasteljau);
Put_Line("Normalisation...");
-- On normalise la figure
-- (centrage en x, raccordage extremités)
Normaliser(Segments);
Put_Line("Projection en 3D...");
-- On convertit en facettes par rotation
Creation(Segments, Facettes, Nombre_Facettes);
Put_Line("Export...");
-- On sauvegarde le modele obtenu
Sauvegarder(Argument(2), Facettes);
-- Libère la mémoire allouée pour chaque courbe
Liberer_Liste_Courbes (Courbes);
-- Libère la mémoire allouée pour les listes
Liste_Courbes.Vider(Courbes);
Liste_Points.Vider(Segments);
Liste_Facettes.Vider(Facettes);
exception
when Courbe_Abs =>
Put_Line (Standard_Error,
"Le fichier source ne contenait pas de courbe.");
Set_Exit_Status (Failure);
when e: Courbe_Illisible =>
Put_Line (Standard_Error,
"Le fichier source est mal formé: " & exception_message (e));
Set_Exit_Status (Failure);
when e: Erreur_Lecture =>
Put_Line (Standard_Error,
"Le fichier source est mal formé: " & exception_message (e));
Set_Exit_Status (Failure);
when e: Name_Error =>
Put_Line (Standard_Error,
"Le fichier n'a pas pu être ouvert: " & exception_message(e));
Set_Exit_Status (Failure);
end;
|
oeis/028/A028024.asm | neoneye/loda-programs | 11 | 94970 | <reponame>neoneye/loda-programs
; A028024: Expansion of 1/((1-2x)(1-10x)(1-11x)(1-12x)).
; Submitted by <NAME>
; 1,35,797,14959,251349,3931431,58494829,838932143,11699121797,159590758327,2138803364061,28251497273727,368712393238645,4763687404354823,61019774392655693,775898073656236111
mov $1,1
mov $2,$0
mov $3,$0
lpb $2
mov $0,$3
sub $2,1
sub $0,$2
seq $0,16325 ; Expansion of 1/((1-2x)(1-10x)(1-11x)).
mul $1,12
add $1,$0
lpe
mov $0,$1
|
programs/oeis/241/A241199.asm | neoneye/loda | 22 | 3324 | ; A241199: Numbers n such that 4 consecutive terms of binomial(n,k) satisfy a quadratic relation for 0 <= k <= n/2.
; 14,19,31,38,54,63,83,94,118,131,159,174,206,223,259,278,318,339,383,406,454,479,531,558,614,643,703,734,798,831,899,934,1006,1043,1119,1158,1238,1279,1363,1406,1494,1539,1631,1678,1774,1823,1923,1974,2078,2131,2239,2294,2406,2463,2579,2638,2758,2819,2943,3006,3134,3199,3331,3398,3534,3603,3743,3814,3958,4031,4179,4254,4406,4483,4639,4718,4878,4959,5123,5206,5374,5459,5631,5718,5894,5983,6163,6254,6438,6531,6719,6814,7006,7103,7299,7398,7598,7699,7903,8006
mov $1,$0
div $1,2
add $1,7
add $0,$1
pow $0,2
div $0,3
sub $0,2
|
programs/oeis/199/A199420.asm | neoneye/loda | 22 | 82404 | ; A199420: a(n) = (5*7^n+1)/3.
; 2,12,82,572,4002,28012,196082,1372572,9608002,67256012,470792082,3295544572,23068812002,161481684012,1130371788082,7912602516572,55388217616002,387717523312012,2714022663184082,18998158642288572,132987110496020002,930909773472140012,6516368414304980082,45614578900134860572,319302052300944024002,2235114366106608168012,15645800562746257176082,109520603939223800232572,766644227574566601628002,5366509593021966211396012,37565567151153763479772082,262958970058076344358404572,1840712790406534410508832002,12884989532845740873561824012,90194926729920186114932768082,631364487109441302804529376572,4419551409766089119631705636002,30936859868362623837421939452012,216558019078538366861953576164082,1515906133549768568033675033148572,10611342934848379976235725232040002,74279400543938659833650076624280012,519955803807570618835550536369960082
mov $1,7
pow $1,$0
div $1,6
mul $1,10
add $1,2
mov $0,$1
|
VM/src/Linux/VPU/x86_64/organized/bak/protected_decode.asm | ozdevguy/Ditto | 0 | 84519 | ivpu_decode_protected:
jmp ivpu_protectedMode
|
programs/oeis/016/A016203.asm | neoneye/loda | 22 | 15332 | ; A016203: Expansion of 1/((1-x)(1-2x)(1-8x)).
; 1,11,95,775,6231,49911,399415,3195575,25565111,204521911,1636177335,13089422775,104715390391,837723139511,6701785148855,53614281256375,428914250182071,3431314001718711,27450512014273975
lpb $0
mov $2,$0
sub $0,1
seq $2,155721 ; Positions of parity change in A033035.
add $1,$2
mul $1,2
lpe
div $1,4
add $1,1
mov $0,$1
|
libsrc/_DEVELOPMENT/input/basic/z80/asm_in_wait_key.asm | ahjelm/z88dk | 640 | 242598 |
; ===============================================================
; <NAME> 2020
; ===============================================================
;
; void in_wait_key(void)
;
; Busy wait until a key is pressed.
;
; ===============================================================
SECTION code_clib
SECTION code_input
PUBLIC asm_in_wait_key
.asm_in_wait_key
; exit : if one key is pressed
;
; uses : potentially all (ix, iy saved for sdcc)
jp 0x0010 ; direct console i/o input, blocking call, key in A
|
openal_info_main.adb | io7m/coreland-openal-ada | 1 | 8008 | with OpenAL_Info;
procedure OpenAL_Info_Main is
begin
OpenAL_Info.Run;
end OpenAL_Info_Main;
|
kernel/drivers/isr.asm | wubbalubbadubdubonline/echidnaOS | 2 | 96351 | <filename>kernel/drivers/isr.asm
global handler_simple
global handler_code
global handler_irq_pic0
global handler_irq_pic1
global keyboard_isr
global syscall
extern keyboard_handler
extern text_putchar
extern text_putstring
extern keyboard_fetch_char
section .data
cpu_state_esp dd 0xffbffff0
interrupted_esp dd 0
routine_list:
times 0x20 dd 0 ; Reserved syscalls
dd text_putchar
dd text_putstring
dd keyboard_fetch_char
section .text
bits 32
handler_simple:
iret
handler_code:
add esp, 4
iret
handler_irq_pic0:
push eax
mov al, 0x20 ; acknowledge interrupt to PIC0
out 0x20, al
pop eax
iret
handler_irq_pic1:
push eax
mov al, 0x20 ; acknowledge interrupt to both PICs
out 0xA0, al
out 0x20, al
pop eax
iret
keyboard_isr:
push eax
push ebx
push ecx
push edx
push esi
push edi
push ebp
push ds
push es
push fs
push gs
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
xor eax, eax
in al, 0x60 ; read from keyboard
push eax
call keyboard_handler
add esp, 4
mov al, 0x20 ; acknowledge interrupt to PIC0
out 0x20, al
pop gs
pop fs
pop es
pop ds
pop ebp
pop edi
pop esi
pop edx
pop ecx
pop ebx
pop eax
iret
syscall:
mov dword [interrupted_esp], esp
mov esp, dword [cpu_state_esp]
push ebx
push ecx
push edx
push esi
push edi
push ebp
push ds
push es
push fs
push gs
mov bx, 0x10
mov ds, bx
mov es, bx
mov fs, bx
mov gs, bx
mov dword [cpu_state_esp], esp
mov esp, dword [interrupted_esp]
pop ebx ; EIP
pop ecx ; CS
pop edx ; FLAGS
mov dword [interrupted_esp], esp
mov esp, dword [cpu_state_esp]
push edx
push ecx
push ebx
mov dword [cpu_state_esp], esp
mov esp, dword [interrupted_esp]
mov ebx, 4
mul ebx
sti ; Interrupts enabled
call [routine_list+eax]
cli ; Interrupts disabled
mov dword [interrupted_esp], esp
mov esp, dword [cpu_state_esp]
pop ebx
pop ecx
pop edx
mov dword [cpu_state_esp], esp
mov esp, dword [interrupted_esp]
push edx
push ecx
push ebx
mov dword [interrupted_esp], esp
mov esp, dword [cpu_state_esp]
pop gs
pop fs
pop es
pop ds
pop ebp
pop edi
pop esi
pop edx
pop ecx
pop ebx
mov dword [cpu_state_esp], esp
mov esp, dword [interrupted_esp]
iret
|
programs/oeis/054/A054778.asm | karttu/loda | 1 | 28878 | ; A054778: 5n*(5n-1)*(5n-2)*(5n-3)*(5n-4).
; 0,120,30240,360360,1860480,6375600,17100720,38955840,78960960,146611080,254251200,417451320,655381440,991186560,1452361680,2071126800,2884801920,3936182040,5273912160,6952862280,9034502400,11587277520,14686982640,18417137760
mul $0,5
bin $0,5
mov $1,$0
mul $1,120
|
source/base/incr-version_trees.adb | reznikmm/increment | 5 | 30371 | -- Copyright (c) 2015-2017 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package body Incr.Version_Trees is
----------------------
-- Versioned_Values --
----------------------
package body Versioned_Values is
-------------
-- Discard --
-------------
procedure Discard
(Self : in out Container;
Time : Version;
Changes : out Integer) is
begin
if Time = Self.Versions (Self.Index) then
Self.Index := Self.Index - 1;
Changes := -1;
elsif Time < Self.Versions (Self.Index) then
-- Reverting of earlyer version is not allowed
raise Constraint_Error;
else
Changes := 0;
end if;
end Discard;
---------
-- Get --
---------
function Get (Self : Container; Time : Version) return Element is
begin
for J in Self.Versions'Range loop
if Time >= Self.Versions (Self.Index - J) then
return Self.Elements (Self.Index - J);
end if;
end loop;
raise Constraint_Error with "version is too old";
end Get;
----------------
-- Initialize --
----------------
procedure Initialize
(Self : in out Container;
Initial_Value : Element)
is
begin
Self.Versions := (others => 0);
Self.Elements := (others => Initial_Value);
Self.Index := 0;
end Initialize;
---------
-- Set --
---------
procedure Set
(Self : in out Container;
Value : Element;
Time : Version;
Changes : in out Integer)
is
Prev : constant Version := Time - 1; -- Tree.Parent (Time)
Old : constant Element := Get (Self, Prev);
Is_Old : constant Boolean := Value = Old;
begin
if Time = Self.Versions (Self.Index) and Is_Old then
Self.Index := Self.Index - 1;
Changes := Changes - 1;
elsif Time > Self.Versions (Self.Index) and not Is_Old then
Self.Index := Self.Index + 1;
Self.Versions (Self.Index) := Time;
Changes := Changes + 1;
elsif Time < Self.Versions (Self.Index) then
-- Update of earlyer version is not allowed
raise Constraint_Error;
end if;
if not Is_Old then
Self.Elements (Self.Index) := Value;
end if;
end Set;
end Versioned_Values;
function "<" (Left, Right : Version) return Boolean is
L : constant Natural := Natural (Left);
R : constant Natural := Natural (Right);
begin
if L < 128 xor R < 128 then
return Natural (L + 8) < Natural (R + 8);
else
return L < R;
end if;
end "<";
--------------
-- Changing --
--------------
function Changing (Self : Version_Tree) return Version is
begin
return Self.Changing;
end Changing;
-----------------
-- Is_Changing --
-----------------
function Is_Changing
(Self : Version_Tree; Value : Version) return Boolean is
begin
return Self.Changing = Value;
end Is_Changing;
------------
-- Parent --
------------
function Parent (Self : Version_Tree; Value : Version) return Version is
pragma Unreferenced (Self);
begin
return Value - 1;
end Parent;
------------------
-- Start_Change --
------------------
procedure Start_Change
(Self : in out Version_Tree;
Parent : Version;
Changing : out Version)
is
begin
if Parent /= Self.Changing then
raise Constraint_Error with "not implemented";
end if;
Self.Changing := Self.Changing + 1;
Changing := Self.Changing;
end Start_Change;
end Incr.Version_Trees;
|
oeis/031/A031393.asm | neoneye/loda-programs | 11 | 11449 | ; A031393: a(n) = prime(6*n - 4).
; Submitted by <NAME>
; 3,19,43,71,101,131,163,193,229,263,293,337,373,409,443,479,521,569,601,641,673,719,757,809,839,881,929,971,1013,1049,1091,1123,1181,1223,1277,1301,1361,1423,1451,1487,1531,1571,1609,1657,1699,1747,1789,1861,1889,1949,1997,2029,2083,2129,2161,2237,2273,2311,2357,2393,2441,2503,2551,2617,2663,2693,2729,2777,2819,2861,2917,2969,3023,3079,3137,3191,3251,3301,3331,3373,3449,3491,3533,3571,3617,3671,3709,3767,3821,3863,3917,3947,4013,4057,4111,4157,4219,4259,4297,4363
mov $2,36
mul $2,$0
mul $0,6
mov $4,2
lpb $2
mov $3,$4
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
mov $1,$0
max $1,0
cmp $1,$0
mul $2,$1
sub $2,1
add $4,2
lpe
mov $0,$4
add $0,1
|
src/gen-artifacts-xmi.adb | jquorning/dynamo | 15 | 9911 | -----------------------------------------------------------------------
-- gen-artifacts-xmi -- UML-XMI artifact for Code Generator
-- Copyright (C) 2012, 2013, 2014, 2015, 2016, 2018, 2021 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Directories;
with Ada.Strings.Fixed;
with Gen.Configs;
with Gen.Utils;
with Gen.Model.Tables;
with Gen.Model.Enums;
with Gen.Model.Mappings;
with Gen.Model.Beans;
with Gen.Model.Operations;
with Gen.Model.Stypes;
with Util.Log.Loggers;
with Util.Strings;
with Util.Files;
with Util.Beans;
with Util.Beans.Objects;
with Util.Serialize.Mappers.Record_Mapper;
with Util.Serialize.IO.XML;
with Util.Processes;
with Util.Streams.Pipes;
with Util.Streams.Buffered;
package body Gen.Artifacts.XMI is
use Ada.Strings.Unbounded;
use Gen.Model;
use Gen.Configs;
package UBO renames Util.Beans.Objects;
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Gen.Artifacts.XMI");
-- Get the visibility from the XMI visibility value.
function Get_Visibility (Value : in UBO.Object) return Model.XMI.Visibility_Type;
-- Get the changeability from the XMI visibility value.
function Get_Changeability (Value : in UBO.Object)
return Model.XMI.Changeability_Type;
-- Get the parameter kind from the XMI parameter kind value.
function Get_Parameter_Type (Value : in UBO.Object)
return Model.XMI.Parameter_Type;
procedure Iterate_For_Table is
new Gen.Model.XMI.Iterate_Elements (T => Gen.Model.Tables.Table_Definition'Class);
procedure Iterate_For_Bean is
new Gen.Model.XMI.Iterate_Elements (T => Gen.Model.Beans.Bean_Definition'Class);
procedure Iterate_For_Package is
new Gen.Model.XMI.Iterate_Elements (T => Gen.Model.Packages.Package_Definition'Class);
procedure Iterate_For_Enum is
new Gen.Model.XMI.Iterate_Elements (T => Gen.Model.Enums.Enum_Definition'Class);
procedure Iterate_For_Operation is
new Gen.Model.XMI.Iterate_Elements (T => Gen.Model.Operations.Operation_Definition'Class);
function Find_Stereotype is
new Gen.Model.XMI.Find_Element (Element_Type => Model.XMI.Stereotype_Element,
Element_Type_Access => Model.XMI.Stereotype_Element_Access);
function Find_Tag_Definition is
new Gen.Model.XMI.Find_Element
(Element_Type => Model.XMI.Tag_Definition_Element,
Element_Type_Access => Model.XMI.Tag_Definition_Element_Access);
type XMI_Fields is (FIELD_NAME,
FIELD_ID,
FIELD_ID_REF,
FIELD_VALUE,
FIELD_HREF,
FIELD_CLASS_NAME, FIELD_CLASS_ID,
FIELD_STEREOTYPE,
FIELD_STEREOTYPE_NAME,
FIELD_STEREOTYPE_ID,
FIELD_STEREOTYPE_HREF,
FIELD_ATTRIBUTE_NAME,
FIELD_ATTRIBUTE_ID,
FIELD_ATTRIBUTE_VISIBILITY,
FIELD_ATTRIBUTE_CHANGEABILITY,
FIELD_ATTRIBUTE_INITIAL_VALUE,
FIELD_ATTRIBUTE,
FIELD_MULTIPLICITY_UPPER,
FIELD_MULTIPLICITY_LOWER,
FIELD_PACKAGE_ID,
FIELD_PACKAGE_NAME,
FIELD_PACKAGE_END,
FIELD_CLASS_VISIBILITY,
FIELD_DATA_TYPE,
FIELD_DATA_TYPE_NAME,
FIELD_DATA_TYPE_HREF,
FIELD_CLASS_END,
FIELD_ASSOCIATION_NAME,
FIELD_ASSOCIATION_ID,
FIELD_ASSOCIATION,
FIELD_ASSOCIATION_CLASS_ID,
FIELD_CLASSIFIER_HREF,
FIELD_GENERALIZATION_ID,
FIELD_GENERALIZATION_CHILD_ID,
FIELD_GENERALIZATION_PARENT_ID,
FIELD_GENERALIZATION_END,
FIELD_ASSOCIATION_END_ID,
FIELD_ASSOCIATION_END_NAME,
FIELD_ASSOCIATION_END_VISIBILITY,
FIELD_ASSOCIATION_END_NAVIGABLE,
FIELD_ASSOCIATION_END,
FIELD_OPERATION_ID,
FIELD_OPERATION_NAME,
FIELD_OPERATION_END,
FIELD_PARAMETER_ID,
FIELD_PARAMETER_NAME,
FIELD_PARAMETER_KIND,
FIELD_PARAMETER_END,
FIELD_COMMENT,
FIELD_COMMENT_ID,
FIELD_TAG_DEFINITION,
FIELD_TAG_DEFINITION_ID,
FIELD_TAG_DEFINITION_NAME,
FIELD_TAGGED_ID,
FIELD_TAGGED_VALUE,
FIELD_ENUMERATION,
FIELD_ENUMERATION_LITERAL,
FIELD_ENUMERATION_LITERAL_END,
FIELD_ENUMERATION_HREF);
type XMI_Info is record
Model : Gen.Model.XMI.Model_Map_Access;
Default_Type : UString;
File : UString;
Parser : access Util.Serialize.IO.XML.Parser'Class;
Profiles : access Util.Strings.Sets.Set;
Is_Profile : Boolean := False;
Class_Element : Gen.Model.XMI.Class_Element_Access;
Class_Name : UBO.Object;
Class_Visibility : Gen.Model.XMI.Visibility_Type := Gen.Model.XMI.VISIBILITY_PUBLIC;
Class_Id : UBO.Object;
-- UML Generalization.
Child_Id : UBO.Object;
Parent_Id : UBO.Object;
Generalization_Id : UBO.Object;
Generalization : Gen.Model.XMI.Generalization_Element_Access;
Package_Element : Gen.Model.XMI.Package_Element_Access;
Package_Id : UBO.Object;
Attr_Id : UBO.Object;
Attr_Element : Gen.Model.XMI.Attribute_Element_Access;
Attr_Visibility : Gen.Model.XMI.Visibility_Type := Gen.Model.XMI.VISIBILITY_PUBLIC;
Attr_Changeability : Gen.Model.XMI.Changeability_Type
:= Gen.Model.XMI.CHANGEABILITY_CHANGEABLE;
Attr_Value : UBO.Object;
Multiplicity_Lower : Integer := 0;
Multiplicity_Upper : Integer := 0;
Association : Gen.Model.XMI.Association_Element_Access;
Assos_End_Element : Gen.Model.XMI.Association_End_Element_Access;
Assos_End_Name : UBO.Object;
Assos_End_Visibility : Gen.Model.XMI.Visibility_Type := Gen.Model.XMI.VISIBILITY_PUBLIC;
Assos_End_Navigable : Boolean := False;
Operation_Id : UBO.Object;
Operation : Gen.Model.XMI.Operation_Element_Access;
Parameter : Gen.Model.XMI.Parameter_Element_Access;
Parameter_Type : Gen.Model.XMI.Parameter_Type;
Name : UBO.Object;
Id : UBO.Object;
Ref_Id : UBO.Object;
Value : UBO.Object;
Href : UBO.Object;
Tag_Name : UBO.Object;
Tagged_Id : UBO.Object;
Association_Id : UBO.Object;
Stereotype_Id : UBO.Object;
Data_Type : Gen.Model.XMI.Data_Type_Element_Access;
Enumeration : Gen.Model.XMI.Enum_Element_Access;
Enumeration_Literal : Gen.Model.XMI.Literal_Element_Access;
Tag_Definition : Gen.Model.XMI.Tag_Definition_Element_Access;
Stereotype : Gen.Model.XMI.Stereotype_Element_Access;
Tagged_Value : Gen.Model.XMI.Tagged_Value_Element_Access;
Comment : Gen.Model.XMI.Comment_Element_Access;
Has_Package_Id : Boolean := False;
Has_Package_Name : Boolean := False;
end record;
type XMI_Access is access all XMI_Info;
procedure Add_Tagged_Value (P : in out XMI_Info);
procedure Set_Member (P : in out XMI_Info;
Field : in XMI_Fields;
Value : in UBO.Object);
-- Set the package name and or XMI id.
procedure Set_Package (P : in out XMI_Info;
Name : in UBO.Object;
Id : in UBO.Object);
use type Gen.Model.XMI.Model_Element_Access;
use type Gen.Model.XMI.Attribute_Element_Access;
use type Gen.Model.XMI.Class_Element_Access;
use type Gen.Model.XMI.Package_Element_Access;
use type Gen.Model.XMI.Tag_Definition_Element_Access;
use type Gen.Model.XMI.Association_End_Element_Access;
use type Gen.Model.XMI.Stereotype_Element_Access;
use type Gen.Model.XMI.Enum_Element_Access;
use type Gen.Model.XMI.Literal_Element_Access;
use type Gen.Model.XMI.Comment_Element_Access;
use type Gen.Model.XMI.Operation_Element_Access;
use type Gen.Model.XMI.Association_Element_Access;
use type Gen.Model.XMI.Ref_Type_Element_Access;
use type Gen.Model.XMI.Data_Type_Element_Access;
-- ------------------------------
-- Get the visibility from the XMI visibility value.
-- ------------------------------
function Get_Visibility (Value : in UBO.Object)
return Model.XMI.Visibility_Type is
S : constant String := UBO.To_String (Value);
begin
if S = "public" then
return Model.XMI.VISIBILITY_PUBLIC;
elsif S = "package" then
return Model.XMI.VISIBILITY_PACKAGE;
elsif S = "protected" then
return Model.XMI.VISIBILITY_PROTECTED;
elsif S = "private" then
return Model.XMI.VISIBILITY_PRIVATE;
else
return Model.XMI.VISIBILITY_PUBLIC;
end if;
end Get_Visibility;
-- ------------------------------
-- Get the changeability from the XMI visibility value.
-- ------------------------------
function Get_Changeability (Value : in UBO.Object)
return Model.XMI.Changeability_Type is
S : constant String := UBO.To_String (Value);
begin
if S = "frozen" then
return Model.XMI.CHANGEABILITY_FROZEN;
elsif S = "changeable" then
return Model.XMI.CHANGEABILITY_CHANGEABLE;
elsif S = "addOnly" then
return Model.XMI.CHANGEABILITY_INSERT;
else
return Model.XMI.CHANGEABILITY_CHANGEABLE;
end if;
end Get_Changeability;
-- ------------------------------
-- Get the parameter kind from the XMI parameter kind value.
-- ------------------------------
function Get_Parameter_Type (Value : in UBO.Object)
return Model.XMI.Parameter_Type is
S : constant String := UBO.To_String (Value);
begin
if S = "return" then
return Model.XMI.PARAM_RETURN;
elsif S = "in" then
return Model.XMI.PARAM_IN;
elsif S = "out" then
return Model.XMI.PARAM_OUT;
elsif S = "inout" then
return Model.XMI.PARAM_INOUT;
else
return Model.XMI.PARAM_INOUT;
end if;
end Get_Parameter_Type;
procedure Add_Tagged_Value (P : in out XMI_Info) is
Id : constant UString := UBO.To_Unbounded_String (P.Tagged_Id);
Value : constant UString := UBO.To_Unbounded_String (P.Value);
Tagged_Value : constant Model.XMI.Tagged_Value_Element_Access
:= new Model.XMI.Tagged_Value_Element (P.Model);
begin
Log.Info ("Add tag {0} - {1}", Id, To_String (Value));
Tagged_Value.Value := Value;
if not UBO.Is_Null (P.Ref_Id) then
Tagged_Value.Set_Reference_Id (UBO.To_String (P.Ref_Id), P.Profiles.all);
P.Ref_Id := UBO.Null_Object;
else
Tagged_Value.Set_Reference_Id (UBO.To_String (P.Href), P.Profiles.all);
P.Href := UBO.Null_Object;
end if;
Tagged_Value.XMI_Id := Id;
P.Model.Insert (Tagged_Value.XMI_Id, Tagged_Value.all'Access);
-- Insert the tag value into the current element.
if P.Data_Type /= null then
P.Data_Type.Tagged_Values.Append (Tagged_Value.all'Access);
elsif P.Assos_End_Element /= null then
P.Assos_End_Element.Tagged_Values.Append (Tagged_Value.all'Access);
elsif P.Association /= null then
P.Association.Tagged_Values.Append (Tagged_Value.all'Access);
elsif P.Attr_Element /= null then
P.Attr_Element.Tagged_Values.Append (Tagged_Value.all'Access);
elsif P.Class_Element /= null then
Log.Info ("Adding in {0}", To_String (P.Class_Element.Name));
P.Class_Element.Tagged_Values.Append (Tagged_Value.all'Access);
elsif P.Enumeration_Literal /= null then
P.Enumeration_Literal.Tagged_Values.Append (Tagged_Value.all'Access);
elsif P.Enumeration /= null then
P.Enumeration.Tagged_Values.Append (Tagged_Value.all'Access);
elsif P.Package_Element /= null then
P.Package_Element.Tagged_Values.Append (Tagged_Value.all'Access);
elsif P.Tag_Definition /= null then
P.Tag_Definition.Tagged_Values.Append (Tagged_Value.all'Access);
else
Log.Info ("Tagged value {0} ignored", Id);
end if;
end Add_Tagged_Value;
-- ------------------------------
-- Set the package name and or XMI id.
-- ------------------------------
procedure Set_Package (P : in out XMI_Info;
Name : in UBO.Object;
Id : in UBO.Object) is
Parent : constant Gen.Model.XMI.Package_Element_Access := P.Package_Element;
begin
-- This is a new nested package, create it.
if Parent /= null and P.Has_Package_Name and P.Has_Package_Id then
P.Package_Element := null;
end if;
if P.Package_Element = null then
P.Package_Element := new Gen.Model.XMI.Package_Element (P.Model);
P.Package_Element.Set_Location (P.Parser.Get_Location);
P.Package_Element.Is_Profile := P.Is_Profile;
if Parent /= null then
P.Package_Element.Parent := Parent.all'Access;
else
P.Package_Element.Parent := null;
end if;
P.Has_Package_Name := False;
P.Has_Package_Id := False;
end if;
if not UBO.Is_Null (Id) then
P.Package_Element.Set_XMI_Id (Id);
P.Model.Include (P.Package_Element.XMI_Id, P.Package_Element.all'Access);
P.Has_Package_Id := True;
end if;
if not UBO.Is_Null (Name) then
P.Package_Element.Set_Name (Name);
P.Has_Package_Name := True;
end if;
end Set_Package;
procedure Set_Member (P : in out XMI_Info;
Field : in XMI_Fields;
Value : in UBO.Object) is
begin
case Field is
when FIELD_NAME =>
P.Name := Value;
when FIELD_ID =>
P.Id := Value;
P.Ref_Id := UBO.Null_Object;
P.Href := UBO.Null_Object;
when FIELD_ID_REF =>
P.Ref_Id := Value;
when FIELD_VALUE =>
P.Value := Value;
when FIELD_HREF =>
P.Href := Value;
when FIELD_MULTIPLICITY_LOWER =>
P.Multiplicity_Lower := UBO.To_Integer (Value);
when FIELD_MULTIPLICITY_UPPER =>
P.Multiplicity_Upper := UBO.To_Integer (Value);
when FIELD_CLASS_NAME =>
P.Class_Element := new Gen.Model.XMI.Class_Element (P.Model);
P.Class_Element.Set_Name (Value);
P.Class_Element.Set_Location (To_String (P.File) & P.Parser.Get_Location);
P.Ref_Id := UBO.Null_Object;
P.Href := UBO.Null_Object;
when FIELD_CLASS_VISIBILITY =>
P.Class_Visibility := Get_Visibility (Value);
when FIELD_CLASS_ID =>
P.Class_Id := Value;
when FIELD_CLASS_END =>
if P.Class_Element /= null then
P.Class_Element.XMI_Id := UBO.To_Unbounded_String (P.Class_Id);
P.Class_Element.Visibility := P.Class_Visibility;
Log.Info ("Adding class {0} - {1}",
P.Class_Element.XMI_Id, To_String (P.Class_Element.Name));
P.Model.Insert (P.Class_Element.XMI_Id, P.Class_Element.all'Access);
if P.Package_Element /= null then
P.Package_Element.Classes.Append (P.Class_Element.all'Access);
P.Package_Element.Elements.Append (P.Class_Element.all'Access);
P.Class_Element.Parent := P.Package_Element.all'Access;
end if;
P.Class_Element := null;
P.Class_Visibility := Gen.Model.XMI.VISIBILITY_PUBLIC;
end if;
when FIELD_GENERALIZATION_CHILD_ID =>
P.Child_Id := Value;
when FIELD_GENERALIZATION_PARENT_ID =>
P.Parent_Id := Value;
when FIELD_GENERALIZATION_ID =>
P.Generalization_Id := Value;
when FIELD_GENERALIZATION_END =>
if not UBO.Is_Null (P.Child_Id)
and not UBO.Is_Null (P.Parent_Id)
and not UBO.Is_Null (P.Generalization_Id)
then
P.Generalization := new Gen.Model.XMI.Generalization_Element (P.Model);
P.Generalization.Set_XMI_Id (P.Generalization_Id);
P.Model.Insert (P.Generalization.XMI_Id, P.Generalization.all'Access);
P.Generalization.Set_Reference_Id (UBO.To_String (P.Parent_Id),
P.Profiles.all);
P.Generalization.Child_Id := UBO.To_Unbounded_String (P.Child_Id);
end if;
P.Child_Id := UBO.Null_Object;
P.Generalization_Id := UBO.Null_Object;
P.Parent_Id := UBO.Null_Object;
when FIELD_OPERATION_ID =>
P.Operation_Id := Value;
when FIELD_ATTRIBUTE_ID | FIELD_PARAMETER_ID =>
P.Attr_Id := Value;
when FIELD_ATTRIBUTE_VISIBILITY =>
P.Attr_Visibility := Get_Visibility (Value);
when FIELD_ATTRIBUTE_CHANGEABILITY =>
P.Attr_Changeability := Get_Changeability (Value);
when FIELD_ATTRIBUTE_NAME =>
P.Attr_Element := new Gen.Model.XMI.Attribute_Element (P.Model);
P.Attr_Element.Set_Name (Value);
P.Attr_Element.Set_Location (To_String (P.File) & P.Parser.Get_Location);
when FIELD_ATTRIBUTE_INITIAL_VALUE =>
P.Attr_Value := Value;
when FIELD_ATTRIBUTE =>
P.Attr_Element.Set_XMI_Id (P.Attr_Id);
P.Attr_Element.Visibility := P.Attr_Visibility;
P.Attr_Element.Changeability := P.Attr_Changeability;
P.Attr_Element.Multiplicity_Lower := P.Multiplicity_Lower;
P.Attr_Element.Multiplicity_Upper := P.Multiplicity_Upper;
P.Attr_Element.Initial_Value := P.Attr_Value;
-- Prepare for next attribute.
P.Attr_Visibility := Gen.Model.XMI.VISIBILITY_PUBLIC;
P.Attr_Changeability := Gen.Model.XMI.CHANGEABILITY_CHANGEABLE;
P.Multiplicity_Lower := 0;
P.Multiplicity_Upper := 0;
-- Sanity check and add this attribute to the class.
if P.Class_Element /= null then
P.Model.Insert (P.Attr_Element.XMI_Id, P.Attr_Element.all'Access);
P.Attr_Element.Parent := P.Class_Element.all'Access;
P.Class_Element.Elements.Append (P.Attr_Element.all'Access);
P.Class_Element.Attributes.Append (P.Attr_Element.all'Access);
if Length (P.Attr_Element.Ref_Id) = 0 then
P.Attr_Element.Ref_Id := P.Default_Type;
declare
Msg : constant String := "attribute '" & To_String (P.Attr_Element.Name)
& "' in table '" & To_String (P.Class_Element.Name)
& "' has no type.";
begin
P.Attr_Element := null;
raise Util.Serialize.Mappers.Field_Error with Msg;
end;
end if;
end if;
P.Attr_Element := null;
when FIELD_OPERATION_NAME =>
P.Operation := new Gen.Model.XMI.Operation_Element (P.Model);
P.Operation.Set_Name (Value);
P.Operation.Set_Location (To_String (P.File) & P.Parser.Get_Location);
when FIELD_PARAMETER_NAME =>
P.Attr_Element := new Gen.Model.XMI.Attribute_Element (P.Model);
P.Attr_Element.Set_Name (Value);
P.Attr_Element.Set_Location (To_String (P.File) & P.Parser.Get_Location);
when FIELD_PARAMETER_KIND =>
P.Parameter_Type := Get_Parameter_Type (Value);
when FIELD_PARAMETER_END =>
if P.Attr_Element /= null and P.Operation /= null then
P.Attr_Element.Set_XMI_Id (P.Attr_Id);
P.Operation.Elements.Append (P.Attr_Element.all'Access);
P.Model.Insert (P.Attr_Element.XMI_Id, P.Attr_Element.all'Access);
end if;
P.Attr_Element := null;
when FIELD_OPERATION_END =>
if P.Operation /= null and P.Class_Element /= null then
P.Operation.Set_XMI_Id (P.Operation_Id);
P.Model.Insert (P.Operation.XMI_Id, P.Operation.all'Access);
P.Class_Element.Operations.Append (P.Operation.all'Access);
end if;
P.Operation := null;
-- Extract an association.
when FIELD_ASSOCIATION_ID =>
P.Association_Id := Value;
when FIELD_ASSOCIATION_NAME =>
P.Association := new Gen.Model.XMI.Association_Element (P.Model);
P.Association.Set_Name (Value);
P.Association.Set_Location (To_String (P.File) & P.Parser.Get_Location);
when FIELD_ASSOCIATION_END_NAME =>
P.Assos_End_Name := Value;
when FIELD_ASSOCIATION_END_VISIBILITY =>
P.Assos_End_Visibility := Get_Visibility (Value);
when FIELD_ASSOCIATION_END_NAVIGABLE =>
P.Assos_End_Navigable := UBO.To_Boolean (Value);
when FIELD_ASSOCIATION_END_ID =>
P.Assos_End_Element := new Gen.Model.XMI.Association_End_Element (P.Model);
P.Assos_End_Element.Set_XMI_Id (Value);
P.Assos_End_Element.Set_Location (To_String (P.File) & P.Parser.Get_Location);
P.Model.Include (P.Assos_End_Element.XMI_Id, P.Assos_End_Element.all'Access);
when FIELD_ASSOCIATION_CLASS_ID =>
if P.Assos_End_Element /= null then
P.Assos_End_Element.Set_Reference_Id (UBO.To_String (Value),
P.Profiles.all);
end if;
when FIELD_ASSOCIATION_END =>
if P.Assos_End_Element /= null and P.Association /= null then
P.Assos_End_Element.Set_Name (P.Assos_End_Name);
P.Assos_End_Element.Visibility := P.Assos_End_Visibility;
P.Assos_End_Element.Navigable := P.Assos_End_Navigable;
P.Assos_End_Element.Multiplicity_Lower := P.Multiplicity_Lower;
P.Assos_End_Element.Multiplicity_Upper := P.Multiplicity_Upper;
P.Assos_End_Element.Parent := P.Association.all'Access;
-- Keep the association if the target class is specified.
-- We ignore association to a UML Component for example.
if Length (P.Assos_End_Element.Ref_Id) > 0 then
P.Association.Connections.Append (P.Assos_End_Element.all'Access);
else
Log.Info ("Association end {0} ignored", P.Assos_End_Element.Name);
end if;
end if;
P.Multiplicity_Lower := 0;
P.Multiplicity_Upper := 0;
P.Assos_End_Name := UBO.Null_Object;
P.Assos_End_Navigable := False;
if P.Association = null then
raise Util.Serialize.Mappers.Field_Error with "invalid association";
end if;
P.Assos_End_Element := null;
when FIELD_ASSOCIATION =>
if P.Association /= null then
P.Association.Set_XMI_Id (P.Association_Id);
P.Model.Include (P.Association.XMI_Id, P.Association.all'Access);
if P.Package_Element /= null then
P.Package_Element.Associations.Append (P.Association.all'Access);
end if;
end if;
P.Association := null;
when FIELD_PACKAGE_ID =>
Set_Package (P, UBO.Null_Object, Value);
when FIELD_PACKAGE_NAME =>
Set_Package (P, Value, UBO.Null_Object);
when FIELD_PACKAGE_END =>
if P.Package_Element /= null then
if P.Package_Element.Parent /= null then
P.Package_Element
:= Gen.Model.XMI.Package_Element (P.Package_Element.Parent.all)'Access;
else
P.Package_Element := null;
end if;
end if;
when FIELD_TAGGED_ID =>
P.Tagged_Id := Value;
-- Tagged value associated with an attribute, operation, class, package.
when FIELD_TAGGED_VALUE =>
Add_Tagged_Value (P);
-- Data type mapping.
when FIELD_DATA_TYPE_NAME =>
P.Data_Type := new Gen.Model.XMI.Data_Type_Element (P.Model);
P.Data_Type.Set_Name (Value);
P.Data_Type.Set_Location (To_String (P.File) & P.Parser.Get_Location);
P.Data_Type.XMI_Id := UBO.To_Unbounded_String (P.Id);
P.Ref_Id := UBO.Null_Object;
P.Href := UBO.Null_Object;
when FIELD_DATA_TYPE =>
if P.Attr_Element = null
and P.Operation = null
and UBO.Is_Null (P.Generalization_Id)
and P.Data_Type /= null
then
if P.Package_Element /= null and not P.Is_Profile then
P.Data_Type.Parent := P.Package_Element.all'Access;
end if;
P.Model.Insert (P.Data_Type.XMI_Id, P.Data_Type.all'Access);
if P.Package_Element /= null and not P.Is_Profile then
P.Package_Element.Types.Append (P.Data_Type.all'Access);
end if;
end if;
P.Data_Type := null;
when FIELD_DATA_TYPE_HREF | FIELD_ENUMERATION_HREF | FIELD_CLASSIFIER_HREF =>
if P.Attr_Element /= null then
P.Attr_Element.Set_Reference_Id (UBO.To_String (Value),
P.Profiles.all);
Log.Debug ("Attribute {0} has type {1}",
P.Attr_Element.Name, P.Attr_Element.Ref_Id);
end if;
-- Enumeration mapping.
when FIELD_ENUMERATION =>
P.Enumeration := new Gen.Model.XMI.Enum_Element (P.Model);
P.Enumeration.Set_Name (Value);
P.Enumeration.Set_Location (To_String (P.File) & P.Parser.Get_Location);
P.Enumeration.XMI_Id := UBO.To_Unbounded_String (P.Id);
if P.Package_Element /= null then
P.Enumeration.Parent := P.Package_Element.all'Access;
end if;
P.Model.Insert (P.Enumeration.XMI_Id, P.Enumeration.all'Access);
Log.Info ("Adding enumeration {0}", P.Enumeration.Name);
if P.Package_Element /= null then
P.Package_Element.Enums.Append (P.Enumeration.all'Access);
end if;
when FIELD_ENUMERATION_LITERAL =>
P.Enumeration.Add_Literal (Value, P.Name, P.Enumeration_Literal);
when FIELD_ENUMERATION_LITERAL_END =>
P.Enumeration_Literal.Set_Name (P.Name);
P.Enumeration_Literal := null;
when FIELD_STEREOTYPE_NAME =>
P.Stereotype := new Gen.Model.XMI.Stereotype_Element (P.Model);
P.Stereotype.Set_Name (Value);
P.Stereotype.Set_Location (To_String (P.File) & P.Parser.Get_Location);
when FIELD_STEREOTYPE_ID =>
P.Stereotype_Id := Value;
-- Stereotype mapping.
when FIELD_STEREOTYPE =>
if not UBO.Is_Null (P.Stereotype_Id) and P.Stereotype /= null then
P.Stereotype.XMI_Id := UBO.To_Unbounded_String (P.Stereotype_Id);
P.Model.Insert (P.Stereotype.XMI_Id, P.Stereotype.all'Access);
if P.Class_Element /= null then
P.Class_Element.Elements.Append (P.Stereotype.all'Access);
elsif P.Package_Element /= null then
P.Package_Element.Elements.Append (P.Stereotype.all'Access);
end if;
P.Stereotype := null;
end if;
when FIELD_STEREOTYPE_HREF =>
declare
S : constant Gen.Model.XMI.Ref_Type_Element_Access
:= new Gen.Model.XMI.Ref_Type_Element (P.Model);
begin
S.Set_Location (To_String (P.File) & P.Parser.Get_Location);
S.Set_Reference_Id (UBO.To_String (Value), P.Profiles.all);
if P.Enumeration_Literal /= null then
P.Enumeration_Literal.Stereotypes.Append (S.all'Access);
elsif P.Assos_End_Element /= null then
Log.Info ("Stereotype {0} added", UBO.To_String (Value));
P.Assos_End_Element.Stereotypes.Append (S.all'Access);
elsif P.Association /= null then
P.Association.Stereotypes.Append (S.all'Access);
elsif P.Attr_Element /= null then
P.Attr_Element.Stereotypes.Append (S.all'Access);
elsif P.Class_Element /= null then
P.Class_Element.Stereotypes.Append (S.all'Access);
elsif P.Package_Element /= null then
P.Package_Element.Stereotypes.Append (S.all'Access);
else
Log.Info ("Stereotype {0} ignored", UBO.To_String (Value));
end if;
end;
-- Tag definition mapping.
when FIELD_TAG_DEFINITION_NAME =>
P.Tag_Name := Value;
when FIELD_TAG_DEFINITION_ID =>
P.Tag_Definition := new Gen.Model.XMI.Tag_Definition_Element (P.Model);
P.Tag_Definition.Set_XMI_Id (Value);
P.Tag_Definition.Set_Location (To_String (P.File) & P.Parser.Get_Location);
P.Model.Insert (P.Tag_Definition.XMI_Id, P.Tag_Definition.all'Access);
when FIELD_TAG_DEFINITION =>
P.Tag_Definition.Set_Name (P.Tag_Name);
Log.Info ("Adding tag definition {0}", P.Tag_Definition.Name);
if P.Stereotype /= null then
P.Stereotype.Elements.Append (P.Tag_Definition.all'Access);
elsif P.Package_Element /= null then
P.Package_Element.Elements.Append (P.Tag_Definition.all'Access);
end if;
P.Tag_Definition := null;
when FIELD_COMMENT_ID =>
P.Comment := new Gen.Model.XMI.Comment_Element (P.Model);
P.Comment.Set_Location (To_String (P.File) & P.Parser.Get_Location);
P.Comment.XMI_Id := UBO.To_Unbounded_String (Value);
P.Ref_Id := UBO.Null_Object;
-- Comment mapping.
when FIELD_COMMENT =>
if P.Comment /= null then
P.Comment.Text := UBO.To_Unbounded_String (P.Value);
P.Comment.Ref_Id := UBO.To_Unbounded_String (P.Ref_Id);
P.Model.Insert (P.Comment.XMI_Id, P.Comment.all'Access);
end if;
P.Ref_Id := UBO.Null_Object;
P.Comment := null;
end case;
exception
when Util.Serialize.Mappers.Field_Error =>
raise;
when E : others =>
Log.Error ("Extraction of field {0} with value '{1}' failed",
XMI_Fields'Image (Field), UBO.To_String (Value));
Log.Error ("Cause", E);
raise;
end Set_Member;
package XMI_Mapper is
new Util.Serialize.Mappers.Record_Mapper (Element_Type => XMI_Info,
Element_Type_Access => XMI_Access,
Fields => XMI_Fields,
Set_Member => Set_Member);
XMI_Mapping : aliased XMI_Mapper.Mapper;
-- ------------------------------
-- After the configuration file is read, processes the node whose root
-- is passed in <b>Node</b> and initializes the <b>Model</b> with the information.
-- ------------------------------
procedure Initialize (Handler : in out Artifact;
Path : in String;
Node : in DOM.Core.Node;
Model : in out Gen.Model.Packages.Model_Definition'Class;
Context : in out Generator'Class) is
begin
Log.Debug ("Initializing query artifact for the configuration");
Gen.Artifacts.Artifact (Handler).Initialize (Path, Node, Model, Context);
end Initialize;
-- ------------------------------
-- Prepare the generation of the package:
-- o identify the column types which are used
-- o build a list of package for the with clauses.
-- ------------------------------
overriding
procedure Prepare (Handler : in out Artifact;
Model : in out Gen.Model.Packages.Model_Definition'Class;
Project : in out Gen.Model.Projects.Project_Definition'Class;
Context : in out Generator'Class) is
pragma Unreferenced (Project);
-- Collect the enum literal for the enum definition.
procedure Prepare_Enum_Literal (Enum : in out Gen.Model.Enums.Enum_Definition'Class;
Item : in Gen.Model.XMI.Model_Element_Access);
-- Register the enum in the model for the generation.
procedure Prepare_Enum (Pkg : in out Gen.Model.Packages.Package_Definition'Class;
Item : in Gen.Model.XMI.Model_Element_Access);
use Gen.Model.XMI;
use Gen.Model.Tables;
use Gen.Model.Beans;
-- Register the attribute in the table
procedure Prepare_Attribute (Table : in out Gen.Model.Tables.Table_Definition'Class;
Column : in Model_Element_Access);
-- Register the attribute in the bean definition.
procedure Prepare_Attribute (Bean : in out Gen.Model.Beans.Bean_Definition'Class;
Column : in Model_Element_Access);
-- Identify the UML association and create an entry for it in the table.
procedure Prepare_Association (Table : in out Gen.Model.Tables.Table_Definition'Class;
Node : in Model_Element_Access);
procedure Prepare_Parameter (Operation : in out
Gen.Model.Operations.Operation_Definition'Class;
Node : in Model_Element_Access);
-- Identify the UML operation and create an entry for it in the table.
procedure Prepare_Operation (Table : in out Gen.Model.Tables.Table_Definition'Class;
Node : in Model_Element_Access);
-- Prepare a UML/XMI class:
-- o if the class has the <<Dynamo.ADO.table>> stereotype, create a table definition.
-- o if the class has the <<Dynamo.AWA.bean>> stereotype, create a bean
procedure Prepare_Class (Pkg : in out Gen.Model.Packages.Package_Definition'Class;
Item : in Gen.Model.XMI.Model_Element_Access);
procedure Prepare_Type (Pkg : in out Gen.Model.Packages.Package_Definition'Class;
Item : in Gen.Model.XMI.Model_Element_Access);
-- Scan the package for the model generation.
procedure Prepare_Package (Id : in UString;
Item : in Gen.Model.XMI.Model_Element_Access);
procedure Prepare_Model (Key : in UString;
Model : in out Gen.Model.XMI.Model_Map.Map);
procedure Prepare_Profile (Id : in UString;
Item : in Gen.Model.XMI.Model_Element_Access);
-- ------------------------------
-- Register the attribute in the table
-- ------------------------------
procedure Prepare_Attribute (Table : in out Gen.Model.Tables.Table_Definition'Class;
Column : in Model_Element_Access) is
use Util.Beans.Objects;
Msg : constant String := Column.Get_Error_Message;
Sql : constant String := Column.Find_Tag_Value (Handler.Sql_Type_Tag, "");
Len : constant String := Column.Find_Tag_Value (Handler.Sql_Length_Tag, "");
C : Column_Definition_Access;
begin
Log.Info ("Prepare class attribute {0}", Column.Name);
if Msg'Length /= 0 then
Context.Error (Column.Get_Location & ": " & Msg);
end if;
Table.Add_Column (Column.Name, C);
C.Set_Comment (Column.Get_Comment);
C.Set_Location (Column.Get_Location);
if Column.all in Attribute_Element'Class then
declare
Attr : constant Attribute_Element_Access
:= Attribute_Element'Class (Column.all)'Access;
begin
if Attr.Data_Type /= null then
C.Set_Type (Attr.Data_Type.Get_Qualified_Name);
end if;
C.Not_Null := Attr.Multiplicity_Lower > 0;
C.Is_Key := Column.Has_Stereotype (Handler.PK_Stereotype);
C.Is_Version := Column.Has_Stereotype (Handler.Version_Stereotype);
C.Is_Auditable := Column.Has_Stereotype (Handler.Auditable_Stereotype);
C.Is_Updated := Attr.Changeability /= CHANGEABILITY_FROZEN;
C.Is_Inserted := True; -- Attr.Changeability = CHANGEABILITY_INSERT;
C.Sql_Type := To_UString (Sql);
if Column.Has_Stereotype (Handler.Not_Null_Stereotype) then
C.Not_Null := True;
end if;
if Column.Has_Stereotype (Handler.Nullable_Stereotype) then
C.Not_Null := False;
end if;
if C.Is_Version then
C.Not_Null := True;
end if;
if C.Is_Key then
C.Generator := To_Object (Column.Find_Tag_Value (Handler.Generator_Tag, ""));
end if;
if Len'Length > 0 then
C.Set_Sql_Length (Len, Context);
end if;
end;
end if;
end Prepare_Attribute;
-- ------------------------------
-- Register the attribute in the bean definition.
-- ------------------------------
procedure Prepare_Attribute (Bean : in out Gen.Model.Beans.Bean_Definition'Class;
Column : in Model_Element_Access) is
Msg : constant String := Column.Get_Error_Message;
C : Column_Definition_Access;
begin
Log.Info ("Prepare class attribute {0}", Column.Name);
if Msg'Length /= 0 then
Context.Error (Column.Get_Location & ": " & Msg);
end if;
Bean.Add_Attribute (Column.Name, C);
C.Set_Comment (Column.Get_Comment);
C.Set_Location (Column.Get_Location);
if Column.all in Attribute_Element'Class then
declare
Attr : constant Attribute_Element_Access
:= Attribute_Element'Class (Column.all)'Access;
begin
if Attr.Data_Type /= null then
C.Set_Type (To_String (Attr.Data_Type.Name));
end if;
C.Not_Null := Attr.Multiplicity_Lower > 0;
end;
end if;
end Prepare_Attribute;
-- ------------------------------
-- Identify the UML association and create an entry for it in the table.
-- ------------------------------
procedure Prepare_Association (Table : in out Gen.Model.Tables.Table_Definition'Class;
Node : in Model_Element_Access) is
A : Association_Definition_Access;
Assoc : constant Association_End_Element_Access
:= Association_End_Element'Class (Node.all)'Access;
Msg : constant String := Node.Get_Error_Message;
begin
Log.Info ("Prepare class association {0}", Assoc.Name);
if Msg'Length /= 0 then
Context.Error (Assoc.Get_Location & ": " & Msg);
end if;
if Assoc.Multiplicity_Upper /= 1 then
Context.Error (Assoc.Get_Location &
": multiple association '{0}' for table '{1}' is not supported.",
To_String (Assoc.Name), Table.Get_Name);
else
Table.Add_Association (Assoc.Name, A);
A.Set_Comment (Assoc.Get_Comment);
A.Set_Location (Assoc.Get_Location);
A.Set_Type (Assoc.Source_Element.Get_Qualified_Name);
A.Not_Null := Assoc.Multiplicity_Lower > 0;
-- If the <<use foreign key>> stereotype is set on the association, to not use
-- the Ada tagged object but create an attribute using the foreign key type.
A.Use_Foreign_Key_Type := Node.Parent.Has_Stereotype (Handler.Use_FK_Stereotype);
A.Is_Key := Node.Has_Stereotype (Handler.PK_Stereotype);
if A.Use_Foreign_Key_Type then
Log.Info ("Association {0} type is using foreign key", Assoc.Name);
end if;
end if;
end Prepare_Association;
procedure Prepare_Parameter (Operation : in out
Gen.Model.Operations.Operation_Definition'Class;
Node : in Model_Element_Access) is
Param : constant Attribute_Element_Access := Attribute_Element'Class (Node.all)'Access;
P : Gen.Model.Operations.Parameter_Definition_Access;
begin
if Param.Data_Type /= null then
Log.Info ("Prepare operation parameter {0} : {1}",
Param.Name, Param.Data_Type.Get_Qualified_Name);
Operation.Add_Parameter (Param.Name,
To_UString (Param.Data_Type.Get_Qualified_Name), P);
end if;
end Prepare_Parameter;
-- ------------------------------
-- Identify the UML operation and create an entry for it in the table.
-- ------------------------------
procedure Prepare_Operation (Table : in out Gen.Model.Tables.Table_Definition'Class;
Node : in Model_Element_Access) is
Op : constant Operation_Element_Access := Operation_Element'Class (Node.all)'Access;
Msg : constant String := Node.Get_Error_Message;
Operation : Gen.Model.Operations.Operation_Definition_Access;
begin
Log.Info ("Prepare class operation {0}", Op.Name);
if Msg'Length /= 0 then
Context.Error (Op.Get_Location & ": " & Msg);
end if;
Table.Add_Operation (Op.Name, Operation);
Operation.Set_Location (Op.Get_Location);
Operation.Set_Comment (Op.Get_Comment);
Iterate_For_Operation (Operation.all, Op.Elements, Prepare_Parameter'Access);
end Prepare_Operation;
-- ------------------------------
-- Prepare a UML/XMI class:
-- o if the class has the <<Dynamo.ADO.table>> stereotype, create a table definition.
-- o if the class has the <<Dynamo.AWA.bean>> stereotype, create a bean
-- ------------------------------
procedure Prepare_Class (Pkg : in out Gen.Model.Packages.Package_Definition'Class;
Item : in Gen.Model.XMI.Model_Element_Access) is
Class : constant Class_Element_Access := Class_Element'Class (Item.all)'Access;
Name : constant UString := Gen.Utils.Qualify_Name (Pkg.Name, Class.Name);
begin
Log.Info ("Prepare class {0}", Name);
if Item.Has_Stereotype (Handler.Table_Stereotype) then
Log.Debug ("Class {0} recognized as a database table", Name);
declare
Table : constant Table_Definition_Access := Gen.Model.Tables.Create_Table (Name);
Has_List : constant String := Item.Find_Tag_Value (Handler.Has_List_Tag, "true");
T_Name : constant String := Item.Find_Tag_Value (Handler.Table_Name_Tag, "");
begin
Log.Info ("Has list: {0}", Has_List);
Table.Set_Comment (Item.Get_Comment);
Table.Set_Location (Item.Get_Location);
Model.Register_Table (Table);
Table.Has_List := Has_List = "true";
Table.Is_Serializable := Item.Has_Stereotype (Handler.Serialize_Stereotype);
if T_Name'Length /= 0 then
Log.Info ("Using table name {0}", Name);
Table.Table_Name := To_UString (T_Name);
end if;
Iterate_For_Table (Table.all, Class.Attributes, Prepare_Attribute'Access);
Iterate_For_Table (Table.all, Class.Associations, Prepare_Association'Access);
end;
elsif Item.Has_Stereotype (Handler.Bean_Stereotype)
or Item.Has_Stereotype (Handler.Limited_Bean_Stereotype)
then
Log.Debug ("Class {0} recognized as a bean", Name);
declare
Bean : constant Bean_Definition_Access := Gen.Model.Beans.Create_Bean (Name);
begin
Model.Register_Bean (Bean);
Bean.Set_Comment (Item.Get_Comment);
Bean.Set_Location (Item.Get_Location);
Bean.Target := Name;
Bean.Is_Limited := Item.Has_Stereotype (Handler.Limited_Bean_Stereotype);
Bean.Is_Serializable := Item.Has_Stereotype (Handler.Serialize_Stereotype);
if Class.Parent_Class /= null then
Log.Info ("Bean {0} inherit from {1}", Name,
To_String (Class.Parent_Class.Name));
Bean.Parent_Name := To_UString (Class.Parent_Class.Get_Qualified_Name);
end if;
Iterate_For_Bean (Bean.all, Class.Attributes, Prepare_Attribute'Access);
Iterate_For_Table (Bean.all, Class.Associations, Prepare_Association'Access);
Iterate_For_Table (Bean.all, Class.Operations, Prepare_Operation'Access);
end;
else
Log.Info ("UML class {0} not generated: no <<Bean>> and no <<Table>> stereotype",
To_String (Name));
end if;
exception
when E : others =>
Log.Error ("Exception", E);
end Prepare_Class;
-- ------------------------------
-- Collect the enum literal for the enum definition.
-- ------------------------------
procedure Prepare_Enum_Literal (Enum : in out Gen.Model.Enums.Enum_Definition'Class;
Item : in Gen.Model.XMI.Model_Element_Access) is
Literal : Gen.Model.Enums.Value_Definition_Access;
Value : constant String := Item.Find_Tag_Value (Handler.Literal_Tag, "");
begin
Log.Info ("Prepare enum literal {0}", Item.Name);
Enum.Add_Value (To_String (Item.Name), Literal);
if Value'Length > 0 then
begin
Literal.Number := Natural'Value (Value);
exception
when others =>
Context.Error (Item.Get_Location &
": value '{0}' for enum literal '{1}' must be a number",
Value, To_String (Item.Name));
end;
end if;
end Prepare_Enum_Literal;
-- ------------------------------
-- Register the enum in the model for the generation.
-- ------------------------------
procedure Prepare_Type (Pkg : in out Gen.Model.Packages.Package_Definition'Class;
Item : in Gen.Model.XMI.Model_Element_Access) is
Data_Type : constant Data_Type_Element_Access
:= Data_Type_Element'Class (Item.all)'Access;
Name : constant String := Data_Type.Get_Qualified_Name;
Msg : constant String := Data_Type.Get_Error_Message;
Sql : constant String := Data_Type.Find_Tag_Value (Handler.Sql_Type_Tag, "");
Stype : Gen.Model.Stypes.Stype_Definition_Access;
begin
Log.Info ("Prepare data type {0} - {1}", Name, Sql);
if Msg'Length > 0 then
Context.Error (Item.Get_Location & ": " & Msg);
end if;
if Data_Type.Parent_Type /= null then
Stype := Gen.Model.Stypes.Create_Stype
(To_UString (Name),
To_UString (Data_Type.Parent_Type.Get_Qualified_Name));
else
Stype := Gen.Model.Stypes.Create_Stype (To_UString (Name),
Null_Unbounded_String);
end if;
Stype.Set_Comment (Item.Get_Comment);
Stype.Set_Location (Item.Get_Location);
Stype.Sql_Type := To_UString (Sql);
Model.Register_Stype (Stype);
exception
when Gen.Model.Name_Exist =>
-- Ignore the Name_Exist exception for pre-defined package
-- because the type is already defined through a XML mapping definition.
if not Pkg.Is_Predefined then
raise;
end if;
end Prepare_Type;
-- ------------------------------
-- Register the enum in the model for the generation.
-- ------------------------------
procedure Prepare_Enum (Pkg : in out Gen.Model.Packages.Package_Definition'Class;
Item : in Gen.Model.XMI.Model_Element_Access) is
pragma Unreferenced (Pkg);
Name : constant String := Item.Get_Qualified_Name;
Msg : constant String := Item.Get_Error_Message;
Enum : Gen.Model.Enums.Enum_Definition_Access;
Sql : constant String := Item.Find_Tag_Value (Handler.Sql_Type_Tag, "");
begin
Log.Info ("Prepare enum {0}", Name);
if Msg'Length > 0 then
Context.Error (Item.Get_Location & ": " & Msg);
end if;
Enum := Gen.Model.Enums.Create_Enum (To_UString (Name));
Enum.Set_Comment (Item.Get_Comment);
Enum.Set_Location (Item.Get_Location);
Enum.Sql_Type := To_UString (Sql);
Model.Register_Enum (Enum);
Iterate_For_Enum (Enum.all, Item.Elements, Prepare_Enum_Literal'Access);
end Prepare_Enum;
-- ------------------------------
-- Scan the package for the model generation.
-- ------------------------------
procedure Prepare_Package (Id : in UString;
Item : in Gen.Model.XMI.Model_Element_Access) is
pragma Unreferenced (Id);
Pkg : constant Package_Element_Access := Package_Element'Class (Item.all)'Access;
Name : constant String := Pkg.Get_Qualified_Name;
P : Gen.Model.Packages.Package_Definition_Access;
begin
if Pkg.Is_Profile then
return;
end if;
Log.Info ("Prepare package {0}", Name);
Model.Register_Package (To_UString (Name), P);
if Item.Has_Stereotype (Handler.Data_Model_Stereotype) then
Log.Info ("Package {0} has the <<DataModel>> stereotype", Name);
else
Log.Info ("Package {0} does not have the <<DataModel>> stereotype.", Name);
-- Do not generate packages that don't have the <<DataModel>> stereotype.
-- But still get their UML definition so that we can use their classes.
P.Set_Predefined;
end if;
P.Set_Comment (Pkg.Get_Comment);
Iterate_For_Package (P.all, Pkg.Types, Prepare_Type'Access);
Iterate_For_Package (P.all, Pkg.Enums, Prepare_Enum'Access);
Iterate_For_Package (P.all, Pkg.Classes, Prepare_Class'Access);
end Prepare_Package;
-- ------------------------------
-- Scan the profile packages for the model generation.
-- ------------------------------
procedure Prepare_Profile (Id : in UString;
Item : in Gen.Model.XMI.Model_Element_Access) is
pragma Unreferenced (Id);
Pkg : constant Package_Element_Access := Package_Element'Class (Item.all)'Access;
Name : constant String := Pkg.Get_Qualified_Name;
P : Gen.Model.Packages.Package_Definition_Access;
begin
if not Pkg.Is_Profile then
return;
end if;
Log.Info ("Prepare profile package {0}", Name);
Model.Register_Package (To_UString (Name), P);
P.Set_Predefined;
P.Set_Comment (Pkg.Get_Comment);
-- Iterate_For_Package (P.all, Pkg.Types, Prepare_Type'Access);
Iterate_For_Package (P.all, Pkg.Enums, Prepare_Enum'Access);
Iterate_For_Package (P.all, Pkg.Classes, Prepare_Class'Access);
end Prepare_Profile;
procedure Prepare_Model (Key : in UString;
Model : in out Gen.Model.XMI.Model_Map.Map) is
begin
Log.Info ("Preparing model {0}", Key);
Gen.Model.XMI.Iterate (Model => Model,
On => Gen.Model.XMI.XMI_PACKAGE,
Process => Prepare_Package'Access);
end Prepare_Model;
Iter : Gen.Model.XMI.UML_Model_Map.Cursor := Handler.Nodes.First;
begin
Log.Debug ("Preparing the XMI model for generation");
Gen.Model.XMI.Reconcile (Handler.Nodes,
Context.Get_Parameter (Gen.Configs.GEN_DEBUG_ENABLE));
-- Get the Dynamo stereotype definitions.
Handler.Table_Stereotype := Find_Stereotype (Handler.Nodes,
"Dynamo.xmi",
"ADO.Table",
Gen.Model.XMI.BY_NAME);
Handler.PK_Stereotype := Find_Stereotype (Handler.Nodes,
"Dynamo.xmi",
"ADO.PK",
Gen.Model.XMI.BY_NAME);
Handler.FK_Stereotype := Find_Stereotype (Handler.Nodes,
"Dynamo.xmi",
"ADO.FK",
Gen.Model.XMI.BY_NAME);
Handler.Version_Stereotype := Find_Stereotype (Handler.Nodes,
"Dynamo.xmi",
"ADO.Version",
Gen.Model.XMI.BY_NAME);
Handler.Nullable_Stereotype := Find_Stereotype (Handler.Nodes,
"Dynamo.xmi",
"ADO.Nullable",
Gen.Model.XMI.BY_NAME);
Handler.Not_Null_Stereotype := Find_Stereotype (Handler.Nodes,
"Dynamo.xmi",
"ADO.Not Null",
Gen.Model.XMI.BY_NAME);
Handler.Data_Model_Stereotype := Find_Stereotype (Handler.Nodes,
"Dynamo.xmi",
"ADO.DataModel",
Gen.Model.XMI.BY_NAME);
Handler.Use_FK_Stereotype := Find_Stereotype (Handler.Nodes,
"Dynamo.xmi",
"ADO.use foreign key",
Gen.Model.XMI.BY_NAME);
Handler.Auditable_Stereotype := Find_Stereotype (Handler.Nodes,
"Dynamo.xmi",
"ADO.Auditable",
Gen.Model.XMI.BY_NAME);
Handler.Bean_Stereotype := Find_Stereotype (Handler.Nodes,
"Dynamo.xmi",
"AWA.Bean",
Gen.Model.XMI.BY_NAME);
Handler.Limited_Bean_Stereotype := Find_Stereotype (Handler.Nodes,
"Dynamo.xmi",
"AWA.Limited_Bean",
Gen.Model.XMI.BY_NAME);
Handler.Serialize_Stereotype := Find_Stereotype (Handler.Nodes,
"Dynamo.xmi",
"ASF.Serializable",
Gen.Model.XMI.BY_NAME);
Handler.Has_List_Tag := Find_Tag_Definition (Handler.Nodes,
"Dynamo.xmi",
"ADO.Table.@dynamo.table.hasList",
Gen.Model.XMI.BY_NAME);
Handler.Table_Name_Tag := Find_Tag_Definition (Handler.Nodes,
"Dynamo.xmi",
"<EMAIL>.<EMAIL>",
Gen.Model.XMI.BY_NAME);
Handler.Sql_Type_Tag := Find_Tag_Definition (Handler.Nodes,
"Dynamo.xmi",
"<EMAIL>",
Gen.Model.XMI.BY_NAME);
Handler.Sql_Length_Tag := Find_Tag_Definition (Handler.Nodes,
"Dynamo.xmi",
"<EMAIL>",
Gen.Model.XMI.BY_NAME);
Handler.Generator_Tag := Find_Tag_Definition (Handler.Nodes,
"Dynamo.xmi",
"<EMAIL>",
Gen.Model.XMI.BY_NAME);
Handler.Literal_Tag := Find_Tag_Definition (Handler.Nodes,
"Dynamo.xmi",
"<EMAIL>",
Gen.Model.XMI.BY_NAME);
for Model of Handler.Nodes loop
Gen.Model.XMI.Iterate (Model => Model,
On => Gen.Model.XMI.XMI_PACKAGE,
Process => Prepare_Profile'Access);
end loop;
while Gen.Model.XMI.UML_Model_Map.Has_Element (Iter) loop
Handler.Nodes.Update_Element (Iter, Prepare_Model'Access);
Gen.Model.XMI.UML_Model_Map.Next (Iter);
end loop;
if Model.Has_Packages then
Context.Add_Generation (Name => GEN_PACKAGE_SPEC, Mode => ITERATION_PACKAGE,
Mapping => Gen.Model.Mappings.ADA_MAPPING);
Context.Add_Generation (Name => GEN_PACKAGE_BODY, Mode => ITERATION_PACKAGE,
Mapping => Gen.Model.Mappings.ADA_MAPPING);
end if;
end Prepare;
-- ------------------------------
-- Read the UML profiles that are referenced by the current models.
-- The UML profiles are installed in the UML config directory for dynamo's installation.
-- ------------------------------
procedure Read_Profiles (Handler : in out Artifact;
Context : in out Generator'Class) is
Path : constant String := Context.Get_Parameter (Gen.Configs.GEN_UML_DIR);
Iter : Util.Strings.Sets.Cursor := Handler.Profiles.First;
begin
while Util.Strings.Sets.Has_Element (Iter) loop
declare
Profile : constant String := Util.Strings.Sets.Element (Iter);
begin
if not Handler.Nodes.Contains (To_UString (Profile)) then
Log.Info ("Reading the UML profile {0}", Profile);
-- We have a profile, load the UML model.
Handler.Read_Model (Util.Files.Compose (Path, Profile), Context, True);
-- Verify that we have the model, report an error and remove it from the profiles.
if not Handler.Nodes.Contains (To_UString (Profile)) then
Context.Error ("UML profile {0} was not found", Profile);
Handler.Profiles.Delete (Profile);
end if;
-- And start again from the beginning since new profiles could be necessary.
Iter := Handler.Profiles.First;
else
Util.Strings.Sets.Next (Iter);
end if;
end;
end loop;
end Read_Profiles;
-- ------------------------------
-- Read the UML/XMI model file.
-- ------------------------------
procedure Read_Model (Handler : in out Artifact;
File : in String;
Context : in out Generator'Class;
Is_Predefined : in Boolean := False) is
procedure Read (Key : in UString;
Model : in out Gen.Model.XMI.Model_Map.Map);
procedure Read (Key : in UString;
Model : in out Gen.Model.XMI.Model_Map.Map) is
pragma Unreferenced (Key);
N : constant Natural := Util.Strings.Rindex (File, '.');
Name : constant String := Ada.Directories.Base_Name (File);
type Parser is new Util.Serialize.IO.XML.Parser with null record;
-- Report an error while parsing the input stream. The error message will be reported
-- on the logger associated with the parser. The parser will be set as in error so that
-- the <b>Has_Error</b> function will return True after parsing the whole file.
overriding
procedure Error (Handler : in out Parser;
Message : in String);
-- ------------------------------
-- Report an error while parsing the input stream. The error message will be reported
-- on the logger associated with the parser. The parser will be set as in error so that
-- the <b>Has_Error</b> function will return True after parsing the whole file.
-- ------------------------------
overriding
procedure Error (Handler : in out Parser;
Message : in String) is
begin
if Ada.Strings.Fixed.Index (Message, "Invalid absolute IRI") > 0
and then Ada.Strings.Fixed.Index (Message, "org.omg.xmi.namespace.UML") > 0
then
return;
end if;
Context.Error ("{0}: {1}",
Name & ".xmi" & Parser'Class (Handler).Get_Location,
Message);
end Error;
Reader : aliased Parser;
Mapper : Util.Serialize.Mappers.Processing;
Info : aliased XMI_Info;
Def_Type : constant String := Context.Get_Parameter (Gen.Configs.GEN_UML_DEFAULT_TYPE);
begin
Info.Model := Model'Unchecked_Access;
Info.Parser := Reader'Unchecked_Access;
Info.Profiles := Handler.Profiles'Unchecked_Access;
Info.File := To_UString (Name & ".xmi");
Info.Default_Type := To_UString (Def_Type);
Info.Is_Profile := Is_Predefined;
Mapper.Add_Mapping ("XMI", XMI_Mapping'Access);
if Context.Get_Parameter (Gen.Configs.GEN_DEBUG_ENABLE) then
Mapper.Dump (Log);
end if;
XMI_Mapper.Set_Context (Mapper, Info'Unchecked_Access);
if N > 0 and then File (N .. File'Last) = ".zargo" then
declare
Pipe : aliased Util.Streams.Pipes.Pipe_Stream;
Buffer : Util.Streams.Buffered.Input_Buffer_Stream;
begin
Pipe.Open ("unzip -cq " & File & " " & Name & ".xmi",
Util.Processes.READ);
Buffer.Initialize (Pipe'Unchecked_Access, 4096);
Reader.Parse (Buffer, Mapper);
Pipe.Close;
end;
else
Reader.Parse (File, Mapper);
end if;
end Read;
UML : Gen.Model.XMI.Model_Map.Map;
Name : constant UString := To_UString (Ada.Directories.Simple_Name (File));
begin
Log.Info ("Reading XMI {0}", File);
Handler.Initialized := True;
Handler.Nodes.Include (Name, UML);
Handler.Nodes.Update_Element (Handler.Nodes.Find (Name),
Read'Access);
Handler.Read_Profiles (Context);
end Read_Model;
begin
-- Define the XMI mapping.
XMI_Mapping.Add_Mapping ("**/Package/@name", FIELD_PACKAGE_NAME);
XMI_Mapping.Add_Mapping ("**/Package/@xmi.id", FIELD_PACKAGE_ID);
XMI_Mapping.Add_Mapping ("**/Package", FIELD_PACKAGE_END);
XMI_Mapping.Add_Mapping ("**/Class/@name", FIELD_CLASS_NAME);
XMI_Mapping.Add_Mapping ("**/Class/@xmi.id", FIELD_CLASS_ID);
XMI_Mapping.Add_Mapping ("**/Class/@visibility", FIELD_CLASS_VISIBILITY);
XMI_Mapping.Add_Mapping ("**/Class", FIELD_CLASS_END);
-- Generalization (limited to single inheritance).
XMI_Mapping.Add_Mapping ("**/Generalization/@xmi.idref", FIELD_GENERALIZATION_ID);
XMI_Mapping.Add_Mapping ("**/Generalization/@xmi.href", FIELD_GENERALIZATION_ID);
XMI_Mapping.Add_Mapping ("**/Generalization/@xmi.id", FIELD_GENERALIZATION_ID);
XMI_Mapping.Add_Mapping ("**/Generalization/Generalization.child/Class/@xmi.idref",
FIELD_GENERALIZATION_CHILD_ID);
XMI_Mapping.Add_Mapping ("**/Generalization/Generalization.parent/Class/@xmi.idref",
FIELD_GENERALIZATION_PARENT_ID);
XMI_Mapping.Add_Mapping ("**/Generalization/Generalization.child/DataType/@xmi.idref",
FIELD_GENERALIZATION_CHILD_ID);
XMI_Mapping.Add_Mapping ("**/Generalization/Generalization.parent/DataType/@xmi.idref",
FIELD_GENERALIZATION_PARENT_ID);
XMI_Mapping.Add_Mapping ("**/Generalization/Generalization.parent/DataType/@href",
FIELD_GENERALIZATION_PARENT_ID);
XMI_Mapping.Add_Mapping ("**/Generalization", FIELD_GENERALIZATION_END);
-- Class attribute mapping.
XMI_Mapping.Add_Mapping ("**/Attribute/@name", FIELD_ATTRIBUTE_NAME);
XMI_Mapping.Add_Mapping ("**/Attribute/@xmi.id", FIELD_ATTRIBUTE_ID);
XMI_Mapping.Add_Mapping ("**/Attribute/@visibility", FIELD_ATTRIBUTE_VISIBILITY);
XMI_Mapping.Add_Mapping ("**/Attribute/@changeability", FIELD_ATTRIBUTE_CHANGEABILITY);
XMI_Mapping.Add_Mapping ("**/Attribute.initialValue/Expression/@body",
FIELD_ATTRIBUTE_INITIAL_VALUE);
XMI_Mapping.Add_Mapping ("**/Attribute", FIELD_ATTRIBUTE);
-- Field multiplicity.
XMI_Mapping.Add_Mapping ("**/MultiplicityRange/@lower", FIELD_MULTIPLICITY_LOWER);
XMI_Mapping.Add_Mapping ("**/MultiplicityRange/@upper", FIELD_MULTIPLICITY_UPPER);
-- Operation mapping.
XMI_Mapping.Add_Mapping ("**/Operation/@name", FIELD_OPERATION_NAME);
XMI_Mapping.Add_Mapping ("**/Operation/@xmi.id", FIELD_OPERATION_ID);
XMI_Mapping.Add_Mapping ("**/Operation", FIELD_OPERATION_END);
XMI_Mapping.Add_Mapping ("**/Parameter/@xmi.id", FIELD_PARAMETER_ID);
XMI_Mapping.Add_Mapping ("**/Parameter/@name", FIELD_PARAMETER_NAME);
XMI_Mapping.Add_Mapping ("**/Parameter/@kind", FIELD_PARAMETER_KIND);
XMI_Mapping.Add_Mapping ("**/Parameter", FIELD_PARAMETER_END);
XMI_Mapping.Add_Mapping ("**/Parameter/Parameter.type/Class/@xmi.idref", FIELD_CLASSIFIER_HREF);
XMI_Mapping.Add_Mapping ("**/Parameter/Parameter.type/Class/@xmi.href", FIELD_CLASSIFIER_HREF);
XMI_Mapping.Add_Mapping ("**/Parameter/Parameter.type/Class/@href", FIELD_CLASSIFIER_HREF);
XMI_Mapping.Add_Mapping ("**/Parameter/Parameter.type/DataType/@xmi.href",
FIELD_CLASSIFIER_HREF);
XMI_Mapping.Add_Mapping ("**/Parameter/Parameter.type/DataType/@href", FIELD_CLASSIFIER_HREF);
-- Association mapping.
XMI_Mapping.Add_Mapping ("**/Association/@name", FIELD_ASSOCIATION_NAME);
XMI_Mapping.Add_Mapping ("**/Association/@xmi.id", FIELD_ASSOCIATION_ID);
XMI_Mapping.Add_Mapping ("**/Association", FIELD_ASSOCIATION);
-- Association end mapping.
XMI_Mapping.Add_Mapping ("**/AssociationEnd/@name", FIELD_ASSOCIATION_END_NAME);
XMI_Mapping.Add_Mapping ("**/AssociationEnd/<EMAIL>", FIELD_ASSOCIATION_END_ID);
XMI_Mapping.Add_Mapping ("**/AssociationEnd/@visibility", FIELD_ASSOCIATION_END_VISIBILITY);
XMI_Mapping.Add_Mapping ("**/AssociationEnd/@isNavigable", FIELD_ASSOCIATION_END_NAVIGABLE);
XMI_Mapping.Add_Mapping ("**/AssociationEnd", FIELD_ASSOCIATION_END);
XMI_Mapping.Add_Mapping ("**/AssociationEnd.participant/Class/@xmi.idref",
FIELD_ASSOCIATION_CLASS_ID);
XMI_Mapping.Add_Mapping ("**/AssociationEnd.participant/Class/@href",
FIELD_ASSOCIATION_CLASS_ID);
-- Comment mapping.
XMI_Mapping.Add_Mapping ("**/Comment/@xmi.id", FIELD_COMMENT_ID);
XMI_Mapping.Add_Mapping ("**/Comment/@body", FIELD_VALUE);
XMI_Mapping.Add_Mapping ("**/Comment/Comment.annotatedElement/Class/@xmi.idref", FIELD_ID_REF);
XMI_Mapping.Add_Mapping ("**/Comment/Comment.annotatedElement/Attribute/@xmi.idref",
FIELD_ID_REF);
XMI_Mapping.Add_Mapping ("**/Comment/Comment.annotatedElement/Enumeration/@xmi.idref",
FIELD_ID_REF);
XMI_Mapping.Add_Mapping ("**/Comment/Comment.annotatedElement/AssociationEnd/@xmi.idref",
FIELD_ID_REF);
XMI_Mapping.Add_Mapping ("**/Comment", FIELD_COMMENT);
-- Tagged value mapping.
XMI_Mapping.Add_Mapping ("**/TaggedValue/@xmi.id", FIELD_TAGGED_ID);
XMI_Mapping.Add_Mapping ("**/TaggedValue/TaggedValue.dataValue", FIELD_VALUE);
XMI_Mapping.Add_Mapping ("**/TaggedValue/TaggedValue.type/@xmi.idref", FIELD_ID_REF);
XMI_Mapping.Add_Mapping ("**/TaggedValue/TaggedValue.type/TagDefinition/@xmi.idref",
FIELD_ID_REF);
XMI_Mapping.Add_Mapping ("**/TaggedValue/TaggedValue.type/TagDefinition/@href", FIELD_HREF);
XMI_Mapping.Add_Mapping ("**/TaggedValue", FIELD_TAGGED_VALUE);
-- Tag definition mapping.
XMI_Mapping.Add_Mapping ("**/TagDefinition/@xmi.id", FIELD_TAG_DEFINITION_ID);
XMI_Mapping.Add_Mapping ("**/TagDefinition/@name", FIELD_TAG_DEFINITION_NAME);
XMI_Mapping.Add_Mapping ("**/TagDefinition", FIELD_TAG_DEFINITION);
-- Stereotype mapping.
XMI_Mapping.Add_Mapping ("**/Stereotype/@href", FIELD_STEREOTYPE_HREF);
XMI_Mapping.Add_Mapping ("**/Stereotype/@xmi.id", FIELD_STEREOTYPE_ID);
XMI_Mapping.Add_Mapping ("**/Stereotype/@name", FIELD_STEREOTYPE_NAME);
XMI_Mapping.Add_Mapping ("**/Stereotype", FIELD_STEREOTYPE);
-- Enumeration mapping.
XMI_Mapping.Add_Mapping ("**/Enumeration/@xmi.id", FIELD_ID);
XMI_Mapping.Add_Mapping ("**/Enumeration/@name", FIELD_ENUMERATION);
XMI_Mapping.Add_Mapping ("**/Enumeration/Enumeration.literal/EnumerationLiteral/@xmi.id",
FIELD_ENUMERATION_LITERAL);
XMI_Mapping.Add_Mapping ("**/Enumeration/Enumeration.literal/EnumerationLiteral/@name",
FIELD_NAME);
XMI_Mapping.Add_Mapping ("**/Enumeration/Enumeration.literal/EnumerationLiteral",
FIELD_ENUMERATION_LITERAL_END);
XMI_Mapping.Add_Mapping ("**/Enumeration/@href", FIELD_ENUMERATION_HREF);
XMI_Mapping.Add_Mapping ("**/Enumeration/@xmi.idref", FIELD_ENUMERATION_HREF);
XMI_Mapping.Add_Mapping ("**/Classifier/@xmi.idref", FIELD_CLASSIFIER_HREF);
XMI_Mapping.Add_Mapping ("**/Classifier/@href", FIELD_CLASSIFIER_HREF);
XMI_Mapping.Add_Mapping ("**/Dependency.client/Class/@xmi.idref", FIELD_CLASSIFIER_HREF);
XMI_Mapping.Add_Mapping ("**/Dependency.supplier/Class/@xmi.idref", FIELD_CLASSIFIER_HREF);
-- Data type mapping.
XMI_Mapping.Add_Mapping ("**/DataType/<EMAIL>", FIELD_ID);
XMI_Mapping.Add_Mapping ("**/DataType/@name", FIELD_DATA_TYPE_NAME);
XMI_Mapping.Add_Mapping ("**/DataType", FIELD_DATA_TYPE);
XMI_Mapping.Add_Mapping ("**/DataType/@href", FIELD_DATA_TYPE_HREF);
XMI_Mapping.Add_Mapping ("**/DataType/@xmi.idref", FIELD_DATA_TYPE_HREF);
XMI_Mapping.Add_Mapping ("**/StructuralFeature.type/Class/@xmi.idref",
FIELD_DATA_TYPE_HREF);
end Gen.Artifacts.XMI;
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_18176_1267.asm | ljhsiun2/medusa | 9 | 165052 | .global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r13
push %r9
push %rbx
push %rdx
// Load
lea addresses_WT+0x1af07, %rdx
add $57594, %rbx
movb (%rdx), %r13b
nop
nop
nop
add $22993, %rdx
// Load
lea addresses_RW+0x11b07, %r9
clflush (%r9)
nop
nop
add $57110, %rbx
vmovups (%r9), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $0, %xmm0, %r10
nop
nop
nop
xor %rdx, %rdx
// Faulty Load
lea addresses_UC+0x2107, %rdx
nop
nop
nop
nop
sub $59528, %r12
movb (%rdx), %r13b
lea oracles, %rdx
and $0xff, %r13
shlq $12, %r13
mov (%rdx,%r13,1), %r13
pop %rdx
pop %rbx
pop %r9
pop %r13
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'37': 18176}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
|
tests/saatana-crypto-stream_tools.adb | HeisenbugLtd/Saatana | 10 | 20628 | ------------------------------------------------------------------------------
-- Copyright (C) 2017-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);
package body Saatana.Crypto.Stream_Tools with
SPARK_Mode => Off
is
function To_Stream (Value : in String) return General_Stream;
function To_Stream (Value : in String) return General_Stream is
Result : General_Stream (0 .. Value'Length / 2 - 1);
begin
for I in Result'Range loop
Convert_Hex_Byte :
declare
Str_Idx : constant Positive := Value'First + Natural (I) * 2;
begin
Result (I) := Byte'Value ("16#" & Value (Str_Idx .. Str_Idx + 1) & "#");
end Convert_Hex_Byte;
end loop;
return Result;
end To_Stream;
function To_Stream (Value : in String) return Ciphertext_Stream_Access is
begin
return new Ciphertext_Stream'(Ciphertext_Stream (General_Stream'(To_Stream (Value))));
end To_Stream;
function To_Stream (Value : in String) return Key_Stream_Access is
begin
return new Key_Stream'(Key_Stream (General_Stream'(To_Stream (Value))));
end To_Stream;
function To_Stream (Value : in String) return MAC_Stream_Access is
begin
return new MAC_Stream'(MAC_Stream (General_Stream'(To_Stream (Value))));
end To_Stream;
function To_Stream (Value : in String) return Nonce_Stream_Access is
begin
return new Nonce_Stream'(Nonce_Stream (General_Stream'(To_Stream (Value))));
end To_Stream;
function To_Stream (Value : in String) return Plaintext_Stream_Access is
begin
return new Plaintext_Stream'(Plaintext_Stream (General_Stream'(To_Stream (Value))));
end To_Stream;
end Saatana.Crypto.Stream_Tools;
|
programs/oeis/166/A166350.asm | karttu/loda | 0 | 13888 | <filename>programs/oeis/166/A166350.asm
; A166350: Table T(n,m) = m! read by rows.
; 1,1,2,1,2,6,1,2,6,24,1,2,6,24,120,1,2,6,24,120,720,1,2,6,24,120,720,5040,1,2,6,24,120,720,5040,40320,1,2,6,24,120,720,5040,40320,362880,1,2,6,24,120,720,5040,40320,362880,3628800,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600,6227020800,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600,6227020800,87178291200,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600,6227020800,87178291200,1307674368000,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600,6227020800,87178291200,1307674368000,20922789888000,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600,6227020800,87178291200,1307674368000,20922789888000,355687428096000,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600,6227020800,87178291200,1307674368000,20922789888000,355687428096000,6402373705728000,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600,6227020800,87178291200,1307674368000,20922789888000,355687428096000,6402373705728000
mov $2,1
add $2,$0
lpb $0,1
mov $1,$0
mul $0,2
sub $0,$2
trn $0,1
mov $2,$1
lpe
fac $1
|
alloy4fun_models/trashltl/models/11/FPYkGTdx2w7RwKF2L.als | Kaixi26/org.alloytools.alloy | 0 | 2484 | open main
pred idFPYkGTdx2w7RwKF2L_prop12 {
eventually always some f:File | f not in Trash implies f in Trash'
}
pred __repair { idFPYkGTdx2w7RwKF2L_prop12 }
check __repair { idFPYkGTdx2w7RwKF2L_prop12 <=> prop12o } |
LIB/DLLKop32/TSoft_Koder.asm | stasinek/Koperek_VCL | 0 | 721 | <filename>LIB/DLLKop32/TSoft_Koder.asm
.386p
ifdef ??version
if ??version GT 500H
.mmx
endif
endif
model flat
ifndef ??version
?debug macro
endm
endif
?debug S "C:\Program Files\Borland\CBuilder5\Projects\OBSOLETE\PROGS\Koperek.VCL\LIB\DLLKop32\TSoft_Koder.cpp"
?debug T "C:\Program Files\Borland\CBuilder5\Projects\OBSOLETE\PROGS\Koperek.VCL\LIB\DLLKop32\TSoft_Koder.cpp"
_TEXT segment dword public use32 'CODE'
_TEXT ends
_DATA segment dword public use32 'DATA'
_DATA ends
_BSS segment dword public use32 'BSS'
_BSS ends
DGROUP group _BSS,_DATA
_DATA segment dword public use32 'DATA'
align 4
_CRC32_tab label dword
dd 0
dd 1996959894
dd -301047508
dd -1727442502
dd 124634137
dd 1886057615
dd -379345611
dd -1637575261
dd 249268274
dd 2044508324
dd -522852066
dd -1747789432
dd 162941995
dd 2125561021
dd -407360249
dd -1866523247
dd 498536548
dd 1789927666
dd -205950648
dd -2067906082
dd 450548861
dd 1843258603
dd -187386543
dd -2083289657
dd 325883990
dd 1684777152
dd -43845254
dd -1973040660
dd 335633487
dd 1661365465
dd -99664541
dd -1928851979
dd 997073096
dd 1281953886
dd -715111964
dd -1570279054
dd 1006888145
dd 1258607687
dd -770865667
dd -1526024853
dd 901097722
dd 1119000684
dd -608450090
dd -1396901568
dd 853044451
dd 1172266101
dd -589951537
dd -1412350631
dd 651767980
dd 1373503546
dd -925412992
dd -1076862698
dd 565507253
dd 1454621731
dd -809855591
dd -1195530993
dd 671266974
dd 1594198024
dd -972236366
dd -1324619484
dd 795835527
dd 1483230225
dd -1050600021
dd -1234817731
dd 1994146192
dd 31158534
dd -1731059524
dd -271249366
dd 1907459465
dd 112637215
dd -1614814043
dd -390540237
dd 2013776290
dd 251722036
dd -1777751922
dd -519137256
dd 2137656763
dd 141376813
dd -1855689577
dd -429695999
dd 1802195444
dd 476864866
dd -2056965928
dd -228458418
dd 1812370925
dd 453092731
dd -2113342271
dd -183516073
dd 1706088902
dd 314042704
dd -1950435094
dd -54949764
dd 1658658271
dd 366619977
dd -1932296973
dd -69972891
dd 1303535960
dd 984961486
dd -1547960204
dd -725929758
dd 1256170817
dd 1037604311
dd -1529756563
dd -740887301
dd 1131014506
dd 879679996
dd -1385723834
dd -631195440
dd 1141124467
dd 855842277
dd -1442165665
dd -586318647
dd 1342533948
dd 654459306
dd -1106571248
dd -921952122
dd 1466479909
dd 544179635
dd -1184443383
dd -832445281
dd 1591671054
dd 702138776
dd -1328506846
dd -942167884
dd 1504918807
dd 783551873
dd -1212326853
dd -1061524307
dd -306674912
dd -1698712650
dd 62317068
dd 1957810842
dd -355121351
dd -1647151185
dd 81470997
dd 1943803523
dd -480048366
dd -1805370492
dd 225274430
dd 2053790376
dd -468791541
dd -1828061283
dd 167816743
dd 2097651377
dd -267414716
dd -2029476910
dd 503444072
dd 1762050814
dd -144550051
dd -2140837941
dd 426522225
dd 1852507879
dd -19653770
dd -1982649376
dd 282753626
dd 1742555852
dd -105259153
dd -1900089351
dd 397917763
dd 1622183637
dd -690576408
dd -1580100738
dd 953729732
dd 1340076626
dd -776247311
dd -1497606297
dd 1068828381
dd 1219638859
dd -670225446
dd -1358292148
dd 906185462
dd 1090812512
dd -547295293
dd -1469587627
dd 829329135
dd 1181335161
dd -882789492
dd -1134132454
dd 628085408
dd 1382605366
dd -871598187
dd -1156888829
dd 570562233
dd 1426400815
dd -977650754
dd -1296233688
dd 733239954
dd 1555261956
dd -1026031705
dd -1244606671
dd 752459403
dd 1541320221
dd -1687895376
dd -328994266
dd 1969922972
dd 40735498
dd -1677130071
dd -351390145
dd 1913087877
dd 83908371
dd -1782625662
dd -491226604
dd 2075208622
dd 213261112
dd -1831694693
dd -438977011
dd 2094854071
dd 198958881
dd -2032938284
dd -237706686
dd 1759359992
dd 534414190
dd -2118248755
dd -155638181
dd 1873836001
dd 414664567
dd -2012718362
dd -15766928
dd 1711684554
dd 285281116
dd -1889165569
dd -127750551
dd 1634467795
dd 376229701
dd -1609899400
dd -686959890
dd 1308918612
dd 956543938
dd -1486412191
dd -799009033
dd 1231636301
dd 1047427035
dd -1362007478
dd -640263460
dd 1088359270
dd 936918000
dd -1447252397
dd -558129467
dd 1202900863
dd 817233897
dd -1111625188
dd -893730166
dd 1404277552
dd 615818150
dd -1160759803
dd -841546093
dd 1423857449
dd 601450431
dd -1285129682
dd -1000256840
dd 1567103746
dd 711928724
dd -1274298825
dd -1022587231
dd 1510334235
dd 755167117
$mepbdfia label byte
db 0
db 1
db 2
db 4
db 5
db 7
db 8
db 10
db 11
db 12
db 16
db 22
db 23
db 26
_DATA ends
_TEXT segment dword public use32 'CODE'
Make_CRC32_tab segment virtual
align 2
@Make_CRC32_tab proc near
?live16385@0:
@1:
push ebx
push esi
push edi
add esp,-16
mov edi,esp
mov esi,offset $mepbdfia
mov ecx,3
?live16385@32: ; ESI = POLY_nominal
mov eax,esp
?live16385@48: ;
rep movsd
movsw
xor esi,esi
?live16385@80: ; ESI = POLY_nominal
xor ebx,ebx
?live16385@96: ; EBX = n, ESI = POLY_nominal, EAX = @temp4
@2:
xor edx,edx
mov ecx,31
mov dl,byte ptr [eax]
inc eax
sub ecx,edx
mov edx,1
shl edx,cl
or esi,edx
inc ebx
cmp ebx,14
jb short @2
?live16385@112: ; ESI = POLY_nominal
xor ebx,ebx
mov ecx,offset _CRC32_tab
?live16385@128: ; EBX = n, ESI = POLY_nominal, ECX = @temp5
@5:
mov eax,ebx
xor edx,edx
?live16385@144: ; EAX = c, EDX = k, EBX = n, ESI = POLY_nominal, ECX = @temp5
@7:
test al,1
je short @9
shr eax,1
xor eax,esi
jmp short @10
@9:
shr eax,1
@10:
inc edx
cmp edx,8
jb short @7
?live16385@176: ; EAX = c, EBX = n, ESI = POLY_nominal, ECX = @temp5
mov dword ptr [ecx],eax
inc ebx
add ecx,4
cmp ebx,256
jb short @5
?live16385@192: ;
@13:
add esp,16
pop edi
pop esi
pop ebx
ret
@Make_CRC32_tab endp
Make_CRC32_tab ends
_TEXT ends
_DATA segment dword public use32 'DATA'
align 4
$eipbdfia label dword
dd _CRC32_tab
_DATA ends
_TEXT segment dword public use32 'CODE'
Calc_CRC32 segment virtual
align 2
@Calc_CRC32 proc near
?live16386@0:
push ebp
mov ebp,esp
push ebx
push esi
push edi
@14:
mov EDI,dword ptr [ebp+8]
mov EDX,EDI
add EDX,dword ptr [ebp+12]
cmp EDI,EDX
jge @15
mov ESI,dword ptr $eipbdfia
mov EAX,0FFFFFFFFH
xor EBX,EBX
@16:
Calc_CRC32_NEXT:
mov BL,[EDI]
xor BL,AL
shr EAX,8
xor EAX,[ESI+EBX]
inc EDI
cmp EDI,EDX
jl @16
xor EAX,0FFFFFFFFH
@15:
Calc_CRC32_EXIT:
@17:
pop edi
pop esi
pop ebx
pop ebp
ret 8
@Calc_CRC32 endp
Calc_CRC32 ends
_TEXT ends
_TEXT segment dword public use32 'CODE'
@Calc_ADLER32$qqspvul segment virtual
align 2
@@Calc_ADLER32$qqspvul proc near
?live16387@0:
push ebp
mov ebp,esp
push ebx
push esi
push edi
@18:
mov EDI,dword ptr [ebp+8]
mov EDX,EDI
add EDX,dword ptr [ebp+12]
cmp EDI,EDX
jge @19
mov ESI,5552
xor EAX,EAX
xor EBX,EBX
xor ECX,ECX
@20:
Calc_ADLER32_NEXT:
mov CL,[EDI]
add AX,CX
add BX,AX
dec ESI
test ESI,ESI
jne @21
push EDX
mov EBX,65521
div EBX
push EDX
mov EAX,EBX
div EBX
push EDX
pop EBX
pop EAX
pop EDX
mov ESI,5552
@21:
Calc_ADLER32_INC:
inc EDI
cmp EDI,EDX
jl @20
shl EAX,16
or AX,BX
@19:
Calc_ADLER32_EXIT:
@22:
pop edi
pop esi
pop ebx
pop ebp
ret 8
@@Calc_ADLER32$qqspvul endp
@Calc_ADLER32$qqspvul ends
_TEXT ends
_DATA segment dword public use32 'DATA'
@_$DCKC$@Compress_LZS$qqspvt1ulul segment virtual
align 2
@@_$DCKC$@Compress_LZS$qqspvt1ulul label dword
dd @@$xt$10TSoft_Huff
dd 4
dd -12
dd @@$xt$13TSoft_BinTree
dd 4
dd -76
dd 0
dd @@$xt$10TSoft_Huff
dd 4
dd -12
dd 0
dd @@$xt$13TSoft_BinTree
dd 4
dd -76
dd 0
@_$DCKC$@Compress_LZS$qqspvt1ulul ends
_DATA ends
_DATA segment dword public use32 'DATA'
@_$ECTLC$@Compress_LZS$qqspvt1ulul segment virtual
align 2
@@_$ECTLC$@Compress_LZS$qqspvt1ulul label dword
dd 0
dd -112
dw 0
dw 5
dd 0
dd @@_$DCKC$@Compress_LZS$qqspvt1ulul+28
dw 0
dw 5
dd 0
dd @@_$DCKC$@Compress_LZS$qqspvt1ulul
dw 20
dw 5
dd 1
dd @@_$DCKC$@Compress_LZS$qqspvt1ulul+44
@_$ECTLC$@Compress_LZS$qqspvt1ulul ends
_DATA ends
_TEXT segment dword public use32 'CODE'
Compress_LZS segment virtual
align 2
@Compress_LZS proc near
?live16388@0:
@23:
push ebp
mov ebp,esp
add esp,-1152
mov eax,offset @@_$ECTLC$@Compress_LZS$qqspvt1ulul
push ebx
push esi
push edi
mov esi,dword ptr [ebp+12]
call @__InitExceptBlockLDTC
?live16388@16: ; ESI = alpSrc
xor edx,edx
mov dword ptr [ebp-116],edx
push 1024
push 0
lea ecx,dword ptr [ebp-1152]
push ecx
call @_memset
add esp,12
mov eax,esi
mov ebx,eax
?live16388@48: ; EBX = ptrs, ESI = alpSrc, EAX = @temp21
add eax,dword ptr [ebp+16]
mov dword ptr [ebp-120],eax
?live16388@64: ; EBX = ptrs
mov eax,dword ptr [ebp+8]
mov dword ptr [ebp-124],eax
xor edi,edi
?live16388@96: ; EBX = ptrs, EDI = pass_text_length
mov dword ptr [ebp-128],ebx
xor esi,esi
?live16388@128: ; EBX = ptrs, ESI = pass_skip_length, EDI = pass_text_length
mov word ptr [ebp-96],8
lea eax,dword ptr [ebp-12]
push eax
call @@TSoft_Huff@$bctr$qqsv
inc dword ptr [ebp-84]
lea edx,dword ptr [ebp-12]
mov word ptr [ebp-96],20
push edx
call @@TSoft_Huff@Initialize$qqsv
mov word ptr [ebp-96],32
mov ecx,dword ptr [ebp+16]
push ecx
mov eax,dword ptr [ebp+20]
push eax
lea edx,dword ptr [ebp-76]
push edx
call @@TSoft_BinTree@$bctr$qqsulul
inc dword ptr [ebp-84]
mov word ptr [ebp-96],20
push ebx
lea ecx,dword ptr [ebp-76]
push ecx
call @@TSoft_BinTree@Initialize$qqspuc
@24:
lea eax,dword ptr [esi+ebx]
mov edx,eax
add edx,dword ptr [ebp-52]
cmp edx,dword ptr [ebp-120]
jb short @27
?live16388@240: ; EBX = ptrs, ESI = pass_skip_length, EDI = pass_text_length, EAX = @temp9
;
add eax,8
cmp eax,dword ptr [ebp-120]
jb short @28
?live16388@256: ; EBX = ptrs, ESI = pass_skip_length, EDI = pass_text_length
add ebx,esi
?live16388@272: ; EBX = ptrs, EDI = pass_text_length
mov ecx,dword ptr [ebp-120]
sub ecx,ebx
add edi,ecx
?live16388@288: ; EDI = pass_text_length
jmp @29
?live16388@304: ; EBX = ptrs, ESI = pass_skip_length, EDI = pass_text_length
@28:
mov eax,dword ptr [ebp-120]
sub eax,ebx
sub eax,esi
mov dword ptr [ebp-52],eax
@27:
push esi
push ebx
lea edx,dword ptr [ebp-76]
push edx
call @@TSoft_BinTree@Update$qqspucul
add ebx,esi
lea ecx,dword ptr [ebp-76]
push ecx
call @@TSoft_BinTree@Search_brun$qqsv
mov eax,dword ptr [ebp-36]
cmp eax,1
je short @31
?live16388@384: ; EBX = ptrs, ESI = pass_skip_length, EDI = pass_text_length, EAX = @temp11
;
push edi
push eax
lea edx,dword ptr [ebp-76]
push edx
call @@TSoft_BinTree@Optimum_brun_match$qqsulul
test al,al
jne short @33
?live16388@400: ; EBX = ptrs, ESI = pass_skip_length, EDI = pass_text_length
mov dword ptr [ebp-36],1
@31:
lea ecx,dword ptr [ebp-76]
push ecx
call @@TSoft_BinTree@Search_dict$qqsv
mov eax,dword ptr [ebp-56]
test eax,eax
je short @34
?live16388@448: ; EBX = ptrs, ESI = pass_skip_length, EDI = pass_text_length, EAX = @temp12
;
push edi
push eax
lea edx,dword ptr [ebp-76]
push edx
call @@TSoft_BinTree@Optimum_dict_match$qqsulul
test al,al
jne short @33
?live16388@464: ; EBX = ptrs, ESI = pass_skip_length, EDI = pass_text_length
xor ecx,ecx
mov dword ptr [ebp-56],ecx
?live16388@480: ; EBX = ptrs, EDI = pass_text_length
@34:
cmp edi,255
jb short @36
xor esi,esi
?live16388@512: ; EBX = ptrs, ESI = pass_skip_length, EDI = pass_text_length
jmp short @33
?live16388@528: ; EBX = ptrs, EDI = pass_text_length
@36:
mov esi,1
?live16388@544: ; EBX = ptrs, ESI = pass_skip_length, EDI = pass_text_length
inc edi
jmp @24
@33:
test edi,edi
je short @37
push edi
mov eax,dword ptr [ebp-124]
push eax
lea edx,dword ptr [ebp-20]
push edx
call @@__bitptr_hdrcoder@Code_ptrPass$qqspulul
xor ecx,ecx
mov cl,al
add dword ptr [ebp-124],ecx
push edi
mov eax,dword ptr [ebp-128]
push eax
mov edx,dword ptr [ebp-124]
push edx
call @ptrEql
add dword ptr [ebp-124],edi
inc dword ptr [ebp+4*edi-1152]
mov eax,dword ptr [ebp+4*edi-1152]
cmp eax,dword ptr [ebp-116]
jbe short @38
?live16388@640: ; EBX = ptrs, ESI = pass_skip_length, EDI = pass_text_length, EAX = @temp17
;
mov dword ptr [ebp-116],eax
?live16388@656: ; EBX = ptrs, ESI = pass_skip_length
@38:
mov dword ptr [ebp-128],ebx
xor edi,edi
?live16388@688: ; EBX = ptrs, ESI = pass_skip_length, EDI = pass_text_length
@37:
cmp dword ptr [ebp-36],1
je short @39
?live16388@704: ; EBX = ptrs, EDI = pass_text_length
mov eax,dword ptr [ebp-32]
push eax
mov edx,dword ptr [ebp-28]
push edx
mov ecx,dword ptr [ebp-124]
push ecx
lea eax,dword ptr [ebp-20]
push eax
call @@__bitptr_hdrcoder@Code_ptrBrun$qqspululul
xor edx,edx
mov esi,ebx
mov dl,al
add dword ptr [ebp-124],edx
mov ecx,dword ptr [ebp-28]
push ecx
push esi
mov eax,dword ptr [ebp-124]
push eax
call @ptrEql
mov edx,dword ptr [ebp-28]
add dword ptr [ebp-124],edx
?live16388@720: ; EBX = ptrs, EDI = pass_text_length, ESI = @temp14
mov eax,dword ptr [ebp-32]
inc dword ptr [ebp+4*eax-1152]
?live16388@736: ; EBX = ptrs, EDI = pass_text_length, EAX = @temp13, ESI = @temp14
;
mov edx,dword ptr [ebp+4*eax-1152]
cmp edx,dword ptr [ebp-116]
jbe short @40
?live16388@752: ; EBX = ptrs, EDI = pass_text_length, ESI = @temp14
mov ecx,dword ptr [ebp-32]
mov eax,dword ptr [ebp+4*ecx-1152]
mov dword ptr [ebp-116],eax
@40:
mov eax,dword ptr [ebp-36]
add esi,eax
mov dword ptr [ebp-128],esi
?live16388@784: ; EBX = ptrs, EDI = pass_text_length, EAX = @temp15
mov esi,eax
?live16388@800: ; EBX = ptrs, ESI = pass_skip_length, EDI = pass_text_length
jmp @24
@39:
cmp dword ptr [ebp-56],0
je @24
mov eax,dword ptr [ebp-56]
push eax
mov edx,dword ptr [ebp-48]
push edx
mov ecx,dword ptr [ebp-124]
push ecx
lea eax,dword ptr [ebp-20]
push eax
call @@__bitptr_hdrcoder@Code_ptrDict$qqspululul
xor edx,edx
mov dl,al
add dword ptr [ebp-124],edx
?live16388@848: ; EBX = ptrs, EDI = pass_text_length
mov eax,dword ptr [ebp-56]
inc dword ptr [ebp+4*eax-1152]
?live16388@864: ; EBX = ptrs, EDI = pass_text_length, EAX = @temp5
mov edx,dword ptr [ebp+4*eax-1152]
cmp edx,dword ptr [ebp-116]
jbe short @42
mov ecx,dword ptr [ebp-56]
mov edx,dword ptr [ebp+4*ecx-1152]
mov dword ptr [ebp-116],edx
@42:
mov ecx,ebx
mov esi,eax
add ecx,eax
mov dword ptr [ebp-128],ecx
?live16388@944: ; EBX = ptrs, ESI = pass_skip_length, EDI = pass_text_length
jmp @24
@29:
test edi,edi
je short @43
?live16388@976: ; EDI = pass_text_length
push edi
mov eax,dword ptr [ebp-124]
push eax
lea edx,dword ptr [ebp-20]
push edx
call @@__bitptr_hdrcoder@Code_ptrPass$qqspulul
xor ecx,ecx
mov cl,al
add dword ptr [ebp-124],ecx
push edi
mov eax,dword ptr [ebp-128]
push eax
mov edx,dword ptr [ebp-124]
push edx
call @ptrEql
add dword ptr [ebp-124],edi
?live16388@992: ;
@43:
mov eax,dword ptr [ebp-124]
lea edx,dword ptr [ebp-76]
sub eax,dword ptr [ebp+8]
push eax
dec dword ptr [ebp-84]
push 2
push edx
call @@TSoft_BinTree@$bdtr$qqsv
dec dword ptr [ebp-84]
push 2
lea ecx,dword ptr [ebp-12]
push ecx
call @@TSoft_Huff@$bdtr$qqsv
pop eax
mov edx,dword ptr [ebp-112]
mov dword ptr fs:[0],edx
@45:
@44:
pop edi
pop esi
pop ebx
mov esp,ebp
pop ebp
ret 16
@Compress_LZS endp
Compress_LZS ends
_TEXT ends
_DATA segment dword public use32 'DATA'
@_$DCMC$@UnCompress_LZS$qqspvult1 segment virtual
align 2
@@_$DCMC$@UnCompress_LZS$qqspvult1 label dword
dd @@$xt$10TSoft_Huff
dd 4
dd -12
dd 0
dd @@$xt$10TSoft_Huff
dd 4
dd -12
dd 0
@_$DCMC$@UnCompress_LZS$qqspvult1 ends
_DATA ends
_DATA segment dword public use32 'DATA'
@_$ECTNC$@UnCompress_LZS$qqspvult1 segment virtual
align 2
@@_$ECTNC$@UnCompress_LZS$qqspvult1 label dword
dd 0
dd -48
dw 0
dw 5
dd 0
dd @@_$DCMC$@UnCompress_LZS$qqspvult1+16
dw 0
dw 5
dd 0
dd @@_$DCMC$@UnCompress_LZS$qqspvult1
@_$ECTNC$@UnCompress_LZS$qqspvult1 ends
_DATA ends
_TEXT segment dword public use32 'CODE'
UnCompress_LZS segment virtual
align 2
@UnCompress_LZS proc near
?live16393@0:
@46:
push ebp
mov ebp,esp
add esp,-72
push ebx
push esi
push edi
lea edi,dword ptr [ebp-56]
mov eax,offset @@_$ECTNC$@UnCompress_LZS$qqspvult1
call @__InitExceptBlockLDTC
?live16393@16: ; EBX = ptrs, EDI = &cnt
mov eax,dword ptr [ebp+8]
?live16393@32: ; EDI = &cnt
mov ebx,dword ptr [ebp+16]
?live16393@48: ; EBX = ptrs, EDI = &cnt
mov esi,eax
?live16393@64: ; EBX = ptrs, ESI = ptrd, EDI = &cnt, EAX = @temp6
add eax,dword ptr [ebp+12]
mov dword ptr [ebp-52],eax
?live16393@80: ; EBX = ptrs, ESI = ptrd, EDI = &cnt
lea eax,dword ptr [ebp-12]
mov word ptr [ebp-32],8
push eax
call @@TSoft_Huff@$bctr$qqsv
inc dword ptr [ebp-20]
lea edx,dword ptr [ebp-12]
mov word ptr [ebp-32],20
push edx
call @@TSoft_Huff@Initialize$qqsv
cmp esi,dword ptr [ebp-52]
jae @48
@47:
mov al,byte ptr [ebx]
and al,3
?live16393@176: ; EBX = ptrs, ESI = ptrd, EAX = hdr, EDI = &cnt
cmp al,1
je short @50
?live16393@192: ; EBX = ptrs, ESI = ptrd, EDI = &cnt
cmp al,2
je short @52
test al,al
push ebx
push edi
lea edx,dword ptr [ebp-72]
push edx
call @@__bitptr_hdrcoder@DeCode_ptrPass$qqspult1
xor ecx,ecx
mov cl,al
add ebx,ecx
mov eax,dword ptr [edi]
push eax
push ebx
push esi
call @ptrEql
add ebx,dword ptr [edi]
add esi,dword ptr [edi]
jmp short @55
@50:
push ebx
push edi
lea edx,dword ptr [ebp-60]
push edx
lea ecx,dword ptr [ebp-72]
push ecx
call @@__bitptr_hdrcoder@DeCode_ptrDict$qqspult1t1
and eax,255
add ebx,eax
mov edx,dword ptr [edi]
push edx
mov ecx,esi
sub ecx,dword ptr [ebp-60]
push ecx
push esi
call @ptrEql
add esi,dword ptr [edi]
jmp short @55
@52:
push ebx
push edi
lea eax,dword ptr [ebp-64]
push eax
lea edx,dword ptr [ebp-72]
push edx
call @@__bitptr_hdrcoder@DeCode_ptrBrun$qqspult1t1
xor ecx,ecx
mov cl,al
mov eax,dword ptr [edi]
push eax
add ebx,ecx
mov dl,byte ptr [ebp-64]
push edx
push ebx
push esi
call @ptrSetEx
add ebx,dword ptr [ebp-64]
mov ecx,dword ptr [ebp-64]
imul ecx,dword ptr [edi]
add esi,ecx
@55:
cmp esi,dword ptr [ebp-52]
jb @47
?live16393@480: ;
@48:
dec dword ptr [ebp-20]
push 2
lea eax,dword ptr [ebp-12]
push eax
call @@TSoft_Huff@$bdtr$qqsv
mov edx,dword ptr [ebp-48]
mov dword ptr fs:[0],edx
@56:
pop edi
pop esi
pop ebx
mov esp,ebp
pop ebp
ret 12
@UnCompress_LZS endp
UnCompress_LZS ends
_TEXT ends
_DATA segment dword public use32 'DATA'
@_$DCOC$@Compress_HUF$qqspvt1ulus segment virtual
align 2
@@_$DCOC$@Compress_HUF$qqspvt1ulus label dword
dd @@$xt$10TSoft_Huff
dd 4
dd -12
dd 0
dd @@$xt$10TSoft_Huff
dd 4
dd -12
dd 0
@_$DCOC$@Compress_HUF$qqspvt1ulus ends
_DATA ends
_DATA segment dword public use32 'DATA'
@_$ECTPC$@Compress_HUF$qqspvt1ulus segment virtual
align 2
@@_$ECTPC$@Compress_HUF$qqspvt1ulus label dword
dd 0
dd -48
dw 0
dw 5
dd 0
dd @@_$DCOC$@Compress_HUF$qqspvt1ulus+16
dw 0
dw 5
dd 0
dd @@_$DCOC$@Compress_HUF$qqspvt1ulus
@_$ECTPC$@Compress_HUF$qqspvt1ulus ends
_DATA ends
_TEXT segment dword public use32 'CODE'
Compress_HUF segment virtual
align 2
@Compress_HUF proc near
?live16396@0:
@57:
push ebp
mov ebp,esp
add esp,-52
mov eax,offset @@_$ECTPC$@Compress_HUF$qqspvt1ulus
push ebx
push esi
push edi
mov ebx,dword ptr [ebp+12]
call @__InitExceptBlockLDTC
?live16396@16: ; EBX = alpSrc
mov eax,ebx
mov esi,eax
?live16396@32: ; ESI = ptrs, EBX = alpSrc, EAX = @temp6
add eax,dword ptr [ebp+16]
mov dword ptr [ebp-52],eax
?live16396@48: ; EBX = ptrd_bit, ESI = ptrs, EDI = ptrd
lea eax,dword ptr [ebp-12]
?live16396@64: ; ESI = ptrs
mov edi,dword ptr [ebp+8]
?live16396@80: ; ESI = ptrs, EDI = ptrd
xor ebx,ebx
?live16396@96: ; EBX = ptrd_bit, ESI = ptrs, EDI = ptrd
mov word ptr [ebp-32],8
push eax
call @@TSoft_Huff@$bctr$qqsv
inc dword ptr [ebp-20]
lea edx,dword ptr [ebp-12]
mov word ptr [ebp-32],20
push edx
call @@TSoft_Huff@Initialize$qqsv
cmp esi,dword ptr [ebp-52]
jae short @59
@58:
mov cl,byte ptr [esi]
push ecx
push ebx
push edi
lea eax,dword ptr [ebp-12]
push eax
call @@TSoft_Huff@Encode$qqspucucuc
add bl,al
xor edx,edx
mov dl,bl
and bl,7
sar edx,3
inc esi
add edi,edx
cmp esi,dword ptr [ebp-52]
jb short @58
?live16396@288: ; EBX = ptrd_bit, EDI = ptrd
@59:
xor ecx,ecx
mov cl,bl
mov eax,32
sub eax,ecx
push eax
push 0
push offset s@
push ebx
push edi
call @bitEql
?live16396@304: ; EDI = ptrd
add edi,4
lea edx,dword ptr [ebp-12]
mov eax,edi
sub eax,dword ptr [ebp+8]
push eax
dec dword ptr [ebp-20]
push 2
push edx
call @@TSoft_Huff@$bdtr$qqsv
pop eax
mov edx,dword ptr [ebp-48]
mov dword ptr fs:[0],edx
?live16396@336: ;
@62:
@61:
pop edi
pop esi
pop ebx
mov esp,ebp
pop ebp
ret 16
@Compress_HUF endp
Compress_HUF ends
_TEXT ends
_DATA segment dword public use32 'DATA'
@_$DCQC$@UnCompress_HUF$qqspvult1 segment virtual
align 2
@@_$DCQC$@UnCompress_HUF$qqspvult1 label dword
dd @@$xt$10TSoft_Huff
dd 4
dd -12
dd 0
dd @@$xt$10TSoft_Huff
dd 4
dd -12
dd 0
@_$DCQC$@UnCompress_HUF$qqspvult1 ends
_DATA ends
_DATA segment dword public use32 'DATA'
@_$ECTRC$@UnCompress_HUF$qqspvult1 segment virtual
align 2
@@_$ECTRC$@UnCompress_HUF$qqspvult1 label dword
dd 0
dd -48
dw 0
dw 5
dd 0
dd @@_$DCQC$@UnCompress_HUF$qqspvult1+16
dw 0
dw 5
dd 0
dd @@_$DCQC$@UnCompress_HUF$qqspvult1
@_$ECTRC$@UnCompress_HUF$qqspvult1 ends
_DATA ends
_TEXT segment dword public use32 'CODE'
UnCompress_HUF segment virtual
align 2
@UnCompress_HUF proc near
?live16399@0:
@63:
push ebp
mov ebp,esp
add esp,-52
mov eax,offset @@_$ECTRC$@UnCompress_HUF$qqspvult1
push ebx
push esi
push edi
call @__InitExceptBlockLDTC
?live16399@16: ; EBX = ptrs_bit, EDI = ptrs
mov eax,dword ptr [ebp+8]
?live16399@32: ; EDI = ptrs
xor ebx,ebx
?live16399@48: ; EBX = ptrs_bit, EDI = ptrs
mov esi,eax
?live16399@64: ;
mov edi,dword ptr [ebp+16]
?live16399@80: ; EBX = ptrs_bit, ESI = ptrd, EDI = ptrs, EAX = @temp5
add eax,dword ptr [ebp+12]
mov dword ptr [ebp-52],eax
?live16399@96: ; EBX = ptrs_bit, ESI = ptrd, EDI = ptrs
lea eax,dword ptr [ebp-12]
mov word ptr [ebp-32],8
push eax
call @@TSoft_Huff@$bctr$qqsv
inc dword ptr [ebp-20]
lea edx,dword ptr [ebp-12]
mov word ptr [ebp-32],20
push edx
call @@TSoft_Huff@Initialize$qqsv
cmp esi,dword ptr [ebp-52]
jae short @65
@64:
push ebx
push edi
push esi
lea ecx,dword ptr [ebp-12]
push ecx
call @@TSoft_Huff@Decode$qqspuct1uc
add bl,al
xor eax,eax
mov al,bl
and bl,7
sar eax,3
inc esi
add edi,eax
cmp esi,dword ptr [ebp-52]
jb short @64
?live16399@288: ;
@65:
dec dword ptr [ebp-20]
push 2
lea edx,dword ptr [ebp-12]
push edx
call @@TSoft_Huff@$bdtr$qqsv
mov ecx,dword ptr [ebp-48]
mov dword ptr fs:[0],ecx
@67:
pop edi
pop esi
pop ebx
mov esp,ebp
pop ebp
ret 12
@UnCompress_HUF endp
UnCompress_HUF ends
_TEXT ends
_DATA segment dword public use32 'DATA'
@_$DCSC$@Compress_ARI$qqspvt1ulus segment virtual
align 2
@@_$DCSC$@Compress_ARI$qqspvt1ulus label dword
dd @@$xt$9TSoft_Ari
dd 4
dd -32
dd 0
dd @@$xt$9TSoft_Ari
dd 4
dd -32
dd 0
@_$DCSC$@Compress_ARI$qqspvt1ulus ends
_DATA ends
_DATA segment dword public use32 'DATA'
@_$ECTTC$@Compress_ARI$qqspvt1ulus segment virtual
align 2
@@_$ECTTC$@Compress_ARI$qqspvt1ulus label dword
dd 0
dd -68
dw 0
dw 5
dd 0
dd @@_$DCSC$@Compress_ARI$qqspvt1ulus+16
dw 0
dw 5
dd 0
dd @@_$DCSC$@Compress_ARI$qqspvt1ulus
@_$ECTTC$@Compress_ARI$qqspvt1ulus ends
_DATA ends
_TEXT segment dword public use32 'CODE'
Compress_ARI segment virtual
align 2
@Compress_ARI proc near
?live16402@0:
@68:
push ebp
mov ebp,esp
add esp,-72
mov eax,offset @@_$ECTTC$@Compress_ARI$qqspvt1ulus
push ebx
push esi
push edi
mov ebx,dword ptr [ebp+12]
call @__InitExceptBlockLDTC
?live16402@16: ; EBX = alpSrc
mov eax,ebx
mov esi,eax
?live16402@32: ; ESI = ptrs, EBX = alpSrc, EAX = @temp6
add eax,dword ptr [ebp+16]
mov dword ptr [ebp-72],eax
?live16402@48: ; EBX = ptrd_bit, ESI = ptrs, EDI = ptrd
lea eax,dword ptr [ebp-32]
?live16402@64: ; ESI = ptrs
mov edi,dword ptr [ebp+8]
?live16402@80: ; ESI = ptrs, EDI = ptrd
xor ebx,ebx
?live16402@96: ; EBX = ptrd_bit, ESI = ptrs, EDI = ptrd
mov word ptr [ebp-52],8
push eax
call @@TSoft_Ari@$bctr$qqsv
inc dword ptr [ebp-40]
lea edx,dword ptr [ebp-32]
mov word ptr [ebp-52],20
push edx
call @@TSoft_Ari@Initialize_Encoder$qqsv
cmp esi,dword ptr [ebp-72]
jae short @70
@69:
mov cl,byte ptr [esi]
push ecx
push ebx
push edi
lea eax,dword ptr [ebp-32]
push eax
call @@TSoft_Ari@Encode$qqspulucuc
add bl,al
xor edx,edx
mov dl,bl
and bl,7
sar edx,3
inc esi
add edi,edx
cmp esi,dword ptr [ebp-72]
jb short @69
?live16402@288: ; EBX = ptrd_bit, EDI = ptrd
@70:
push ebx
push edi
lea ecx,dword ptr [ebp-32]
push ecx
call @@TSoft_Ari@Flush_Encoder$qqspuluc
add bl,al
xor eax,eax
mov al,bl
?live16402@320: ; EDI = ptrd
lea edx,dword ptr [ebp-32]
?live16402@336: ; EBX = ptrd_bit, EDI = ptrd
sar eax,3
add edi,eax
?live16402@352: ; EDI = ptrd
mov eax,edi
sub eax,dword ptr [ebp+8]
push eax
dec dword ptr [ebp-40]
push 2
push edx
call @@TSoft_Ari@$bdtr$qqsv
pop eax
mov edx,dword ptr [ebp-68]
mov dword ptr fs:[0],edx
?live16402@368: ;
@73:
@72:
pop edi
pop esi
pop ebx
mov esp,ebp
pop ebp
ret 16
@Compress_ARI endp
Compress_ARI ends
_TEXT ends
_DATA segment dword public use32 'DATA'
@_$DCUC$@UnCompress_ARI$qqspvult1 segment virtual
align 2
@@_$DCUC$@UnCompress_ARI$qqspvult1 label dword
dd @@$xt$9TSoft_Ari
dd 4
dd -32
dd 0
dd @@$xt$9TSoft_Ari
dd 4
dd -32
dd 0
@_$DCUC$@UnCompress_ARI$qqspvult1 ends
_DATA ends
_DATA segment dword public use32 'DATA'
@_$ECTVC$@UnCompress_ARI$qqspvult1 segment virtual
align 2
@@_$ECTVC$@UnCompress_ARI$qqspvult1 label dword
dd 0
dd -68
dw 0
dw 5
dd 0
dd @@_$DCUC$@UnCompress_ARI$qqspvult1+16
dw 0
dw 5
dd 0
dd @@_$DCUC$@UnCompress_ARI$qqspvult1
@_$ECTVC$@UnCompress_ARI$qqspvult1 ends
_DATA ends
_TEXT segment dword public use32 'CODE'
UnCompress_ARI segment virtual
align 2
@UnCompress_ARI proc near
?live16406@0:
@74:
push ebp
mov ebp,esp
add esp,-72
mov eax,offset @@_$ECTVC$@UnCompress_ARI$qqspvult1
push ebx
push esi
push edi
call @__InitExceptBlockLDTC
?live16406@16: ; EBX = ptrs_bit, EDI = ptrs
mov eax,dword ptr [ebp+8]
?live16406@32: ; EDI = ptrs
xor ebx,ebx
?live16406@48: ; EBX = ptrs_bit, EDI = ptrs
mov esi,eax
?live16406@64: ;
mov edi,dword ptr [ebp+16]
?live16406@80: ; EBX = ptrs_bit, ESI = ptrd, EDI = ptrs, EAX = @temp5
add eax,dword ptr [ebp+12]
mov dword ptr [ebp-72],eax
?live16406@96: ; EBX = ptrs_bit, ESI = ptrd, EDI = ptrs
lea eax,dword ptr [ebp-32]
mov word ptr [ebp-52],8
push eax
call @@TSoft_Ari@$bctr$qqsv
inc dword ptr [ebp-40]
lea edx,dword ptr [ebp-32]
mov word ptr [ebp-52],20
push ebx
push edi
push edx
call @@TSoft_Ari@Initialize_Decoder$qqspuluc
add bl,al
xor ecx,ecx
mov cl,bl
sar ecx,3
add edi,ecx
and bl,7
cmp esi,dword ptr [ebp-72]
jae short @76
@75:
push ebx
push edi
push esi
lea eax,dword ptr [ebp-32]
push eax
call @@TSoft_Ari@Decode$qqspucpuluc
add bl,al
xor edx,edx
mov dl,bl
and bl,7
sar edx,3
inc esi
add edi,edx
cmp esi,dword ptr [ebp-72]
jb short @75
?live16406@320: ;
@76:
dec dword ptr [ebp-40]
push 2
lea ecx,dword ptr [ebp-32]
push ecx
call @@TSoft_Ari@$bdtr$qqsv
mov eax,dword ptr [ebp-68]
mov dword ptr fs:[0],eax
@78:
pop edi
pop esi
pop ebx
mov esp,ebp
pop ebp
ret 12
@UnCompress_ARI endp
UnCompress_ARI ends
_TEXT ends
_DATA segment dword public use32 'DATA'
@_$DCWC$@Cript_MTF$qqspvul segment virtual
align 2
@@_$DCWC$@Cript_MTF$qqspvul label dword
dd @@$xt$9TSoft_Mtf
dd 4
dd -4
dd 0
dd @@$xt$9TSoft_Mtf
dd 4
dd -4
dd 0
@_$DCWC$@Cript_MTF$qqspvul ends
_DATA ends
_DATA segment dword public use32 'DATA'
@_$ECTXC$@Cript_MTF$qqspvul segment virtual
align 2
@@_$ECTXC$@Cript_MTF$qqspvul label dword
dd 0
dd -40
dw 0
dw 5
dd 0
dd @@_$DCWC$@Cript_MTF$qqspvul+16
dw 0
dw 5
dd 0
dd @@_$DCWC$@Cript_MTF$qqspvul
@_$ECTXC$@Cript_MTF$qqspvul ends
_DATA ends
_TEXT segment dword public use32 'CODE'
Cript_MTF segment virtual
align 2
@Cript_MTF proc near
?live16409@0:
@79:
push ebp
mov ebp,esp
add esp,-40
mov eax,offset @@_$ECTXC$@Cript_MTF$qqspvul
push ebx
push esi
push edi
mov esi,dword ptr [ebp+8]
call @__InitExceptBlockLDTC
?live16409@16: ; ESI = alpDst
mov eax,esi
?live16409@32: ; EBX = ptrd, ESI = alpDst, EAX = @temp4
mov edi,eax
?live16409@48: ; ESI = alpDst
mov ebx,eax
?live16409@64: ; EBX = ptrd, ESI = alpDst, EAX = @temp4
add edi,dword ptr [ebp+12]
?live16409@80: ; EBX = ptrd, EDI = ptrd_end
lea eax,dword ptr [ebp-4]
mov word ptr [ebp-24],8
push eax
call @@TSoft_Mtf@$bctr$qqsv
inc dword ptr [ebp-12]
lea edx,dword ptr [ebp-4]
mov word ptr [ebp-24],20
push edx
call @@TSoft_Mtf@Initialize$qqsv
cmp edi,ebx
jbe short @81
@80:
mov esi,ebx
mov al,byte ptr [esi]
push eax
lea edx,dword ptr [ebp-4]
push edx
call @@TSoft_Mtf@Encode$qqsuc
mov byte ptr [esi],al
inc ebx
cmp edi,ebx
ja short @80
?live16409@192: ;
@81:
dec dword ptr [ebp-12]
push 2
lea ecx,dword ptr [ebp-4]
push ecx
call @@TSoft_Mtf@$bdtr$qqsv
mov eax,dword ptr [ebp-40]
mov dword ptr fs:[0],eax
@83:
pop edi
pop esi
pop ebx
mov esp,ebp
pop ebp
ret 8
@Cript_MTF endp
Cript_MTF ends
_TEXT ends
_DATA segment dword public use32 'DATA'
@_$DCYC$@UnCript_MTF$qqspvul segment virtual
align 2
@@_$DCYC$@UnCript_MTF$qqspvul label dword
dd @@$xt$9TSoft_Mtf
dd 4
dd -4
dd 0
dd @@$xt$9TSoft_Mtf
dd 4
dd -4
dd 0
@_$DCYC$@UnCript_MTF$qqspvul ends
_DATA ends
_DATA segment dword public use32 'DATA'
@_$ECTZC$@UnCript_MTF$qqspvul segment virtual
align 2
@@_$ECTZC$@UnCript_MTF$qqspvul label dword
dd 0
dd -40
dw 0
dw 5
dd 0
dd @@_$DCYC$@UnCript_MTF$qqspvul+16
dw 0
dw 5
dd 0
dd @@_$DCYC$@UnCript_MTF$qqspvul
@_$ECTZC$@UnCript_MTF$qqspvul ends
_DATA ends
_TEXT segment dword public use32 'CODE'
UnCript_MTF segment virtual
align 2
@UnCript_MTF proc near
?live16413@0:
@84:
push ebp
mov ebp,esp
add esp,-40
mov eax,offset @@_$ECTZC$@UnCript_MTF$qqspvul
push ebx
push esi
push edi
mov esi,dword ptr [ebp+8]
call @__InitExceptBlockLDTC
?live16413@16: ; ESI = alpDst
mov eax,esi
?live16413@32: ; EBX = ptrd, ESI = alpDst, EAX = @temp4
mov edi,eax
?live16413@48: ; ESI = alpDst
mov ebx,eax
?live16413@64: ; EBX = ptrd, ESI = alpDst, EAX = @temp4
add edi,dword ptr [ebp+12]
?live16413@80: ; EBX = ptrd, EDI = ptrd_end
lea eax,dword ptr [ebp-4]
mov word ptr [ebp-24],8
push eax
call @@TSoft_Mtf@$bctr$qqsv
inc dword ptr [ebp-12]
lea edx,dword ptr [ebp-4]
mov word ptr [ebp-24],20
push edx
call @@TSoft_Mtf@Initialize$qqsv
cmp edi,ebx
jbe short @86
@85:
mov esi,ebx
mov al,byte ptr [esi]
push eax
lea edx,dword ptr [ebp-4]
push edx
call @@TSoft_Mtf@Decode$qqsuc
mov byte ptr [esi],al
inc ebx
cmp edi,ebx
ja short @85
?live16413@192: ;
@86:
dec dword ptr [ebp-12]
push 2
lea ecx,dword ptr [ebp-4]
push ecx
call @@TSoft_Mtf@$bdtr$qqsv
mov eax,dword ptr [ebp-40]
mov dword ptr fs:[0],eax
@88:
pop edi
pop esi
pop ebx
mov esp,ebp
pop ebp
ret 8
@UnCript_MTF endp
UnCript_MTF ends
_TEXT ends
_TEXT segment dword public use32 'CODE'
Cript_XOR segment virtual
align 2
@Cript_XOR proc near
?live16416@0:
push ebp
mov ebp,esp
push ebx
push esi
push edi
@89:
mov EDI,dword ptr [ebp+8]
mov EDX,EDI
add EDX,dword ptr [ebp+12]
cmp EDI,EDX
jge @90
mov ESI,dword ptr [ebp+16]
movzx ECX,byte ptr [ebp+20]
add ECX,ESI
cmp ESI,ECX
jge @90
mov EBX,ESI
@91:
Cript_XOR_LOOP:
mov AL,[ESI]
xor [EDI],AL
inc ESI
cmp ESI,ECX
jl short @92
mov ESI,EBX
@92:
Cript_XOR_PASS:
inc EDI
cmp EDI,EDX
jl @91
mov ESI,EBX
@90:
Cript_XOR_EXIT:
@93:
pop edi
pop esi
pop ebx
pop ebp
ret 16
@Cript_XOR endp
Cript_XOR ends
_TEXT ends
_TEXT segment dword public use32 'CODE'
UnCript_XOR segment virtual
align 2
@UnCript_XOR proc near
?live16417@0:
@94:
push ebp
mov ebp,esp
mov al,byte ptr [ebp+20]
push eax
mov edx,dword ptr [ebp+16]
push edx
mov ecx,dword ptr [ebp+12]
push ecx
mov eax,dword ptr [ebp+8]
push eax
call @Cript_XOR
@95:
pop ebp
ret 16
@UnCript_XOR endp
UnCript_XOR ends
_TEXT ends
_TEXT segment dword public use32 'CODE'
Cript_SXQ segment virtual
align 2
@Cript_SXQ proc near
?live16418@0:
@96:
push ebp
mov ebp,esp
push ebx
push esi
push edi
mov eax,dword ptr [ebp+16]
mov edi,dword ptr [ebp+8]
?live16418@16: ; EDI = alpDst, EAX = aHaslo_count
cmp al,1
jbe short @98
?live16418@32: ;
xor ebx,ebx
mov bl,al
?live16418@48: ; EBX = buff_count, EDI = alpDst
movzx esi,bx
?live16418@64: ; EBX = buff_count, ESI = @temp1, EDI = alpDst
mov eax,esi
inc eax
push eax
call @strAlloc
?live16418@80: ; EBX = buff_count, ESI = @temp1, EDI = alpDst, EAX = buff_ptr
push eax
call @strFree
?live16418@96: ;
@99:
@98:
pop edi
pop esi
pop ebx
pop ebp
ret 12
@Cript_SXQ endp
Cript_SXQ ends
_TEXT ends
_TEXT segment dword public use32 'CODE'
UnCript_SXQ segment virtual
align 2
@UnCript_SXQ proc near
?live16419@0:
@100:
push ebp
mov ebp,esp
mov al,byte ptr [ebp+16]
push eax
mov edx,dword ptr [ebp+12]
push edx
mov ecx,dword ptr [ebp+8]
push ecx
call @Cript_SXQ
@101:
pop ebp
ret 12
@UnCript_SXQ endp
UnCript_SXQ ends
_TEXT ends
_DATA segment dword public use32 'DATA'
@_$DCAD$@Compress_BWT$qqspvt1ulus segment virtual
align 2
@@_$DCAD$@Compress_BWT$qqspvt1ulus label dword
dd @@$xt$15TSoft_BWTMatrix
dd 4
dd -28
dd 0
dd @@$xt$15TSoft_BWTMatrix
dd 4
dd -28
dd 0
@_$DCAD$@Compress_BWT$qqspvt1ulus ends
_DATA ends
_DATA segment dword public use32 'DATA'
@_$ECTBD$@Compress_BWT$qqspvt1ulus segment virtual
align 2
@@_$ECTBD$@Compress_BWT$qqspvt1ulus label dword
dd 0
dd -64
dw 0
dw 5
dd 0
dd @@_$DCAD$@Compress_BWT$qqspvt1ulus+16
dw 0
dw 5
dd 0
dd @@_$DCAD$@Compress_BWT$qqspvt1ulus
@_$ECTBD$@Compress_BWT$qqspvt1ulus ends
_DATA ends
_TEXT segment dword public use32 'CODE'
Compress_BWT segment virtual
align 2
@Compress_BWT proc near
?live16420@0:
@102:
push ebp
mov ebp,esp
add esp,-64
mov eax,offset @@_$ECTBD$@Compress_BWT$qqspvt1ulus
push ebx
push esi
push edi
mov ebx,dword ptr [ebp+12]
call @__InitExceptBlockLDTC
?live16420@16: ; EBX = alpSrc
mov eax,ebx
mov esi,eax
?live16420@32: ; ESI = ptrs, EBX = alpSrc, EAX = @temp6
mov edi,eax
add edi,dword ptr [ebp+16]
?live16420@48: ; ESI = ptrs, EDI = ptrs_end
mov ebx,dword ptr [ebp+8]
?live16420@64: ; EBX = ptrd, ESI = ptrs, EDI = ptrs_end
mov word ptr [ebp-48],8
movzx eax,word ptr [ebp+20]
push eax
lea edx,dword ptr [ebp-28]
push edx
call @@TSoft_BWTMatrix@$bctr$qqsul
inc dword ptr [ebp-36]
mov word ptr [ebp-48],20
mov cx,word ptr [ebp-20]
mov word ptr [ebx],cx
add ebx,2
jmp short @104
@103:
push esi
lea eax,dword ptr [ebp-28]
push eax
call @@TSoft_BWTMatrix@Generate$qqspuc
add esi,dword ptr [ebp-20]
lea edx,dword ptr [ebp-28]
push edx
call @@TSoft_BWTMatrix@Sort$qqsv
mov word ptr [ebx],ax
add ebx,2
push ebx
lea ecx,dword ptr [ebp-28]
push ecx
call @@TSoft_BWTMatrix@Flush$qqspuc
add ebx,dword ptr [ebp-20]
@104:
mov eax,edi
sub eax,dword ptr [ebp-20]
cmp esi,eax
jbe short @103
mov word ptr [ebx],0
add ebx,2
cmp edi,esi
jbe short @106
@105:
mov dl,byte ptr [esi]
inc esi
mov byte ptr [ebx],dl
inc ebx
cmp edi,esi
ja short @105
?live16420@304: ; EBX = ptrd
@106:
mov eax,ebx
lea edx,dword ptr [ebp-28]
sub eax,dword ptr [ebp+8]
push eax
dec dword ptr [ebp-36]
push 2
push edx
call @@TSoft_BWTMatrix@$bdtr$qqsv
pop eax
mov edx,dword ptr [ebp-64]
mov dword ptr fs:[0],edx
?live16420@320: ;
@108:
@107:
pop edi
pop esi
pop ebx
mov esp,ebp
pop ebp
ret 16
@Compress_BWT endp
Compress_BWT ends
_TEXT ends
_TEXT segment dword public use32 'CODE'
UnCompress_BWT segment virtual
align 2
@UnCompress_BWT proc near
?live16424@0:
@109:
push ebp
mov ebp,esp
push ebx
mov eax,dword ptr [ebp+8]
mov edx,dword ptr [ebp+12]
?live16424@16: ; EAX = alpDst, EDX = acount, ECX = alpSrc
mov ebx,eax
?live16424@32: ;
mov ecx,dword ptr [ebp+16]
?live16424@48: ; EAX = alpDst, EDX = acount, ECX = alpSrc, EBX = @temp3
mov ebx,edx
add ebx,ebx
shr ebx,10
sub edx,ebx
sub edx,2
push edx
push ecx
push eax
call @ptrEql
?live16424@64: ;
@110:
pop ebx
pop ebp
ret 12
@UnCompress_BWT endp
UnCompress_BWT ends
_TEXT ends
_TEXT segment dword public use32 'CODE'
@$xt$15TSoft_BWTMatrix segment virtual
align 2
@@$xt$15TSoft_BWTMatrix label byte
dd 28
dw 3
dw 48
dd -1
dd 3
dw 64
dw 68
dd 0
dw 0
dw 0
dd 0
dd 1
dd 1
dd @@TSoft_BWTMatrix@$bdtr$qqsv
dw 5
dw 72
db 84
db 83
db 111
db 102
db 116
db 95
db 66
db 87
db 84
db 77
db 97
db 116
db 114
db 105
db 120
db 0
dd 0
dd 0
dd 0
@$xt$15TSoft_BWTMatrix ends
_TEXT ends
_TEXT segment dword public use32 'CODE'
@$xt$9TSoft_Mtf segment virtual
align 2
@@$xt$9TSoft_Mtf label byte
dd 4
dw 3
dw 48
dd -1
dd 3
dw 60
dw 64
dd 0
dw 0
dw 0
dd 0
dd 1
dd 1
dd @@TSoft_Mtf@$bdtr$qqsv
dw 5
dw 68
db 84
db 83
db 111
db 102
db 116
db 95
db 77
db 116
db 102
db 0
db 0
db 0
dd 0
dd 0
dd 0
@$xt$9TSoft_Mtf ends
_TEXT ends
_TEXT segment dword public use32 'CODE'
@$xt$9TSoft_Ari segment virtual
align 2
@@$xt$9TSoft_Ari label byte
dd 32
dw 3
dw 48
dd -1
dd 3
dw 60
dw 64
dd 0
dw 0
dw 0
dd 0
dd 1
dd 1
dd @@TSoft_Ari@$bdtr$qqsv
dw 5
dw 68
db 84
db 83
db 111
db 102
db 116
db 95
db 65
db 114
db 105
db 0
db 0
db 0
dd 0
dd 0
dd 0
@$xt$9TSoft_Ari ends
_TEXT ends
_TEXT segment dword public use32 'CODE'
@$xt$13TSoft_BinTree segment virtual
align 2
@@$xt$13TSoft_BinTree label byte
dd 64
dw 3
dw 48
dd -1
dd 3
dw 64
dw 68
dd 0
dw 0
dw 0
dd 0
dd 1
dd 1
dd @@TSoft_BinTree@$bdtr$qqsv
dw 5
dw 72
db 84
db 83
db 111
db 102
db 116
db 95
db 66
db 105
db 110
db 84
db 114
db 101
db 101
db 0
db 0
db 0
dd 0
dd 0
dd 0
@$xt$13TSoft_BinTree ends
_TEXT ends
_TEXT segment dword public use32 'CODE'
@$xt$10TSoft_Huff segment virtual
align 2
@@$xt$10TSoft_Huff label byte
dd 12
dw 3
dw 48
dd -1
dd 3
dw 60
dw 64
dd 0
dw 0
dw 0
dd 0
dd 1
dd 1
dd @@TSoft_Huff@$bdtr$qqsv
dw 5
dw 68
db 84
db 83
db 111
db 102
db 116
db 95
db 72
db 117
db 102
db 102
db 0
db 0
dd 0
dd 0
dd 0
@$xt$10TSoft_Huff ends
_TEXT ends
_DATA segment dword public use32 'DATA'
s@ label byte
db 0,0,0,0,0
align 4
_DATA ends
_TEXT segment dword public use32 'CODE'
_TEXT ends
@_memset equ _memset
extrn _memset:near
@@TSoft_Huff@$bctr$qqsv equ @TSoft_Huff@$bctr$qqsv
extrn @TSoft_Huff@$bctr$qqsv:near
@@TSoft_Huff@Initialize$qqsv equ @TSoft_Huff@Initialize$qqsv
extrn @TSoft_Huff@Initialize$qqsv:near
@@TSoft_BinTree@$bctr$qqsulul equ @TSoft_BinTree@$bctr$qqsulul
extrn @TSoft_BinTree@$bctr$qqsulul:near
@@TSoft_BinTree@Initialize$qqspuc equ @TSoft_BinTree@Initialize$qqspuc
extrn @TSoft_BinTree@Initialize$qqspuc:near
@@TSoft_BinTree@Update$qqspucul equ @TSoft_BinTree@Update$qqspucul
extrn @TSoft_BinTree@Update$qqspucul:near
@@TSoft_BinTree@Search_brun$qqsv equ @TSoft_BinTree@Search_brun$qqsv
extrn @TSoft_BinTree@Search_brun$qqsv:near
@@TSoft_BinTree@Optimum_brun_match$qqsulul equ @TSoft_BinTree@Optimum_brun_match$qqsulul
extrn @TSoft_BinTree@Optimum_brun_match$qqsulul:near
@@TSoft_BinTree@Search_dict$qqsv equ @TSoft_BinTree@Search_dict$qqsv
extrn @TSoft_BinTree@Search_dict$qqsv:near
@@TSoft_BinTree@Optimum_dict_match$qqsulul equ @TSoft_BinTree@Optimum_dict_match$qqsulul
extrn @TSoft_BinTree@Optimum_dict_match$qqsulul:near
@@__bitptr_hdrcoder@Code_ptrPass$qqspulul equ @__bitptr_hdrcoder@Code_ptrPass$qqspulul
extrn @__bitptr_hdrcoder@Code_ptrPass$qqspulul:near
@ptrEql equ ptrEql
extrn ptrEql:near
@@__bitptr_hdrcoder@Code_ptrBrun$qqspululul equ @__bitptr_hdrcoder@Code_ptrBrun$qqspululul
extrn @__bitptr_hdrcoder@Code_ptrBrun$qqspululul:near
@@__bitptr_hdrcoder@Code_ptrDict$qqspululul equ @__bitptr_hdrcoder@Code_ptrDict$qqspululul
extrn @__bitptr_hdrcoder@Code_ptrDict$qqspululul:near
@@TSoft_BinTree@$bdtr$qqsv equ @TSoft_BinTree@$bdtr$qqsv
extrn @TSoft_BinTree@$bdtr$qqsv:near
@@TSoft_Huff@$bdtr$qqsv equ @TSoft_Huff@$bdtr$qqsv
extrn @TSoft_Huff@$bdtr$qqsv:near
extrn __Exception_list:dword
extrn @__InitExceptBlockLDTC:near
@@__bitptr_hdrcoder@DeCode_ptrPass$qqspult1 equ @__bitptr_hdrcoder@DeCode_ptrPass$qqspult1
extrn @__bitptr_hdrcoder@DeCode_ptrPass$qqspult1:near
@@__bitptr_hdrcoder@DeCode_ptrDict$qqspult1t1 equ @__bitptr_hdrcoder@DeCode_ptrDict$qqspult1t1
extrn @__bitptr_hdrcoder@DeCode_ptrDict$qqspult1t1:near
@@__bitptr_hdrcoder@DeCode_ptrBrun$qqspult1t1 equ @__bitptr_hdrcoder@DeCode_ptrBrun$qqspult1t1
extrn @__bitptr_hdrcoder@DeCode_ptrBrun$qqspult1t1:near
@ptrSetEx equ ptrSetEx
extrn ptrSetEx:near
@@TSoft_Huff@Encode$qqspucucuc equ @TSoft_Huff@Encode$qqspucucuc
extrn @TSoft_Huff@Encode$qqspucucuc:near
@bitEql equ bitEql
extrn bitEql:near
@@TSoft_Huff@Decode$qqspuct1uc equ @TSoft_Huff@Decode$qqspuct1uc
extrn @TSoft_Huff@Decode$qqspuct1uc:near
@@TSoft_Ari@$bctr$qqsv equ @TSoft_Ari@$bctr$qqsv
extrn @TSoft_Ari@$bctr$qqsv:near
@@TSoft_Ari@Initialize_Encoder$qqsv equ @TSoft_Ari@Initialize_Encoder$qqsv
extrn @TSoft_Ari@Initialize_Encoder$qqsv:near
@@TSoft_Ari@Encode$qqspulucuc equ @TSoft_Ari@Encode$qqspulucuc
extrn @TSoft_Ari@Encode$qqspulucuc:near
@@TSoft_Ari@Flush_Encoder$qqspuluc equ @TSoft_Ari@Flush_Encoder$qqspuluc
extrn @TSoft_Ari@Flush_Encoder$qqspuluc:near
@@TSoft_Ari@$bdtr$qqsv equ @TSoft_Ari@$bdtr$qqsv
extrn @TSoft_Ari@$bdtr$qqsv:near
@@TSoft_Ari@Initialize_Decoder$qqspuluc equ @TSoft_Ari@Initialize_Decoder$qqspuluc
extrn @TSoft_Ari@Initialize_Decoder$qqspuluc:near
@@TSoft_Ari@Decode$qqspucpuluc equ @TSoft_Ari@Decode$qqspucpuluc
extrn @TSoft_Ari@Decode$qqspucpuluc:near
@@TSoft_Mtf@$bctr$qqsv equ @TSoft_Mtf@$bctr$qqsv
extrn @TSoft_Mtf@$bctr$qqsv:near
@@TSoft_Mtf@Initialize$qqsv equ @TSoft_Mtf@Initialize$qqsv
extrn @TSoft_Mtf@Initialize$qqsv:near
@@TSoft_Mtf@Encode$qqsuc equ @TSoft_Mtf@Encode$qqsuc
extrn @TSoft_Mtf@Encode$qqsuc:near
@@TSoft_Mtf@$bdtr$qqsv equ @TSoft_Mtf@$bdtr$qqsv
extrn @TSoft_Mtf@$bdtr$qqsv:near
@@TSoft_Mtf@Decode$qqsuc equ @TSoft_Mtf@Decode$qqsuc
extrn @TSoft_Mtf@Decode$qqsuc:near
@strAlloc equ strAlloc
extrn strAlloc:near
@strFree equ strFree
extrn strFree:near
@@TSoft_BWTMatrix@$bctr$qqsul equ @TSoft_BWTMatrix@$bctr$qqsul
extrn @TSoft_BWTMatrix@$bctr$qqsul:near
@@TSoft_BWTMatrix@Generate$qqspuc equ @TSoft_BWTMatrix@Generate$qqspuc
extrn @TSoft_BWTMatrix@Generate$qqspuc:near
@@TSoft_BWTMatrix@Sort$qqsv equ @TSoft_BWTMatrix@Sort$qqsv
extrn @TSoft_BWTMatrix@Sort$qqsv:near
@@TSoft_BWTMatrix@Flush$qqspuc equ @TSoft_BWTMatrix@Flush$qqspuc
extrn @TSoft_BWTMatrix@Flush$qqspuc:near
@@TSoft_BWTMatrix@$bdtr$qqsv equ @TSoft_BWTMatrix@$bdtr$qqsv
extrn @TSoft_BWTMatrix@$bdtr$qqsv:near
?debug C 9F757569642E6C6962
?debug C 9F757569642E6C6962
?debug D "C:\Program Files\Borland\CBuilder5\Projects\OBSOLETE\PROGS\Koperek.VCL\LIB\DLLKop32\TSoft_Koder.h" 18791 20064
?debug D "C:\Program Files\Borland\CBuilder5\Projects\OBSOLETE\PROGS\Koperek.VCL\LIB\DLLKop32\TSOFT_MTF.H" 18791 20064
?debug D "C:\Program Files\Borland\CBuilder5\Projects\OBSOLETE\PROGS\Koperek.VCL\LIB\DLLKop32\TSOFT_ARI.H" 18791 20064
?debug D "C:\Program Files\Borland\CBuilder5\Projects\OBSOLETE\PROGS\Koperek.VCL\LIB\DLLKop32\TSOFT_HUFF.H" 18791 20064
?debug D "C:\Program Files\Borland\CBuilder5\Projects\OBSOLETE\PROGS\Koperek.VCL\LIB\DLLKop32\TSOFT_BINTREE.H" 18791 20064
?debug D "C:\Program Files\Borland\CBuilder5\Projects\OBSOLETE\PROGS\Koperek.VCL\LIB\DLLKop32\TSOFT_HDR.H" 18058 42009
?debug D "C:\Program Files\Borland\CBuilder5\Projects\OBSOLETE\PROGS\Koperek.VCL\LIB\DLLKop32\TSOFT_BWTMATRIX.H" 18791 20064
?debug D "C:\Program Files\Borland\CBuilder5\Projects\OBSOLETE\PROGS\Koperek.VCL\LIB\DLLKop32\..\DLLIO\TSOFT_IO.H" 18817 26213
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\CONIO.H" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\_nfile.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\STDIO.H" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\imm.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\mcx.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\winsvc.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\commdlg.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\oleauto.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\propidl.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\oaidl.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\msxml.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\servprov.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\oleidl.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\urlmon.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\cguid.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\objidl.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\unknwn.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\search.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\stdlib.h" 10503 10272
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\objbase.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\ole2.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\prsht.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\winspool.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\winsmcrd.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\winioctl.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\rpcnsip.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\rpcndr.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\wtypes.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\winscard.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\winefs.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\wincrypt.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\qos.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\winsock2.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\winperf.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\shellapi.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\rpcasync.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\rpcnterr.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\rpcnsi.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\rpcdcep.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\rpcdce.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\windows.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\rpc.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\nb30.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\mmsystem.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\lzexpand.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\dlgs.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\ddeml.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\dde.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\cderr.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\winnetwk.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\winreg.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\winver.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\wincon.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\winnls.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\tvout.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\winuser.h" 18052 43723
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\pshpack1.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\wingdi.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\winerror.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\winbase.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\pshpack8.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\pshpack2.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\poppack.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\pshpack4.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\_loc.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\locale.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\_str.h" 10503 10272
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\string.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\guiddef.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\basetsd.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\mbctype.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\ctype.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\winnt.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\windef.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\stdarg.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\excpt.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\_null.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\_defs.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\_stddef.h" 10305 10240
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\mem.h" 10503 10272
?debug D "C:\PROGRAM FILES\BORLAND\CBUILDER5\INCLUDE\WINDOWS.H" 10305 10240
?debug D "C:\Program Files\Borland\CBuilder5\Projects\OBSOLETE\PROGS\Koperek.VCL\LIB\DLLKop32\TSoft_Koder.cpp" 19509 27843
end
|
Assignment2/prog1/prog.asm | nikhilnayak98/CSE2011 | 0 | 15311 | <reponame>nikhilnayak98/CSE2011<gh_stars>0
.data
aside: .word 1
bside: .word 2
cside: .word 3
.text
main:
lw $t0,aside
lw $t1,bside
lw $t2,cside
mul $t3,$t1,$t0
mul $t4,$t2,$t1
mul $t5,$t0,$t2
add $t7,$t3,$t4
add $t8,$t5,$t7
mul $t8,$t8,2
li $v0,10
syscall
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_485.asm | ljhsiun2/medusa | 9 | 92529 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x19c70, %rsi
lea addresses_WC_ht+0x12970, %rdi
nop
nop
nop
mfence
mov $58, %rcx
rep movsb
nop
add $12563, %r12
lea addresses_normal_ht+0x1b370, %rsi
lea addresses_WC_ht+0x78d0, %rdi
nop
nop
nop
nop
and %r9, %r9
mov $59, %rcx
rep movsw
nop
nop
dec %r9
lea addresses_normal_ht+0x4b10, %r12
nop
xor $31064, %rbp
mov $0x6162636465666768, %r9
movq %r9, %xmm7
and $0xffffffffffffffc0, %r12
movaps %xmm7, (%r12)
nop
nop
nop
nop
nop
dec %rbp
lea addresses_WT_ht+0xf5e0, %rcx
nop
xor $33860, %rbp
mov $0x6162636465666768, %r12
movq %r12, %xmm3
movups %xmm3, (%rcx)
nop
nop
and %rsi, %rsi
lea addresses_D_ht+0x11770, %rcx
nop
nop
xor $23344, %r9
mov $0x6162636465666768, %rdi
movq %rdi, (%rcx)
dec %r9
lea addresses_normal_ht+0x18f0, %rcx
nop
nop
nop
nop
nop
xor %rdi, %rdi
mov (%rcx), %r12
nop
sub $47019, %rbp
lea addresses_D_ht+0x1c870, %rbp
nop
nop
nop
nop
nop
add $4245, %r9
movb $0x61, (%rbp)
nop
nop
nop
nop
nop
sub $35348, %rbp
lea addresses_normal_ht+0x1a1f0, %r9
nop
nop
nop
add $25987, %r10
movb $0x61, (%r9)
nop
nop
sub $60491, %rdi
lea addresses_A_ht+0x12f70, %rcx
nop
nop
nop
sub $47020, %r12
movb $0x61, (%rcx)
and $61118, %r12
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %rax
push %rbx
push %rcx
push %rdx
push %rsi
// Load
lea addresses_D+0x8570, %r11
nop
xor $38218, %rdx
mov (%r11), %ebx
cmp $19783, %rbx
// Store
lea addresses_PSE+0x10eb0, %rbx
nop
nop
xor %rsi, %rsi
mov $0x5152535455565758, %r13
movq %r13, (%rbx)
xor $18599, %rbx
// Store
lea addresses_RW+0x18eea, %r13
nop
nop
nop
nop
dec %rcx
movw $0x5152, (%r13)
nop
cmp $41887, %rcx
// Faulty Load
lea addresses_normal+0xc770, %rsi
nop
nop
and $23594, %rax
movups (%rsi), %xmm3
vpextrq $1, %xmm3, %r11
lea oracles, %rsi
and $0xff, %r11
shlq $12, %r11
mov (%rsi,%r11,1), %r11
pop %rsi
pop %rdx
pop %rcx
pop %rbx
pop %rax
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 2, 'type': 'addresses_normal', 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_D', 'congruent': 8}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_PSE', 'congruent': 6}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_RW', 'congruent': 1}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_normal', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'congruent': 9, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_WT_ht'}}
{'dst': {'same': False, 'congruent': 5, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_normal_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 16, 'type': 'addresses_normal_ht', 'congruent': 4}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_WT_ht', 'congruent': 3}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 8, 'type': 'addresses_D_ht', 'congruent': 11}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_normal_ht', 'congruent': 7}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_D_ht', 'congruent': 8}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_normal_ht', 'congruent': 6}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_A_ht', 'congruent': 10}, 'OP': 'STOR'}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
src/Formulas.agda | andreasabel/ipl | 19 | 16403 | <reponame>andreasabel/ipl
{-# OPTIONS --rewriting #-}
-- {-# OPTIONS --confluence-check #-}
-- Formulæ and hypotheses (contexts)
open import Library
module Formulas (Base : Set) where
-- Propositional formulas
data Form : Set where
Atom : (P : Base) → Form
True False : Form
_∨_ _∧_ _⇒_ : (A B : Form) → Form
infixl 8 _∧_
infixl 7 _∨_
infixr 6 _⇒_
infixr 5 ¬_
¬_ : (A : Form) → Form
¬ A = A ⇒ False
-- Contexts
data Cxt : Set where
ε : Cxt
_∙_ : (Γ : Cxt) (A : Form) → Cxt
infixl 4 _∙_
-- Context extension (thinning)
infix 3 _≤_
data _≤_ : (Γ Δ : Cxt) → Set where
ε : ε ≤ ε
weak : ∀{A Γ Δ} (τ : Γ ≤ Δ) → Γ ∙ A ≤ Δ
lift : ∀{A Γ Δ} (τ : Γ ≤ Δ) → Γ ∙ A ≤ Δ ∙ A
id≤ : ∀{Γ} → Γ ≤ Γ
id≤ {ε} = ε
id≤ {Γ ∙ A} = lift id≤
-- Category of thinnings
_•_ : ∀{Γ Δ Φ} (τ : Γ ≤ Δ) (σ : Δ ≤ Φ) → Γ ≤ Φ
ε • σ = σ
weak τ • σ = weak (τ • σ)
lift τ • weak σ = weak (τ • σ)
lift τ • lift σ = lift (τ • σ)
•-id-l : ∀{Γ Δ} (τ : Γ ≤ Δ) → id≤ • τ ≡ τ
•-id-l ε = refl
•-id-l (weak τ) = cong weak (•-id-l τ)
•-id-l (lift τ) = cong lift (•-id-l τ)
•-id-r : ∀{Γ Δ} (τ : Γ ≤ Δ) → τ • id≤ ≡ τ
•-id-r ε = refl
•-id-r (weak τ) = cong weak (•-id-r τ)
•-id-r (lift τ) = cong lift (•-id-r τ)
•-ε-r : ∀{Γ} (τ : Γ ≤ ε) → τ • ε ≡ τ
•-ε-r ε = refl
•-ε-r (weak τ) = cong weak (•-ε-r τ)
{-# REWRITE •-id-l •-id-r •-ε-r #-}
-- Pullbacks
record RawPullback {Γ Δ₁ Δ₂} (τ₁ : Δ₁ ≤ Γ) (τ₂ : Δ₂ ≤ Γ) : Set where
constructor rawPullback; field
{Γ'} : Cxt
τ₁' : Γ' ≤ Δ₁
τ₂' : Γ' ≤ Δ₂
comm : τ₁' • τ₁ ≡ τ₂' • τ₂
-- The glb is only unique up to isomorphism:
-- for glb (weak τ₁) (weak τ₂) we have two choices how to proceed.
glb : ∀ {Γ Δ₁ Δ₂} (τ₁ : Δ₁ ≤ Γ) (τ₂ : Δ₂ ≤ Γ) → RawPullback τ₁ τ₂
glb ε τ₂ = rawPullback τ₂ id≤ refl -- REWRITE (•-id-r τ₂)
glb τ₁ ε = rawPullback id≤ τ₁ refl -- REWRITE (•-id-l τ₁)
glb (weak τ₁) τ₂ =
let rawPullback τ₁' τ₂' comm = glb τ₁ τ₂
in rawPullback (lift τ₁') (weak τ₂') (cong weak comm)
glb τ₁ (weak τ₂) =
let rawPullback τ₁' τ₂' comm = glb τ₁ τ₂
in rawPullback (weak τ₁') (lift τ₂') (cong weak comm)
glb (lift τ₁) (lift τ₂) =
let rawPullback τ₁' τ₂' comm = glb τ₁ τ₂
in rawPullback (lift τ₁') (lift τ₂') (cong lift comm)
-- glb (weak τ₁) (weak τ₂) =
-- let rawPullback τ₁' τ₂' comm = glb τ₁ τ₂
-- in rawPullback (weak (lift τ₁')) (lift (weak τ₂')) (cong (weak ∘ weak) comm)
-- -- Here is a choice: it would also work the other way round:
-- -- rawPullback (lift (weak τ₁')) (weak (lift τ₂')) (cong (weak ∘ weak) comm)
-- glb (weak τ₁) (lift τ₂) =
-- let rawPullback τ₁' τ₂' comm = glb τ₁ (lift τ₂)
-- in rawPullback (lift τ₁') (weak τ₂') (cong weak comm)
record WeakPullback {Γ Δ₁ Δ₂} (τ₁ : Δ₁ ≤ Γ) (τ₂ : Δ₂ ≤ Γ) : Set where
constructor weakPullback
field
rawpullback : RawPullback τ₁ τ₂
open RawPullback rawpullback public
-- field
-- largest : ∀ (pb : RawPullback τ₁ τ₂)
-- There are actually no pullbacks in the OPE category
-- Hypotheses
data Hyp (A : Form) : (Γ : Cxt) → Set where
top : ∀{Γ} → Hyp A (Γ ∙ A)
pop : ∀{Γ B} (x : Hyp A Γ) → Hyp A (Γ ∙ B)
Mon : (P : Cxt → Set) → Set
Mon P = ∀{Γ Δ} (τ : Γ ≤ Δ) → P Δ → P Γ
monH : ∀{A} → Mon (Hyp A)
monH ε ()
monH (weak τ) x = pop (monH τ x)
monH (lift τ) top = top
monH (lift τ) (pop x) = pop (monH τ x)
monH-id : ∀{Γ A} (x : Hyp A Γ) → monH id≤ x ≡ x
monH-id top = refl
monH-id (pop x) = cong pop (monH-id x)
monH• : ∀{Γ Δ Φ A} (τ : Γ ≤ Δ) (σ : Δ ≤ Φ) (x : Hyp A Φ) → monH (τ • σ) x ≡ monH τ (monH σ x)
monH• ε ε ()
monH• (weak τ) σ x = cong pop (monH• τ σ x)
monH• (lift τ) (weak σ) x = cong pop (monH• τ σ x)
monH• (lift τ) (lift σ) top = refl
monH• (lift τ) (lift σ) (pop x) = cong pop (monH• τ σ x)
{-# REWRITE monH-id monH• #-}
□ : (P : Cxt → Set) → Cxt → Set
□ P Γ = ∀{Δ} (τ : Δ ≤ Γ) → P Δ
mon□ : ∀{P} → Mon (□ P)
mon□ τ x τ′ = x (τ′ • τ)
infix 1 _→̇_
infixr 2 _⇒̂_
-- Presheaf morphism
_→̇_ : (P Q : Cxt → Set) → Set
P →̇ Q = ∀{Γ} → P Γ → Q Γ
⟨_⊙_⟩→̇_ : (P Q R : Cxt → Set) → Set
⟨ P ⊙ Q ⟩→̇ R = ∀{Γ} → P Γ → Q Γ → R Γ
⟨_⊙_⊙_⟩→̇_ : (P Q R S : Cxt → Set) → Set
⟨ P ⊙ Q ⊙ R ⟩→̇ S = ∀{Γ} → P Γ → Q Γ → R Γ → S Γ
-- Pointwise presheaf arrow (not a presheaf)
CFun : (P Q : Cxt → Set) → Cxt → Set
CFun P Q Γ = P Γ → Q Γ
-- Presheaf exponentional (Kripke function space)
KFun : (P Q : Cxt → Set) → Cxt → Set
KFun P Q = □ (CFun P Q)
-- Again, in expanded form.
_⇒̂_ : (P Q : Cxt → Set) → Cxt → Set
P ⇒̂ Q = λ Γ → ∀{Δ} (τ : Δ ≤ Γ) → P Δ → Q Δ
-- -}
-- -}
-- -}
-- -}
-- -}
|
openal-list.adb | io7m/coreland-openal-ada | 1 | 20982 | with Interfaces.C;
with System.Address_To_Access_Conversions;
with System.Storage_Elements;
with Ada.Strings.Unbounded;
package body OpenAL.List is
package C renames Interfaces.C;
package UB_Strings renames Ada.Strings.Unbounded;
package Bytes is new System.Address_To_Access_Conversions (Object => C.char);
use System.Storage_Elements;
use type C.char;
use type UB_Strings.Unbounded_String;
procedure Address_To_Vector
(Address : in System.Address;
List : out String_Vector_t)
is
Current_Address : System.Address := Address;
Char_Pointer : Bytes.Object_Pointer;
Next_Pointer : Bytes.Object_Pointer;
Buffer : UB_Strings.Unbounded_String;
begin
Main_Loop : loop
Char_Pointer := Bytes.To_Pointer (Current_Address);
if Char_Pointer.all /= C.nul then
UB_Strings.Append (Buffer, C.To_Ada (Char_Pointer.all));
else
if Buffer /= UB_Strings.Null_Unbounded_String then
String_Vectors.Append (List, UB_Strings.To_String (Buffer));
Buffer := UB_Strings.Null_Unbounded_String;
end if;
Next_Pointer := Bytes.To_Pointer (Current_Address + 1);
if Next_Pointer.all = C.nul then
exit Main_Loop;
end if;
end if;
Current_Address := Current_Address + 1;
end loop Main_Loop;
end Address_To_Vector;
end OpenAL.List;
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_2774.asm | ljhsiun2/medusa | 9 | 1157 | <reponame>ljhsiun2/medusa<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r8
push %rbp
push %rbx
push %rdx
push %rsi
lea addresses_WC_ht+0xe7eb, %rdx
nop
nop
nop
nop
sub %r14, %r14
mov (%rdx), %bx
nop
nop
nop
nop
cmp $59086, %rsi
lea addresses_A_ht+0xf7dd, %rsi
nop
nop
nop
nop
and $36125, %r14
mov (%rsi), %ebp
nop
nop
nop
sub %r14, %r14
lea addresses_normal_ht+0x13add, %r8
nop
nop
inc %rbp
mov $0x6162636465666768, %rsi
movq %rsi, %xmm3
and $0xffffffffffffffc0, %r8
vmovaps %ymm3, (%r8)
dec %rbp
pop %rsi
pop %rdx
pop %rbx
pop %rbp
pop %r8
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %rax
push %rbx
push %rcx
push %rsi
// Faulty Load
lea addresses_RW+0x2fdd, %r13
nop
nop
nop
nop
sub $16648, %rbx
movb (%r13), %al
lea oracles, %rsi
and $0xff, %rax
shlq $12, %rax
mov (%rsi,%rax,1), %rax
pop %rsi
pop %rcx
pop %rbx
pop %rax
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': True, 'congruent': 0, 'size': 1, 'same': False, 'NT': True}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 11, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': True, 'congruent': 6, 'size': 32, 'same': False, 'NT': False}}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
programs/oeis/030/A030109.asm | neoneye/loda | 22 | 19966 | <filename>programs/oeis/030/A030109.asm<gh_stars>10-100
; A030109: Write n in binary, reverse bits, subtract 1, divide by 2.
; 0,0,1,0,2,1,3,0,4,2,6,1,5,3,7,0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15,0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30,1,17,9,25,5,21,13,29,3,19,11,27,7,23,15,31,0,32,16,48,8,40,24,56,4,36,20,52,12,44,28,60,2,34,18,50,10,42,26,58,6,38,22,54,14,46,30,62,1,33,17,49,9
mov $1,$0
lpb $1
mul $0,2
sub $0,$1
sub $0,1
sub $1,1
div $1,2
sub $0,$1
lpe
|
src/cry/ec.agda | semenov-vladyslav/cry-agda | 0 | 7486 | <reponame>semenov-vladyslav/cry-agda
module cry.ec where
open import Level
open import Relation.Nullary
open import Agda.Builtin.Bool
open import Agda.Builtin.Nat using () renaming (Nat to ℕ)
open import Agda.Builtin.List
open import cry.gfp
infixr 4 _,_
infixr 2 _×_
record _×_ {a b} (A : Set a) (B : Set b) : Set (a ⊔ b) where
constructor _,_
field
proj₁ : A
proj₂ : B
open _×_ public
-- EC: group of points of elliptic curve (in jacobian coordinates, without conversion to affine)
module ec {c ℓ} (gfp : RawField c ℓ) (a b : RawField.Carrier gfp) where
module F = RawField gfp
open F renaming (Carrier to 𝔽; _≈_ to _=F_; _≈?_ to _≟F_)
record Point : Set c where
constructor _∶_∶_
field
x y z : 𝔽
is-point : Point → Bool
-- (y/z³) ² ≡ (x/z²) ³ + a * (x/z²) + b
is-point (x ∶ y ∶ z) =
let
y² = y ²
x² = x ²
x³ = x² * x
z² = z ²
z⁴ = z² ²
z⁶ = z² * z⁴
xz⁴ = x * z⁴
axz⁴ = a * xz⁴
bz⁶ = b * z⁶
x³+axz⁴ = x³ + axz⁴
x³+axz⁴+bz⁶ = x³+axz⁴ + bz⁶
in y² F.?≈ x³+axz⁴+bz⁶
aff : Point → Point
aff (x ∶ y ∶ z) = x′ ∶ y′ ∶ 1# where
z⁻¹ = z ⁻¹
z⁻² = z⁻¹ ²
z⁻³ = z⁻² * z⁻¹
x′ = x * z⁻²
y′ = y * z⁻³
_==_ : Point → Point → Set _
(x₁ ∶ y₁ ∶ z₁) == (x₂ ∶ y₂ ∶ z₂)
-- p₁ == p₂ with norm2 p₁ p₂
-- ... | (x₁z₂² , x₂z₁²) , (y₁z₂³ , y₂z₁³)
= x₁z₂² =F x₂z₁² × y₁z₂³ =F y₂z₁³ where
{-
x₁/z₁² ≡ x₂/z₂²
y₁/z₁³ ≡ y₂/z₂³
-}
z₂² = z₂ ²
z₁² = z₁ ²
x₁z₂² = x₁ * z₂²
x₂z₁² = x₂ * z₁²
z₂³ = z₂ * z₂²
z₁³ = z₁ * z₁²
y₁z₂³ = y₁ * z₂³
y₂z₁³ = y₂ * z₁³
_≟_ : (p₁ p₂ : Point) → Dec (p₁ == p₂)
(x₁ ∶ y₁ ∶ z₁) ≟ (x₂ ∶ y₂ ∶ z₂) = r where
z₂² = z₂ ²
z₁² = z₁ ²
x₁z₂² = x₁ * z₂²
x₂z₁² = x₂ * z₁²
z₂³ = z₂ * z₂²
z₁³ = z₁ * z₁²
y₁z₂³ = y₁ * z₂³
y₂z₁³ = y₂ * z₁³
r : _
r with x₁z₂² ≟F x₂z₁²
... | no x₁≠x₂ = no (λ p₁=p₂ → x₁≠x₂ (proj₁ p₁=p₂))
... | yes x₁=x₂ with y₁z₂³ ≟F y₂z₁³
... | no y₁≠y₂ = no (λ p₁=p₂ → y₁≠y₂ (proj₂ p₁=p₂))
... | yes y₁=y₂ = yes (x₁=x₂ , y₁=y₂)
is-𝕆 : Point → Set _
is-𝕆 (_ ∶ _ ∶ z) = z =F 0#
{-
x₃ = λ² − x₁ − x₂
y₃ = λ(x₁ − x₃) − y₁
λ = (y₂ - y₁) / (x₂ - x₁), p₁ ≠ p₂
λ = (3 x₁ ² + a) / (2 y₁), p₁ = p₂
(x/z²)₃ = λ² − (x/z²)₁ − (x/z²)₂
(y/z³)₃ = λ((x/z²)₁ − (x/z²)₃) − (y/z³)₁
λ = ((y/z³)₂ - (y/z³)₁) / ((x/z²)₂ - (x/z²)₁), p₁ ≠ p₂
λ = (3 (x/z²)₁ ² + a) / (2 (y/z³)₁), p₁ = p₂
x₃/z₃² z₁² z₂² = λ² z₁² z₂² − x₁ z₂² − x₂ z₁²
y₁/z₁³ + y₃/z₃³ = λ(x₁/z₁² − (x₃/z₃²))
y₂/z₂³ + y₃/z₃³ = λ(x₂/z₂² − (x₃/z₃²))
λ z₁ z₂ (x₂ z₁² - x₁ z₂²) = (y₂ z₁³ - y₁ z₂³), p₁ ≠ p₂
λ = (3 (x/z²)₁ ² + a) / (2 (y/z³)₁), p₁ = p₂
p₁ ≠ p₂:
z₃ = z₁ z₂ (x₂ z₁² - x₁ z₂²)
λ z₃ = (y₂ z₁³ - y₁ z₂³)
x₃ = (y₂ z₁³ - y₁ z₂³)² − (x₁ z₂² + x₂ z₁²) (x₂ z₁² - x₁ z₂²)²
y₃ z₁³ = (y₂ z₁³ - y₁ z₂³) (z₃² x₁ − x₃ z₁²) z₁ − y₁ z₃³
(y₁ z₃³ + y₃ z₁³)/(y₂ z₁³ - y₁ z₂³) = (x₁ z₃² − x₃ z₁²) z₁
(y₂ z₃³ + y₃ z₂³)/(y₂ z₁³ - y₁ z₂³) = (x₂ z₃² − x₃ z₂²) z₂
x₁ z₃² − x₃ z₁² =
x₁ (z₁ z₂ (x₂ z₁² - x₁ z₂²))² -
(y₂ z₁³ - y₁ z₂³)² z₁² +
((x₂ z₁²)² - (x₁ z₂²)²) (x₂ z₁² - x₁ z₂²) z₁²
= x₁ z₁² z₂² ((x₂ z₁²)² - 2 x₂ z₁² x₁ z₂² + (x₁ z₂²)²)
+ ((x₂ z₁²)³ - (x₂ z₁²)² x₁ z₂² - (x₁ z₂²)² x₂ z₁² + (x₁ z₂²)³) z₁²
- (y₂ z₁³ - y₁ z₂³)² z₁²
= (- (y₂ z₁³ - y₁ z₂³)²
+ 2 x₁³ z₂⁶ + x₂³ z₁⁶ + x₁² x₂ (-3 z₁² z₂⁴)) z₁²
(y₁ z₃³ + y₃ z₁³) = (y₂ z₁³ - y₁ z₂³) (- (y₂ z₁³ - y₁ z₂³)²
+ 2 x₁³ z₂⁶ + x₂³ z₁⁶ + x₁² x₂ (-3 z₁² z₂⁴)) z₁³
-}
𝕆 : Point
𝕆 = (1# ∶ 1# ∶ 0#)
dbl : Point → Point
dbl (x₁ ∶ y₁ ∶ z₁) = (x₃ ∶ y₃ ∶ z₃) where
{- p₁ = p₂
x₃ = λ² − x₁ − x₁
y₃ = λ(x₁ − x₃) − y₁
λ = (3 x₁ ² + a) / (2 y₁)
x₃ = λ² z₃² − 2 x₁/z₁² z₃²
y₃/z₃³ = λ(x₁/z₁² − x₃/z₃²) − y₁/z₁³
λ = (3 (x₁/z₁²) ² + a) / (2 y₁/z₁³)
λ 2 y₁ z₁ = 3 x₁² + a z₁⁴
z₃ = 2 y₁ z₁
x₃ = (3 x₁² + a z₁⁴)² − 2 x₁ (2 y₁)²
y₃ = (3 x₁² + a z₁⁴) (x₁ (2 y₁)² − x₃) − y₁ (2 y₁)³
-}
2y₁ = y₁ + y₁
z₃ = 2y₁ * z₁
x₁² = x₁ ²
2x₁² = x₁² + x₁²
3x₁² = 2x₁² + x₁²
z₁² = z₁ ²
z₁⁴ = z₁² ²
az₁⁴ = a * z₁⁴
3x₁²+az₁⁴ = 3x₁² + az₁⁴
[3x₁²+az₁⁴]² = 3x₁²+az₁⁴ ²
y₁² = y₁ ²
2y₁² = y₁² + y₁²
4y₁² = 2y₁² + 2y₁²
x₁[2y₁]² = x₁ * 4y₁²
2x₁[2y₁]² = x₁[2y₁]² + x₁[2y₁]²
x₃ = [3x₁²+az₁⁴]² - 2x₁[2y₁]²
4y₁⁴ = 2y₁² ²
8y₁⁴ = 4y₁⁴ + 4y₁⁴
x₁[2y₁]²-x₃ = x₁[2y₁]² - x₃
[3x₁²+az₁⁴][x₁[2y₁]²-x₃] = 3x₁²+az₁⁴ * x₁[2y₁]²-x₃
y₃ = [3x₁²+az₁⁴][x₁[2y₁]²-x₃] - 8y₁⁴
add : Point → Point → Point
add (x₁ ∶ y₁ ∶ z₁) (x₂ ∶ y₂ ∶ z₂) = x₃ ∶ y₃ ∶ z₃ where
{- p₁ ≠ p₂
x₃ = λ² − x₁ − x₂
y₃ = λ(x₁ − x₃) − y₁
λ = (y₂ - y₁) / (x₂ - x₁)
(x/z²)₃ = λ² − (x/z²)₁ − (x/z²)₂
(y/z³)₃ = λ((x/z²)₁ − (x/z²)₃) − (y/z³)₁
λ = ((y/z³)₂ - (y/z³)₁) / ((x/z²)₂ - (x/z²)₁)
λ z₁ z₂ (x₂ z₁² - x₁ z₂²) = (y₂ z₁³ - y₁ z₂³)
x₃/z₃² z₁² z₂² + x₁ z₂² + x₂ z₁² = λ² z₁² z₂²
y₃/z₃³ = λ(x₁/z₁² − x₃/z₃²) − y₁/z₁³
z₃ = z₁ z₂ (x₂ z₁² - x₁ z₂²)
x₃ = (y₂ z₁³ - y₁ z₂³)² - (x₁ z₂² + x₂ z₁²) (x₂ z₁² - x₁ z₂²)²
y₃ = (y₂ z₁³ - y₁ z₂³) (x₁ z₂² (x₂ z₁² - x₁ z₂²)² − x₃) − y₁ z₂³ (x₂ z₁² - x₁ z₂²)³
y₃ = (y₂ z₁³ - y₁ z₂³) ((x₁ z₂²+x₂ z₁²)/2 (x₂ z₁² - x₁ z₂²)² − x₃)
− (x₂ z₁² - x₁ z₂²)³ (y₁ z₂³ + y₂ z₁³)/2
-}
z₁z₂ = z₁ * z₂
z₁² = z₁ ²
z₂² = z₂ ²
x₁z₂² = x₁ * z₂²
x₂z₁² = x₂ * z₁²
z₂³ = z₂ * z₂²
z₁³ = z₁ * z₁²
y₁z₂³ = y₁ * z₂³
y₂z₁³ = y₂ * z₁³
x₂z₁²+x₁z₂² = x₂z₁² + x₁z₂²
x₂z₁²-x₁z₂² = x₂z₁² - x₁z₂²
y₂z₁³-y₁z₂³ = y₂z₁³ - y₁z₂³
z₃ = z₁z₂ * x₂z₁²-x₁z₂²
[x₂z₁²-x₁z₂²]² = x₂z₁²-x₁z₂² ²
[y₂z₁³-y₁z₂³]² = y₂z₁³-y₁z₂³ ²
[x₂z₁²+x₁z₂²][x₂z₁²-x₁z₂²]² = x₂z₁²+x₁z₂² * [x₂z₁²-x₁z₂²]²
x₃ = [y₂z₁³-y₁z₂³]² - [x₂z₁²+x₁z₂²][x₂z₁²-x₁z₂²]²
[x₂z₁²-x₁z₂²]³ = x₂z₁²-x₁z₂² * [x₂z₁²-x₁z₂²]²
y₁z₂³[x₂z₁²-x₁z₂²]³ = y₁z₂³ * [x₂z₁²-x₁z₂²]³
x₁z₂²[x₂z₁²-x₁z₂²]² = x₁z₂² * [x₂z₁²-x₁z₂²]²
x₁z₂²[x₂z₁²-x₁z₂²]²-x₃ = x₁z₂²[x₂z₁²-x₁z₂²]² - x₃
[y₂z₁³-y₁z₂³][x₁z₂²[x₂z₁²-x₁z₂²]²-x₃] = y₂z₁³-y₁z₂³ * x₁z₂²[x₂z₁²-x₁z₂²]²-x₃
y₃ = [y₂z₁³-y₁z₂³][x₁z₂²[x₂z₁²-x₁z₂²]²-x₃] - y₁z₂³[x₂z₁²-x₁z₂²]³
dblAdd : Point → ℕ → Point
dblAdd = times 𝕆 dbl add
module test-ec where
g = cry.gfp.gfp 7
open RawField g renaming (Carrier to 𝔽) public
a b : 𝔽
a = 4
b = 1
xₚ yₚ zₚ : 𝔽
xₚ = 4
yₚ = 2
zₚ = 1
open ec g a b public
P 2P : Point
P = (xₚ ∶ yₚ ∶ zₚ)
2P = dbl P
|
libsrc/_DEVELOPMENT/arch/zx/misc/z80/asm_zx_cls.asm | teknoplop/z88dk | 0 | 244677 | <reponame>teknoplop/z88dk<filename>libsrc/_DEVELOPMENT/arch/zx/misc/z80/asm_zx_cls.asm<gh_stars>0
; ===============================================================
; 2014
; ===============================================================
;
; void zx_cls(uchar attr)
;
; Clear screen using attibute.
;
; ===============================================================
INCLUDE "clib_cfg.asm"
SECTION code_clib
SECTION code_arch
PUBLIC asm_zx_cls
asm_zx_cls:
; enter : l = attr
;
; uses : af, bc, de, hl
; attributes
IF __CLIB_OPT_FASTCOPY & $20
EXTERN l_fast_ldir_0
ld a,l
ld hl,$5800
ld (hl),a
ld de,$5801
ld bc,767
call l_fast_ldir_0 + 2
ELSE
EXTERN asm_memset
ld e,l
ld hl,$5800
ld bc,768
call asm_memset
ENDIF
; pixels
IF __CLIB_OPT_FASTCOPY & $20
ld hl,$4000
ld (hl),l
ld de,$4001
ld bc,6143
jp l_fast_ldir_0 + 2
ELSE
ld hl,$4000
ld e,l
ld bc,6144
jp asm_memset
ENDIF
|
UP1/Algorithms/class7.asm | rubemfsv/Digital-Control-Systems | 0 | 243430 | <reponame>rubemfsv/Digital-Control-Systems<filename>UP1/Algorithms/class7.asm
#INCLUDE<P16F84A.INC>
#DEFINE BANK0 BCF STATUS,RP0
#DEFINE BANK1 BSF STATUS,RP0
#DEFINE BOTAO0 PORTA,0
#DEFINE BOTAO1 PORTA,1
TEMP EQU 0x2C
ORG 0x00
GOTO INICIO
;--- SE UM VALOR ACIMA DE 31 É INSERIDO NA PORTA B O LED A0 DEVE FICAR ACESO ---;
INICIO
CLRW
CLRF PORTB
CLRF PORTA
BANK1
MOVLW 0 ;todos os bits de A sao de saida
MOVWF TRISA
MOVLW 0xFF ;todos os bits de B sao de entrada
MOVWF TRISB
BANK0
MAIN
MOVLW D'31' ;atribui o valor 31 pro registrador de trabalho
MOVWF TEMP ;move o valor do registrador de trabalho (31) para temp
MOVF PORTB,0 ;move o valor de portb para o registrador de trabalho
SUBWF TEMP ;subtrai do registrador de trabalho o valor de temp. 31 - portb
BTFSS STATUS,C ;se o bit c de status tiver
GOTO ACENDE ;se o valor de c for 0, a subtração deu negativa então o valor era maior que 31 então acende
GOTO APAGA ;se o valor de c for 1 a subtração deu maior ou igual a zero então o valor era no máximo 31
ACENDE
BSF PORTA,0 ;acende o led 0 de A
GOTO MAIN
APAGA
BCF PORTA,0 ;apaga o led 0 de A
GOTO MAIN
END
|
src/tools/Dependency_Graph_Extractor/src/extraction.ads | selroc/Renaissance-Ada | 1 | 27545 | with Ada.Strings.Unbounded;
with GNATCOLL.Projects;
with GNATCOLL.VFS;
with Libadalang.Analysis;
with Libadalang.Common;
with GraphML_Writers;
package Extraction is
package GPR renames GNATCOLL.Projects;
package GW renames GraphML_Writers;
package LAL renames Libadalang.Analysis;
package LALCO renames Libadalang.Common;
package SU renames Ada.Strings.Unbounded;
package VFS renames GNATCOLL.VFS;
function Node_Attributes return GW.Attribute_Definition_Sets.Map;
function Edge_Attributes return GW.Attribute_Definition_Sets.Map;
procedure Extract_Dependency_Graph
(Project_Filename : String;
Recurse_Projects : Boolean;
Directory_Prefix : VFS.Virtual_File;
Graph_File : in out GW.GraphML_File);
private
function "="(L, R : LAL.Ada_Node'Class) return Boolean renames LAL."=";
function "+"(Str : String) return SU.Unbounded_String is
(SU.To_Unbounded_String(Str));
Internal_Extraction_Error : exception;
end Extraction;
|
asm_main.asm | CISVVC/cis208-chapter05-arrays-Tyler-Lafond | 0 | 6528 | <gh_stars>0
;FileName: asm_main.asm
;Author: <NAME>
;Description: Multiplies an array by a scalar and prints the new array
;Email: <EMAIL>
;
; file: asm_main.asm
%include "asm_io.inc"
%define DOUBLEWORD 4 ; Defines variable to space DWORDS in array
;
; initialized data is put in the .data segment
;
segment .data
syswrite: equ 4
stdout: equ 1
exit: equ 1
SUCCESS: equ 0
kernelcall: equ 80h
a1: dd 2,5,4,7,1 ; Dword array used in the program
scalar: dd 2 ; Variable to scale arary values by
size: dd 5 ; Size of array
; uninitialized data is put in the .bss segment
;
segment .bss
;
; code is put in the .text segment
;
segment .text
global asm_main
asm_main:
enter 0,0 ; setup routine
pusha
; *********** Start Assignment Code *******************
mov eax, 0 ; EAX = 0, EBX = scalar, ECX = size, edx = a1
mov ebx, [scalar]
mov ecx, [size]
mov edx, a1
push edx ; Pushes EAX, EBX, ECX, and EDX to the stack
push ecx
push ebx
push eax
call changeArray ; Calls changeArray function
call printArray ; Calls printArray function w/ params passed from the stack values from changeArray
; *********** End Assignment Code **********************
popa
mov eax, SUCCESS ; return back to the C program
leave
ret
changeArray: ; changeArray Prologue Code
pop ebp ; Pops return address to ebp
pop eax ; Pops other stack values into respective regs
pop ebx
pop ecx
pop edx
changeArrayLoop: ; changeArray Body. Starts at last value of array
mov eax, [edx + ecx*DOUBLEWORD - 4] ; Moves the current array value into eax
imul eax, ebx ; Multiplies EAX by EBX
mov [edx + ecx*DOUBLEWORD - 4], eax ; Replaces old array value with new value
xor eax, eax ; Sets EAX to 0
loop changeArrayLoop ; Loops through changeArrayLoop
xor ebx, ebx ; Sets EBX to 0
changeArrayEnd: ; changeArray Epilogue Code
push edx ; Pushes EAX, ECX, EDX, and EBP to the stack
push ecx
push eax
push ebp
ret ; Returns to asm_main
printArray: ; printArray Prologue Code
pop ebp ; Pops return address to EBP
pop eax ; Pops other stack values into respective regs
pop ecx
pop edx
printArrayLoop: ; printArray Body. Starts at first value of array
cmp ecx, [size] ; Compares ECX with size. JE Epilogue Code
je printArrayEnd
mov eax, [edx + ecx*DOUBLEWORD] ; Moves current array value to EAX and prints
call print_int
call print_nl
inc ecx ; Increments ECX
xor eax, eax ; Sets EAX to 0
jmp printArrayLoop ; Jumps to printArrayLoop
printArrayEnd: ; printArray Epilogue Code
push ebp ; Pushes EBP to stack
ret ; Return to asm_main
|
src/Coirc/Network/Primitive.agda | larrytheliquid/coirc | 0 | 2460 | <filename>src/Coirc/Network/Primitive.agda
module Coirc.Network.Primitive where
{-# IMPORT Coirc.Network.FFI #-}
{-# IMPORT System.IO #-}
open import Data.String
open import IO.Primitive
open import Foreign.Haskell
postulate Handle : Set
{-# COMPILED_TYPE Handle System.IO.Handle #-}
postulate hConnect : String → IO Handle
{-# COMPILED hConnect Coirc.Network.FFI.hConnect #-}
postulate hPutStr : Handle → String → IO Unit
{-# COMPILED hPutStr System.IO.hPutStr #-}
postulate hGetLine : Handle → IO String
{-# COMPILED hGetLine System.IO.hGetLine #-}
|
message-format/src/main/antlr/MessageLexer.g4 | jgremmen/message-format | 1 | 2893 | /*
* Copyright 2020 <NAME>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
lexer grammar MessageLexer;
tokens {
BOOL,
NUMBER,
COMMA,
NAME,
SINGLE_QUOTE_START,
DOUBLE_QUOTE_START
}
// ------------------ Default mode ------------------
PARAM_START
: ParamStart -> pushMode(PARAMETER)
;
CH
: Character
;
CTRL_CHAR
: CtrlChar+ -> skip
;
// ------------------ In single quoted text mode ------------------
mode TEXT1;
PARAM_START1
: ParamStart -> pushMode(PARAMETER), type(PARAM_START)
;
SINGLE_QUOTE_END
: '\'' -> popMode
;
CH1
: Character -> type(CH)
;
CTRL_CHAR1
: CtrlChar+ -> skip
;
// ------------------ In double quoted text mode ------------------
mode TEXT2;
PARAM_START2
: ParamStart -> pushMode(PARAMETER), type(PARAM_START)
;
DOUBLE_QUOTE_END
: '"' -> popMode
;
CH2
: Character -> type(CH)
;
CTRL_CHAR2
: CtrlChar+ -> skip
;
// ------------------ In parameter mode ------------------
mode PARAMETER;
PARAM_END
: '}' -> popMode
;
P_COMMA
: ',' -> type(COMMA)
;
P_BOOL
: BoolLiteral -> type(BOOL)
;
P_NAME
: DashedName -> type(NAME)
;
P_NUMBER
: Number -> type(NUMBER)
;
P_SQ_START
: '\'' -> pushMode(TEXT1), type(SINGLE_QUOTE_START)
;
P_DQ_START
: '"' -> pushMode(TEXT2), type(DOUBLE_QUOTE_START)
;
P_WS
: (CtrlChar | ' ')+ -> skip
;
MAP_START
: '{' -> pushMode(MAP)
;
// ------------------ In map mode ------------------
mode MAP;
MAP_END
: '}' -> popMode
;
COLON
: ':'
;
M_WS
: (CtrlChar | ' ')+ -> skip
;
M_COMMA
: ',' -> type(COMMA)
;
NULL
: 'null'
;
EMPTY
: 'empty'
;
M_BOOL
: BoolLiteral -> type(BOOL)
;
M_NAME
: DashedName -> type(NAME)
;
M_NUMBER
: Number -> type(NUMBER)
;
M_SQ_START
: '\'' -> pushMode(TEXT1), type(SINGLE_QUOTE_START)
;
M_DQ_START
: '"' -> pushMode(TEXT2), type(DOUBLE_QUOTE_START)
;
EQ
: '='
;
NE
: '<>' | '!'
;
LT
: '<'
;
LTE
: '<='
;
GT
: '>'
;
GTE
: '>='
;
// ------------------ Fragments ------------------
fragment ParamStart
: '%{'
;
fragment BoolLiteral
: 'true'
| 'false'
;
fragment CtrlChar
: [\u0000-\u001f]
;
fragment TextChar
: '\u0020'..'\uffff'
;
fragment DashedName
: Name ('-' Name)*
;
fragment Name
: NameStartChar NameChar*
;
fragment NameChar
: NameStartChar
| [0-9_]
| '\u00b7'
| '\u0300'..'\u036f'
| '\u203f'..'\u2040'
;
fragment NameStartChar
: [a-zA-Z]
| ~[\u0000-\u007F\uD800-\uDBFF] // covers all characters above 0x7F which are not a surrogate
| [\uD800-\uDBFF] [\uDC00-\uDFFF] // covers UTF-16 surrogate pairs encodings for U+10000 to U+10FFFF
;
fragment Number
: '-'? [0-9]+
;
fragment Character
: ' '+
| EscapeSequence
| TextChar
;
fragment EscapeSequence
: '\\u' HexDigit HexDigit HexDigit HexDigit
| '\\' ["'%{\\]
;
fragment HexDigit
: [0-9a-fA-F]
;
|
programs/oeis/050/A050484.asm | neoneye/loda | 22 | 163842 | <filename>programs/oeis/050/A050484.asm
; A050484: Partial sums of A051946.
; 1,12,68,264,810,2112,4884,10296,20163,37180,65208,109616,177684,279072,426360,635664,927333,1326732,1865116,2580600,3519230,4736160,6296940,8278920,10772775,13884156,17735472,22467808,28242984,35245760,43686192,53802144,65861961,80167308,97056180,116906088,140137426,167217024,198661892,235043160,276990219,325195068,380416872,443486736,515312700,596884960,689281320,793672880,911329965,1043628300,1192055436,1358217432,1543845798,1750804704,1981098460,2236879272,2520455279,2834298876,3181055328,3563551680,3984805968,4448036736,4956672864,5514363712,6124989585,6792672524,7521787428,8316973512,9183146106,10125508800,11149565940,12261135480,13466362195,14771731260,16184082200,17710623216,19358945892,21137040288,23053310424,25116590160,27336159477,29721761164,32283617916,35032449848,37979492430,41136514848,44515838796,48130357704,51993556407,56119531260,60523010704,65219376288,70224684152,75555686976,81229856400,87265405920,93681314265,100497349260,107734092180,115412962600
lpb $0
mov $2,$0
sub $0,1
seq $2,51946 ; Expansion of g.f.: (1+4*x)/(1-x)^7.
add $1,$2
lpe
add $1,1
mov $0,$1
|
oeis/092/A092634.asm | neoneye/loda-programs | 11 | 92394 | ; A092634: a(n) = 1 - Sum_{k=2..n} k*k!.
; Submitted by <NAME>(w2)
; -3,-21,-117,-717,-5037,-40317,-362877,-3628797,-39916797,-479001597,-6227020797,-87178291197,-1307674367997,-20922789887997,-355687428095997,-6402373705727997,-121645100408831997,-2432902008176639997,-51090942171709439997,-1124000727777607679997,-25852016738884976639997,-620448401733239439359997,-15511210043330985983999997,-403291461126605635583999997,-10888869450418352160767999997,-304888344611713860501503999997,-8841761993739701954543615999997,-265252859812191058636308479999997
add $0,2
mov $1,2
lpb $0
add $2,$0
mul $2,$0
sub $0,1
lpe
sub $1,$2
mov $0,$1
|
routines/unitEvents.asm | PeterTillema/Age-Of-CEmpires-I | 20 | 170264 | <gh_stars>10-100
; All the unit events
; Inputs:
; A = event type
; IY = pointer to unit stract
UnitAttack1:
UnitAttack2:
UnitAttack3:
UnitAttack4:
UnitAttack5:
UnitAttack6:
UnitAttack7:
UnitAttack8:
UnitDie1:
UnitDie2:
UnitWalk11:
UnitWalk12:
UnitWalk13:
UnitWalk21:
UnitWalk22:
UnitWalk23:
UnitWalk31:
UnitWalk32:
UnitWalk33:
UnitWalk41:
UnitWalk42:
UnitWalk43:
UnitWalk51:
UnitWalk52:
UnitWalk53:
UnitWalk61:
UnitWalk62:
UnitWalk63:
UnitWalk71:
UnitWalk72:
UnitWalk73:
UnitWalk81:
UnitWalk82:
UnitWalk83:
ret
RemoveUnitFromTile:
; Inputs:
; A = unit index
ld ix, units_stack
ld c, a ; C = unit index
ld e, a ; E = unit index
ld b, UNIT_ENTRY.size
mlt bc
add ix, bc
ld c, (ix + UNIT_ENTRY.Y)
ld b, MAP_SIZE
mlt bc
ld hl, (map_data_ptr)
add hl, bc
ld c, (ix + UNIT_ENTRY.X)
ld b, 0
add hl, bc
; UnitPrev :
; 255 :
; UnitNext :
; 255 : Remove unit from map data
; X : Set map data to unit X and 255 as UnitPrev of unit X
; X :
; UnitNext :
; 255 : Set 255 as UnitNext of unit X
; Y : Set UnitPrev of unit Y to X, set UnitNext of unit X to unit Y
ld a, (ix + UNIT_ENTRY.PREV)
cp a, 255
jr nz, ChangeUnitNext
; UnitPrev = 255
ld c, (ix + UNIT_ENTRY.NEXT)
inc c
jr z, RemoveUnitFromMap
; UnitNext = X
dec c ; Set mapa data to unit X
inc hl
ld (hl), c
ld b, UNIT_ENTRY.size ; Set 255 as UnitPrev of unit X
mlt bc
ld ix, units_stack
add ix, bc
ld (ix + UNIT_ENTRY.PREV), 255
ret
RemoveUnitFromMap:
; UnitNext = 255
ld a, (hl) ; Remove unit from map data
sub a, TILE_UNIT_GRASS - TILE_GRASS
ld (hl), a
ret
ChangeUnitNext: ; A = UnitPrev
; UnitPrev = X
ld e, (ix + UNIT_ENTRY.NEXT)
ld c, a
ld b, UNIT_ENTRY.size
mlt bc
ld ix, units_stack
lea hl, ix + UNIT_ENTRY.NEXT
add hl, bc
ld (hl), e
inc e
ret z
; UnitNext = Y
dec e
ld d, UNIT_ENTRY.size
mlt de
ld ix, units_stack
add ix, de
ld (ix + UNIT_ENTRY.PREV), a
ret
|
3-mid/impact/source/3d/impact-d3-object.ads | charlie5/lace | 20 | 13611 | <filename>3-mid/impact/source/3d/impact-d3-object.ads
with impact.d3.Shape,
impact.d3.collision.Proxy,
ada.Containers.Vectors;
-- with any_Math;
package impact.d3.Object
--
-- Item can be used to manage collision detection objects.
--
-- Item maintains all information that is needed for a collision detection: Shape, Transform and AABB proxy.
-- They can be added to the impact.d3.Space.
--
is
use Math;
type Item is new Any with private;
type View is access all Item'Class;
--- Containers
--
package Vectors is new ada.Containers.Vectors (Positive, View);
subtype Vector is Vectors.Vector;
-- island management, m_activationState1
--
ACTIVE_TAG : constant := 1;
ISLAND_SLEEPING : constant := 2;
WANTS_DEACTIVATION : constant := 3;
DISABLE_DEACTIVATION : constant := 4;
DISABLE_SIMULATION : constant := 5;
-- CollisionFlags
--
CF_STATIC_OBJECT : constant Flags := 1;
CF_KINEMATIC_OBJECT : constant Flags := 2;
CF_NO_CONTACT_RESPONSE : constant Flags := 4;
CF_CUSTOM_MATERIAL_CALLBACK : constant Flags := 8; -- this allows per-triangle material (friction/restitution)
CF_CHARACTER_OBJECT : constant Flags := 16;
CF_DISABLE_VISUALIZE_OBJECT : constant Flags := 32; -- disable debug drawing
CF_DISABLE_SPU_COLLISION_PROCESSING : constant Flags := 64; -- disable parallel/SPU processing
-- CollisionObjectTypes
--
CO_COLLISION_OBJECT : constant Flags := 1;
CO_RIGID_BODY : constant Flags := 2;
CO_GHOST_OBJECT : constant Flags := 4; -- CO_GHOST_OBJECT keeps track of all objects overlapping its AABB and that pass its collision filter.
-- It is useful for collision sensors, explosion objects, character controller etc.
CO_SOFT_BODY : constant Flags := 8;
CO_HF_FLUID : constant Flags := 16;
CO_USER_TYPE : constant Flags := 32;
type Object_Array is array (Positive range <>) of access Item'Class;
procedure define (Self : in out Item);
procedure destruct (Self : in out Item);
function WorldTransform (Self : in Item) return Transform_3d;
function getWorldTransform (Self : access Item) return access Transform_3d;
function getFriction (Self : in Item) return math.Real;
function getRestitution (Self : in Item) return math.Real;
function getCollisionFlags (Self : in Item) return Flags;
function getCollisionShape (Self : in Item) return access impact.d3.Shape.item'Class;
function getBroadphaseHandle (Self : access Item) return access impact.d3.collision.Proxy.item'Class;
procedure setBroadphaseHandle (Self : in out Item; To : access impact.d3.collision.Proxy.item'Class);
function mergesSimulationIslands (Self : in Item) return Boolean;
function getAnisotropicFriction (Self : in Item) return math.Vector_3;
procedure setAnisotropicFriction (Self : in out Item; To : in math.Vector_3);
function hasAnisotropicFriction (Self : in Item) return Boolean;
procedure setContactProcessingThreshold (Self : in out Item; To : in math.Real);
--
-- The constraint solver can discard solving contacts, if the distance is above this threshold. 0 by default.
-- Note that using contacts with positive distance can improve stability. It increases, however, the chance of colliding with degerate contacts, such as 'interior' triangle edges
function getContactProcessingThreshold (Self : in Item) return math.Real;
function isStaticObject (Self : in Item) return Boolean;
function isKinematicObject (Self : in Item) return Boolean;
function isStaticOrKinematicObject (Self : in Item) return Boolean;
function hasContactResponse (Self : in Item) return Boolean;
procedure setCollisionShape (Self : in out Item; To : access impact.d3.Shape.item'Class);
function getRootCollisionShape (Self : in Item) return access impact.d3.Shape.item'Class;
procedure internalSetTemporaryCollisionShape (Self : in out Item; To : access impact.d3.Shape.item'Class);
--
-- Avoid using this internal API call.
-- 'internalSetTemporaryCollisionShape' is used to temporary replace the actual collision shape by a child collision shape.
function internalGetExtensionPointer (Self : in Item) return access Any'Class;
--
-- Avoid using this internal API call, the extension pointer is used by some Bullet extensions.
-- If you need to store your own user pointer, use 'setUserPointer/getUserPointer' instead.
procedure internalSetExtensionPointer (Self : in out Item; To : access Any'Class);
--
-- Avoid using this internal API call, the extension pointer is used by some Bullet extensions.
-- If you need to store your own user pointer, use 'setUserPointer/getUserPointer' instead.
function getActivationState (Self : in Item) return Integer;
procedure setActivationState (Self : in out Item; To : in Integer);
procedure forceActivationState (Self : in out Item; To : in Integer);
procedure activate (Self : in out Item; forceActivation : in Boolean := False);
function isActive (Self : in Item) return Boolean;
procedure setDeactivationTime (Self : in out Item; To : in math.Real);
function getDeactivationTime (Self : in Item) return math.Real;
procedure setRestitution (Self : in out Item; To : in math.Real);
procedure setFriction (Self : in out Item; To : in math.Real);
procedure setInternalType (Self : out Item; To : in Flags);
function getInternalType (Self : in Item) return Flags;
--
-- reserved for Bullet internal usage
procedure setWorldTransform (Self : in out Item; To : in Transform_3d);
procedure setInterpolationWorldTransform (Self : in out Item; To : in Transform_3d);
function getInterpolationWorldTransform (Self : in Item) return Transform_3d;
function getInterpolationWorldTransform (Self : access Item) return access Transform_3d;
procedure setInterpolationLinearVelocity (Self : in out Item; To : in math.Vector_3);
function getInterpolationLinearVelocity (Self : in Item) return math.Vector_3;
procedure setInterpolationAngularVelocity (Self : in out Item; To : in math.Vector_3);
function getInterpolationAngularVelocity (Self : in Item) return math.Vector_3;
function getIslandTag (Self : in Item) return Integer;
procedure setIslandTag (Self : in out Item; To : in Integer);
function getCompanionId (Self : in Item) return Integer;
procedure setCompanionId (Self : in out Item; To : in Integer);
function getHitFraction (Self : in Item) return math.Real;
procedure setHitFraction (Self : in out Item; To : in math.Real);
procedure setCollisionFlags (Self : in out Item; To : in Flags);
function getCcdSweptSphereRadius (Self : in Item) return math.Real; -- Swept sphere radius (0.0 by default), see impact.d3.collision.Algorithm.activating.convex_convex::
procedure setCcdSweptSphereRadius (Self : in out Item; To : in math.Real); -- Swept sphere radius (0.0 by default), see impact.d3.collision.Algorithm.activating.convex_convex::
function getCcdMotionThreshold (Self : in Item) return math.Real;
procedure setCcdMotionThreshold (Self : in out Item; To : in math.Real); -- Don't do continuous collision detection if the motion (in one step) is less then m_ccdMotionThreshold
function getCcdSquareMotionThreshold (Self : in Item) return math.Real;
function getUserPointer (Self : in Item) return access Any'Class; -- Users can point to their objects, userPointer is not used by Bullet
procedure setUserPointer (Self : in out Item; To : access Any'Class); --
function checkCollideWith (Self : in Item; co : access Item'Class) return Boolean;
procedure setCheckCollideWith (Self : in out Item; To : in Boolean);
private
type Item is new Any with
record
m_worldTransform : aliased Transform_3d;
-- 'm_interpolationWorldTransform' is used for CCD and interpolation
-- it can be either previous or future (predicted) transform
--
m_interpolationWorldTransform : aliased Transform_3d;
-- These two are experimental: just added for bullet time effect, so you can still apply impulses (directly modifying velocities)
-- without destroying the continuous interpolated motion (which uses this interpolation velocities)
--
m_interpolationLinearVelocity : math.Vector_3;
m_interpolationAngularVelocity : math.Vector_3;
m_anisotropicFriction : Math.Vector_3;
m_hasAnisotropicFriction : Boolean;
m_contactProcessingThreshold : math.Real;
m_broadphaseHandle : access impact.d3.collision.Proxy.item'Class;
m_collisionShape : access impact.d3.Shape.item'Class;
-- 'm_extensionPointer' is used by some internal low-level Bullet extensions.
--
m_extensionPointer : access Any'Class;
-- 'm_rootCollisionShape' is temporarily used to store the original collision shape
-- The m_collisionShape might be temporarily replaced by a child collision shape during collision detection purposes
-- If it is NULL, the m_collisionShape is not temporarily replaced.
--
m_rootCollisionShape : access impact.d3.Shape.item'Class;
m_collisionFlags : Flags;
m_islandTag1 : Integer;
m_companionId : Integer;
m_activationState1 : Integer;
m_deactivationTime : math.Real;
m_friction : math.Real;
m_restitution : math.Real;
-- m_internalType is reserved to distinguish Bullet's Item, Item.rigid, btSoftBody, btGhostObject etc.
-- do not assign your own m_internalType unless you write a new dynamics object class.
--
m_internalType : Flags;
-- users can point to their objects, m_userPointer is not used by Bullet, see setUserPointer/getUserPointer
--
m_userObjectPointer : access Any'Class;
-- time of impact calculation
--
m_hitFraction : math.Real;
-- Swept sphere radius (0.0 by default), see impact.d3.collision.Algorithm.activating.convex_convex::
--
m_ccdSweptSphereRadius : math.Real;
-- Don't do continuous collision detection if the motion (in one step) is less then m_ccdMotionThreshold
--
m_ccdMotionThreshold : math.Real;
-- If some object should have elaborate collision filtering by sub-classes
--
m_checkCollideWith : Boolean;
end record;
function checkCollideWithOverride (Self : in Item; co : access Item'Class) return Boolean;
end impact.d3.Object;
|
generated/natools-static_maps-web-sites-t.ads | faelys/natools-web | 1 | 752 | <gh_stars>1-10
-- Generated at 2017-03-29 14:57:31 +0000 by Natools.Static_Hash_Maps
-- from src/natools-web-sites-maps.sx
function Natools.Static_Maps.Web.Sites.T
return Boolean;
pragma Pure (Natools.Static_Maps.Web.Sites.T);
|
Transynther/x86/_processed/NONE/_zr_xt_/i9-9900K_12_0xa0_notsx.log_21829_1813.asm | ljhsiun2/medusa | 9 | 27927 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/NONE/_zr_xt_/i9-9900K_12_0xa0_notsx.log_21829_1813.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r15
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x21f6, %rsi
lea addresses_UC_ht+0xf376, %rdi
nop
nop
nop
nop
cmp %r12, %r12
mov $112, %rcx
rep movsl
nop
xor %rbp, %rbp
lea addresses_A_ht+0x292a, %rsi
lea addresses_D_ht+0x95f6, %rdi
clflush (%rsi)
nop
nop
sub %rax, %rax
mov $60, %rcx
rep movsl
nop
nop
add %rdi, %rdi
lea addresses_normal_ht+0x1956, %rsi
lea addresses_WC_ht+0xc3f6, %rdi
nop
dec %r12
mov $4, %rcx
rep movsw
nop
xor %rbp, %rbp
lea addresses_WC_ht+0x125f6, %rcx
xor %rsi, %rsi
movups (%rcx), %xmm2
vpextrq $1, %xmm2, %rbp
nop
nop
mfence
lea addresses_WT_ht+0x155f6, %r12
nop
nop
sub $28787, %r13
mov $0x6162636465666768, %rsi
movq %rsi, %xmm4
movups %xmm4, (%r12)
nop
nop
xor %rax, %rax
lea addresses_UC_ht+0x182d6, %rsi
nop
nop
nop
and %rax, %rax
mov $0x6162636465666768, %rbp
movq %rbp, (%rsi)
nop
xor $24077, %rbp
lea addresses_D_ht+0xd7f6, %rsi
lea addresses_UC_ht+0x1261a, %rdi
nop
nop
nop
nop
and %rax, %rax
mov $74, %rcx
rep movsb
nop
nop
nop
inc %rsi
lea addresses_D_ht+0x1a5f6, %rcx
dec %rbp
mov (%rcx), %rdi
nop
nop
nop
nop
add $23026, %rdi
lea addresses_normal_ht+0xa5f6, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
sub $11942, %r12
movb $0x61, (%rdi)
nop
nop
nop
nop
and %rbp, %rbp
lea addresses_normal_ht+0x17a46, %r13
nop
and %rax, %rax
mov $0x6162636465666768, %r12
movq %r12, (%r13)
nop
nop
nop
and $62692, %rsi
lea addresses_D_ht+0x14736, %rsi
lea addresses_normal_ht+0xc366, %rdi
nop
nop
nop
nop
and $30907, %r15
mov $94, %rcx
rep movsl
nop
xor %rax, %rax
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r15
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r15
push %r8
push %rbp
push %rbx
push %rcx
push %rdi
// Store
lea addresses_A+0xe8b6, %rbx
nop
nop
sub %rcx, %rcx
mov $0x5152535455565758, %rdi
movq %rdi, %xmm4
vmovups %ymm4, (%rbx)
nop
sub %rbx, %rbx
// Faulty Load
lea addresses_A+0x35f6, %rbp
nop
nop
nop
nop
nop
dec %r13
mov (%rbp), %di
lea oracles, %r8
and $0xff, %rdi
shlq $12, %rdi
mov (%r8,%rdi,1), %rdi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r8
pop %r15
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_A', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 6}}
[Faulty Load]
{'src': {'type': 'addresses_A', 'AVXalign': False, 'size': 2, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}}
{'src': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}}
{'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 1}}
{'src': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 11}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 4}}
{'src': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}}
{'35': 21828, '00': 1}
00 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35
*/
|
experiments/test-suite/other.als | saiema/ARepair | 5 | 4449 | <filename>experiments/test-suite/other.als
-- Manually generated tests.
pred test1005 {
some disj Person0, Person1, Person2: Person {some disj alas0: alas {some disj peds0: peds {some disj alas0, peds0, Group0, Group1: Group {some disj seclab0: seclab {some disj seclab0, Room0, Room1: Room {
Person = Person0 + Person1 + Person2
member_of = Person0->Group1 + Person1->peds0 + Person1->Group0 + Person2->alas0 + Person2->Group1
alas = alas0
peds = peds0
Group = alas0 + peds0 + Group0 + Group1
seclab = seclab0
Room = seclab0 + Room0 + Room1
located_in = seclab0->alas0 + Room0->peds0 + Room0->Group0 + Room1->alas0
}}}}}}
}
run test1005 for 4 expect 0
-- Automatically generated tests.
pred test15 {
some disj Person0: Person {some disj alas0: alas {some disj peds0: peds {some disj alas0, peds0: Group {some disj seclab0, seclab1: seclab {some disj seclab0, seclab1, Room0: Room {
Person = Person0
member_of = Person0->alas0 + Person0->peds0
alas = alas0
peds = peds0
Group = alas0 + peds0
seclab = seclab0 + seclab1
Room = seclab0 + seclab1 + Room0
located_in = seclab0->peds0 + seclab1->alas0 + Room0->peds0
}}}}}}
}
run test15 for 3 expect 0
pred test9 {
some disj Person0, Person1: Person {some disj peds0: peds {some disj peds0, Group0: Group {some disj seclab0: seclab {some disj seclab0, Room0, Room1: Room {
Person = Person0 + Person1
member_of = Person0->peds0 + Person1->peds0 + Person1->Group0
no alas
peds = peds0
Group = peds0 + Group0
seclab = seclab0
Room = seclab0 + Room0 + Room1
located_in = seclab0->peds0 + Room1->peds0
}}}}}
}
run test9 for 3 expect 0
pred test20 {
some disj Person0: Person {some disj alas0: alas {some disj peds0: peds {some disj alas0, peds0: Group {some disj seclab0: seclab {some disj seclab0, Room0: Room {
Person = Person0
member_of = Person0->alas0 + Person0->peds0
alas = alas0
peds = peds0
Group = alas0 + peds0
seclab = seclab0
Room = seclab0 + Room0
located_in = Room0->alas0 + Room0->peds0
}}}}}}
}
run test20 for 3 expect 0
pred test17 {
some disj Person0: Person {some disj alas0: alas {some disj peds0: peds {some disj alas0, peds0, Group0: Group {some disj seclab0: seclab {some disj seclab0, Room0: Room {
Person = Person0
member_of = Person0->alas0 + Person0->peds0 + Person0->Group0
alas = alas0
peds = peds0
Group = alas0 + peds0 + Group0
seclab = seclab0
Room = seclab0 + Room0
located_in = seclab0->alas0 + seclab0->peds0 + Room0->alas0 + Room0->peds0
CanEnter[Person0,Room0]
}}}}}}
}
run test17 for 3 expect 0
pred test14 {
some disj Person0: Person {some disj alas0: alas {some disj peds0: peds {some disj alas0, peds0: Group {some disj seclab0: seclab {some disj seclab0, Room0: Room {
Person = Person0
member_of = Person0->alas0 + Person0->peds0
alas = alas0
peds = peds0
Group = alas0 + peds0
seclab = seclab0
Room = seclab0 + Room0
located_in = seclab0->alas0 + seclab0->peds0
}}}}}}
}
run test14 for 3 expect 1
pred test5 {
some disj Person0: Person {some disj alas0: alas {some disj peds0: peds {some disj alas0, peds0, Group0: Group {some disj seclab0: seclab {some disj seclab0, Room0: Room {
Person = Person0
member_of = Person0->alas0 + Person0->peds0 + Person0->Group0
alas = alas0
peds = peds0
Group = alas0 + peds0 + Group0
seclab = seclab0
Room = seclab0 + Room0
located_in = seclab0->alas0 + seclab0->peds0 + Room0->alas0 + Room0->peds0
}}}}}}
}
run test5 for 3 expect 1
pred test1 {
some disj Person0, Person1: Person {some disj alas0: alas {some disj peds0: peds {some disj alas0, peds0: Group {some disj seclab0: seclab {some disj seclab0, Room0: Room {
Person = Person0 + Person1
member_of = Person0->peds0 + Person1->alas0
alas = alas0
peds = peds0
Group = alas0 + peds0
seclab = seclab0
Room = seclab0 + Room0
located_in = seclab0->alas0 + seclab0->peds0 + Room0->alas0 + Room0->peds0
}}}}}}
}
run test1 for 3 expect 1
pred test4 {
some disj Person0: Person {some disj alas0: alas {some disj peds0: peds {some disj alas0, peds0: Group {some disj seclab0: seclab {some disj seclab0: Room {
Person = Person0
no member_of
alas = alas0
peds = peds0
Group = alas0 + peds0
seclab = seclab0
Room = seclab0
located_in = seclab0->alas0 + seclab0->peds0
}}}}}}
}
run test4 for 3 expect 0
pred test2 {
some disj Person0, Person1: Person {some disj alas0: alas {some disj peds0: peds {some disj alas0, peds0: Group {some disj seclab0: seclab {some disj seclab0, Room0: Room {
Person = Person0 + Person1
member_of = Person0->peds0 + Person1->alas0
alas = alas0
peds = peds0
Group = alas0 + peds0
seclab = seclab0
Room = seclab0 + Room0
located_in = seclab0->alas0 + seclab0->peds0 + Room0->alas0
}}}}}}
}
run test2 for 3 expect 1
pred test18 {
some disj Person0: Person {some disj alas0: alas {some disj peds0: peds {some disj alas0, peds0, Group0: Group {some disj seclab0: seclab {some disj seclab0, Room0: Room {
Person = Person0
member_of = Person0->alas0 + Person0->peds0
alas = alas0
peds = peds0
Group = alas0 + peds0 + Group0
seclab = seclab0
Room = seclab0 + Room0
located_in = seclab0->alas0 + seclab0->peds0 + Room0->alas0 + Room0->peds0 + Room0->Group0
CanEnter[Person0,Room0]
}}}}}}
}
run test18 for 3 expect 1
pred test8 {
some disj Person0, Person1: Person {some disj alas0, alas1: alas {some disj peds0: peds {some disj peds0, alas0, alas1: Group {some disj seclab0: seclab {some disj seclab0, Room0: Room {
Person = Person0 + Person1
member_of = Person0->alas0 + Person1->peds0 + Person1->alas1
alas = alas0 + alas1
peds = peds0
Group = peds0 + alas0 + alas1
seclab = seclab0
Room = seclab0 + Room0
located_in = seclab0->peds0 + seclab0->alas0 + seclab0->alas1 + Room0->peds0 + Room0->alas0
}}}}}}
}
run test8 for 3 expect 0
pred test6 {
some disj Person0: Person {some disj alas0: alas {some disj peds0: peds {some disj alas0, peds0: Group {some disj seclab0: seclab {some disj seclab0, Room0: Room {
Person = Person0
member_of = Person0->alas0 + Person0->peds0
alas = alas0
peds = peds0
Group = alas0 + peds0
seclab = seclab0
Room = seclab0 + Room0
located_in = seclab0->alas0 + seclab0->peds0 + Room0->alas0 + Room0->peds0
}}}}}}
}
run test6 for 3 expect 1
pred test12 {
some disj Person0, Person1: Person {some disj alas0: alas {some disj alas0, Group0: Group {some disj seclab0: seclab {some disj seclab0, Room0, Room1: Room {
Person = Person0 + Person1
member_of = Person0->alas0 + Person1->alas0 + Person1->Group0
alas = alas0
no peds
Group = alas0 + Group0
seclab = seclab0
Room = seclab0 + Room0 + Room1
located_in = seclab0->alas0 + Room1->alas0
}}}}}
}
run test12 for 3 expect 0
pred test3 {
some disj alas0: alas {some disj peds0: peds {some disj alas0, peds0: Group {some disj seclab0: seclab {some disj seclab0, Room0: Room {
no Person
no member_of
alas = alas0
peds = peds0
Group = alas0 + peds0
seclab = seclab0
Room = seclab0 + Room0
located_in = seclab0->alas0 + seclab0->peds0 + Room0->alas0 + Room0->peds0
}}}}}
}
run test3 for 3 expect 1
pred test19 {
some disj Person0: Person {some disj alas0: alas {some disj peds0: peds {some disj alas0, peds0: Group {some disj seclab0: seclab {some disj seclab0, Room0: Room {
Person = Person0
member_of = Person0->alas0 + Person0->peds0
alas = alas0
peds = peds0
Group = alas0 + peds0
seclab = seclab0
Room = seclab0 + Room0
located_in = seclab0->alas0 + seclab0->peds0 + Room0->alas0 + Room0->peds0
CanEnter[Person0,Room0]
}}}}}}
}
run test19 for 3 expect 1
pred test7 {
some disj Person0, Person1: Person {some disj peds0: peds {some disj peds0, Group0: Group {some disj seclab0: seclab {some disj seclab0: Room {
Person = Person0 + Person1
member_of = Person0->peds0 + Person1->peds0 + Person1->Group0
no alas
peds = peds0
Group = peds0 + Group0
seclab = seclab0
Room = seclab0
located_in = seclab0->peds0
}}}}}
}
run test7 for 3 expect 0
pred test13 {
some disj Person0: Person {some disj alas0: alas {some disj peds0: peds {some disj alas0, peds0, Group0: Group {some disj seclab0: seclab {some disj seclab0, Room0: Room {
Person = Person0
member_of = Person0->alas0 + Person0->peds0
alas = alas0
peds = peds0
Group = alas0 + peds0 + Group0
seclab = seclab0
Room = seclab0 + Room0
located_in = seclab0->alas0 + seclab0->peds0 + Room0->alas0 + Room0->peds0 + Room0->Group0
}}}}}}
}
run test13 for 3 expect 1
pred test16 {
some disj Person0: Person {some disj alas0: alas {some disj peds0: peds {some disj alas0, peds0: Group {some disj seclab0, seclab1: seclab {some disj seclab0, seclab1, Room0: Room {
Person = Person0
member_of = Person0->alas0 + Person0->peds0
alas = alas0
peds = peds0
Group = alas0 + peds0
seclab = seclab0 + seclab1
Room = seclab0 + seclab1 + Room0
located_in = seclab1->alas0 + seclab1->peds0
}}}}}}
}
run test16 for 3 expect 0
pred test11 {
some disj Person0, Person1: Person {some disj alas0: alas {some disj peds0, peds1: peds {some disj alas0, peds0, peds1: Group {some disj seclab0: seclab {some disj seclab0, Room0: Room {
Person = Person0 + Person1
member_of = Person0->peds0 + Person1->alas0 + Person1->peds1
alas = alas0
peds = peds0 + peds1
Group = alas0 + peds0 + peds1
seclab = seclab0
Room = seclab0 + Room0
located_in = seclab0->alas0 + seclab0->peds0 + seclab0->peds1 + Room0->alas0 + Room0->peds0
}}}}}}
}
run test11 for 3 expect 0
pred test21 {
some disj Person0: Person {some disj alas0: alas {some disj peds0: peds {some disj alas0, peds0, Group0: Group {some disj seclab0: seclab {some disj seclab0, Room0: Room {
Person = Person0
member_of = Person0->alas0 + Person0->peds0
alas = alas0
peds = peds0
Group = alas0 + peds0 + Group0
seclab = seclab0
Room = seclab0 + Room0
located_in = seclab0->alas0 + seclab0->peds0 + seclab0->Group0 + Room0->alas0 + Room0->peds0
}}}}}}
}
run test21 for 3 expect 0
pred test10 {
some disj Person0, Person1: Person {some disj alas0: alas {some disj alas0, Group0: Group {some disj seclab0: seclab {some disj seclab0: Room {
Person = Person0 + Person1
member_of = Person0->alas0 + Person1->alas0 + Person1->Group0
alas = alas0
no peds
Group = alas0 + Group0
seclab = seclab0
Room = seclab0
located_in = seclab0->alas0
}}}}}
}
run test10 for 3 expect 0
|
PracticalClasses/TP10/Stack.als | pemesteves/MFES_2021 | 0 | 1957 | <filename>PracticalClasses/TP10/Stack.als
open util/ordering[StackState]
sig Element {}
sig StackState {
elements: seq Element
}{
//
}
abstract sig Event {
pre, post: StackState
}{
// constraints that should hold for each Event
}
fact firstState {
// constraints for the first StackState
first.elements.isEmpty
}
pred Init [s: StackState] {
s.elements.isEmpty
}
fact trace {
// initial state
Init [first]
// post-conditions
// other but the intial states
// relate all `StackState`s and `Event`s
all s: StackState - last | let s1 = s.next |
some e: Event {
e.pre = s
e.post = s1
}
}
sig Push extends Event {
value: Element
}{
// -- model pushing by relating `pre`, `post`, and `value`
value = post.elements.first
// same as below: post.elements = pre.elements.insert [0, value]
post.elements.rest = pre.elements
}
sig Pop extends Event {
value: one Element
}{
// -- model popping
not pre.elements.isEmpty
value = pre.elements.first
// same as below: post.elements.insert[0, value] = pre.elements
post.elements = pre.elements.rest
}
assert popThenPush {
all s: StackState - last | let s1 = s.next |
(some pre.s1 <: Push and some pre.s <: Pop) implies (pre.s <: Pop).value = (pre.s1 <: Push).value
}
check popThenPush
fact InitEqualsFinal {
#Pop = #Push
}
assert sameNumberPushesPops {
#Pop = #Push
}
check sameNumberPushesPops
assert noPopFromEmpty {
no popEvent: Pop | popEvent.pre.elements.isEmpty
}
check noPopFromEmpty
run {} |
programs/oeis/228/A228229.asm | neoneye/loda | 22 | 166551 | <filename>programs/oeis/228/A228229.asm
; A228229: Recurrence a(n) = n*(n + 1)*a(n-1) + 1 with a(0) = 1.
; 1,3,19,229,4581,137431,5772103,323237769,23273119369,2094580743211,230403881753211,30413312391423853,4744476733062121069,863494765417306034559,181333900737634267257391,43520136177032224141773841,11837477040152764966562484753
add $0,1
lpb $0
cmp $2,0
lpb $0
mul $2,$0
sub $0,1
mul $2,$0
add $1,$2
lpe
lpe
add $1,1
mov $0,$1
|
src/Haskell/Modules/RWS/Lens.agda | LaudateCorpus1/bft-consensus-agda | 0 | 16382 | {- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9.
Copyright (c) 2021, Oracle and/or its affiliates.
Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl
-}
module Haskell.Modules.RWS.Lens where
open import Haskell.Modules.RWS
open import Haskell.Prelude
open import Optics.All
private
variable
Ev Wr St : Set
A B C : Set
-- Lens functionality
--
-- If we make RWS work for different level State types, we will break use and
-- modify because Lens does not support different levels, we define use and
-- modify' here for RoundManager. We are ok as long as we can keep
-- RoundManager in Set. If we ever need to make RoundManager at some higher
-- Level, we will have to consider making Lens level-agnostic. Preliminary
-- exploration by @cwjnkins showed this to be somewhat painful in particular
-- around composition, so we are not pursuing it for now.
use : Lens St A → RWS Ev Wr St A
use f = gets (_^∙ f)
modifyL : Lens St A → (A → A) → RWS Ev Wr St Unit
modifyL l f = modify (over l f)
syntax modifyL l f = l %= f
setL : Lens St A → A → RWS Ev Wr St Unit
setL l x = l %= const x
syntax setL l x = l ∙= x
setL? : Lens St (Maybe A) → A → RWS Ev Wr St Unit
setL? l x = l ∙= just x
syntax setL? l x = l ?= x
|
programs/oeis/005/A005356.asm | neoneye/loda | 22 | 8919 | ; A005356: Number of low discrepancy sequences in base 2.
; 0,0,1,3,5,8,11,14,18,22,26,30,34,38,43,48,53,58,63,68,73,78,83,89,95,101,107,113,119,125,131,137,143,149,155,161,167,173,179,185,191,198,205,212,219,226,233,240,247,254,261,268,275,282,289,296
mov $2,$0
mov $6,$0
lpb $2
mov $0,$6
sub $2,1
sub $0,$2
mul $0,2
mov $3,$0
add $3,1
pow $3,2
mov $4,6
mov $5,6
lpb $3
add $3,$5
div $3,3
add $4,1
lpe
sub $4,8
add $1,$4
lpe
mov $0,$1
|
Transynther/x86/_processed/NONE/_st_/i7-7700_9_0xca_notsx.log_21829_1097.asm | ljhsiun2/medusa | 9 | 175977 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %r15
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x5e80, %r11
nop
nop
nop
sub $15930, %rbp
movups (%r11), %xmm0
vpextrq $0, %xmm0, %r15
nop
nop
nop
nop
nop
add $45574, %r13
lea addresses_WC_ht+0x6ab0, %r10
add $13164, %rbx
mov $0x6162636465666768, %rsi
movq %rsi, %xmm5
vmovups %ymm5, (%r10)
nop
nop
nop
nop
nop
xor %rbx, %rbx
lea addresses_normal_ht+0x19cb0, %rsi
lea addresses_UC_ht+0xe330, %rdi
nop
nop
nop
xor $25739, %rbp
mov $12, %rcx
rep movsq
nop
nop
nop
nop
inc %r15
lea addresses_A_ht+0xced0, %rsi
lea addresses_WT_ht+0x1015c, %rdi
nop
nop
nop
nop
nop
cmp %rbx, %rbx
mov $95, %rcx
rep movsl
nop
add $41080, %r10
lea addresses_normal_ht+0x2108, %rcx
sub $50765, %r13
mov (%rcx), %r10d
nop
nop
add $38383, %rbx
lea addresses_UC_ht+0x54a4, %r15
nop
nop
nop
nop
and %r10, %r10
and $0xffffffffffffffc0, %r15
vmovaps (%r15), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $1, %xmm2, %rbp
nop
nop
mfence
lea addresses_D_ht+0x3855, %r13
clflush (%r13)
lfence
movb (%r13), %r15b
nop
lfence
lea addresses_UC_ht+0x1cbf0, %rdi
nop
nop
nop
nop
nop
inc %r15
movw $0x6162, (%rdi)
nop
nop
cmp $2198, %rcx
lea addresses_D_ht+0x2ab0, %rbx
nop
nop
nop
nop
nop
xor %r10, %r10
mov $0x6162636465666768, %rsi
movq %rsi, %xmm2
and $0xffffffffffffffc0, %rbx
movntdq %xmm2, (%rbx)
nop
and %rsi, %rsi
lea addresses_WT_ht+0x8eb0, %rsi
lea addresses_A_ht+0x1132, %rdi
clflush (%rdi)
nop
sub %r10, %r10
mov $23, %rcx
rep movsb
nop
nop
nop
xor $44711, %r13
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r15
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r15
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
// Store
lea addresses_normal+0x12b0, %rbp
nop
nop
nop
nop
and $27370, %rcx
movl $0x51525354, (%rbp)
nop
nop
nop
nop
add $33262, %r15
// REPMOV
lea addresses_WC+0x18a70, %rsi
lea addresses_normal+0x152b0, %rdi
nop
nop
nop
nop
nop
dec %r13
mov $30, %rcx
rep movsb
nop
nop
nop
nop
nop
dec %r9
// Store
lea addresses_A+0x1b710, %rcx
nop
nop
nop
nop
nop
add %rdi, %rdi
mov $0x5152535455565758, %r15
movq %r15, %xmm3
vmovups %ymm3, (%rcx)
nop
and %rbp, %rbp
// Store
lea addresses_WC+0x1e8b0, %rdi
nop
nop
nop
nop
xor %rcx, %rcx
movl $0x51525354, (%rdi)
nop
nop
nop
nop
and $793, %rdi
// Store
lea addresses_WC+0x1e8da, %r15
sub $32142, %r13
movb $0x51, (%r15)
nop
nop
and %r13, %r13
// Store
lea addresses_normal+0x179e0, %rsi
clflush (%rsi)
nop
nop
nop
xor %rdi, %rdi
mov $0x5152535455565758, %rcx
movq %rcx, %xmm5
movaps %xmm5, (%rsi)
nop
nop
and %r9, %r9
// Store
lea addresses_D+0x46da, %r13
nop
nop
nop
nop
nop
cmp %rbp, %rbp
mov $0x5152535455565758, %r15
movq %r15, (%r13)
dec %r13
// REPMOV
lea addresses_PSE+0x19f30, %rsi
lea addresses_D+0x1c670, %rdi
clflush (%rsi)
and $63411, %r11
mov $12, %rcx
rep movsw
nop
sub %rbp, %rbp
// Faulty Load
lea addresses_normal+0x152b0, %rsi
nop
nop
nop
nop
cmp $46220, %r13
vmovups (%rsi), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $1, %xmm1, %rbp
lea oracles, %rsi
and $0xff, %rbp
shlq $12, %rbp
mov (%rsi,%rbp,1), %rbp
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r15
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 11, 'same': False, 'type': 'addresses_normal'}, 'OP': 'STOR'}
{'src': {'congruent': 6, 'same': False, 'type': 'addresses_WC'}, 'dst': {'congruent': 0, 'same': True, 'type': 'addresses_normal'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 5, 'same': False, 'type': 'addresses_A'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 8, 'same': False, 'type': 'addresses_WC'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 1, 'same': False, 'type': 'addresses_WC'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 3, 'same': False, 'type': 'addresses_normal'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 1, 'same': False, 'type': 'addresses_D'}, 'OP': 'STOR'}
{'src': {'congruent': 5, 'same': False, 'type': 'addresses_PSE'}, 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_D'}, 'OP': 'REPM'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': True, 'type': 'addresses_normal'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 4, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 9, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 8, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 5, 'same': False, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 1, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': True, 'size': 32, 'congruent': 1, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 6, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'}
{'dst': {'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 11, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 10, 'same': False, 'type': 'addresses_WT_ht'}, 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM'}
{'38': 21829}
38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38
*/
|
bb-runtimes/runtimes/zfp-stm32f3x4/gnat/s-stm32.ads | JCGobbi/Nucleo-STM32F334R8 | 0 | 21057 | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- Copyright (C) 2012-2016, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This file provides register definitions for the STM32Fx (ARM Cortex M4/7)
-- microcontrollers from ST Microelectronics.
with Interfaces.STM32;
package System.STM32 is
pragma No_Elaboration_Code_All;
pragma Preelaborate (System.STM32);
subtype Frequency is Interfaces.STM32.UInt32;
-- See RM pg. 107 for clock tree
type RCC_System_Clocks is record
SYSCLK : Frequency;
HCLK : Frequency;
PCLK1 : Frequency;
PCLK2 : Frequency;
TIMCLK1 : Frequency; -- For TIMs 2, 3, 6, 7
TIMCLK2 : Frequency; -- For TIMs 15, 16, 17
TIM1CLK : Frequency; -- For TIM1
HRTIM1CLK : Frequency; -- For HRTIM1
I2CCLK : Frequency;
end record;
function System_Clocks return RCC_System_Clocks;
-- MODER constants
subtype GPIO_MODER_Values is Interfaces.STM32.UInt2;
Mode_IN : constant GPIO_MODER_Values := 0;
Mode_OUT : constant GPIO_MODER_Values := 1;
Mode_AF : constant GPIO_MODER_Values := 2;
Mode_AN : constant GPIO_MODER_Values := 3;
-- OTYPER constants
subtype GPIO_OTYPER_Values is Interfaces.STM32.Bit;
Push_Pull : constant GPIO_OTYPER_Values := 0;
Open_Drain : constant GPIO_OTYPER_Values := 1;
-- OSPEEDR constants
subtype GPIO_OSPEEDR_Values is Interfaces.STM32.UInt2;
Speed_2MHz : constant GPIO_OSPEEDR_Values := 0; -- Low speed
Speed_25MHz : constant GPIO_OSPEEDR_Values := 1; -- Medium speed
Speed_50MHz : constant GPIO_OSPEEDR_Values := 2; -- Fast speed
Speed_100MHz : constant GPIO_OSPEEDR_Values := 3; -- High speed
-- PUPDR constants
subtype GPIO_PUPDR_Values is Interfaces.STM32.UInt2;
No_Pull : constant GPIO_PUPDR_Values := 0;
Pull_Up : constant GPIO_PUPDR_Values := 1;
Pull_Down : constant GPIO_PUPDR_Values := 2;
-- AFL constants
AF_USART1 : constant Interfaces.STM32.UInt4 := 7;
AF_USART3 : constant Interfaces.STM32.UInt4 := 7;
type MCU_ID_Register is record
DEV_ID : Interfaces.STM32.UInt12;
Reserved : Interfaces.STM32.UInt4;
REV_ID : Interfaces.STM32.UInt16;
end record with Pack, Size => 32;
-- RCC constants
type PLL_Source is
(PLL_SRC_HSI,
PLL_SRC_HSE)
with Size => 1;
type SYSCLK_Source is
(SYSCLK_SRC_HSI,
SYSCLK_SRC_HSE,
SYSCLK_SRC_PLL)
with Size => 2;
type AHB_Prescaler_Enum is
(DIV2, DIV4, DIV8, DIV16,
DIV64, DIV128, DIV256, DIV512)
with Size => 3;
type AHB_Prescaler is record
Enabled : Boolean := False;
Value : AHB_Prescaler_Enum := AHB_Prescaler_Enum'First;
end record with Size => 4;
for AHB_Prescaler use record
Enabled at 0 range 3 .. 3;
Value at 0 range 0 .. 2;
end record;
AHBPRE_DIV1 : constant AHB_Prescaler := (Enabled => False, Value => DIV2);
type APB_Prescaler_Enum is
(DIV2, DIV4, DIV8, DIV16)
with Size => 2;
type APB_Prescaler is record
Enabled : Boolean;
Value : APB_Prescaler_Enum;
end record with Size => 3;
for APB_Prescaler use record
Enabled at 0 range 2 .. 2;
Value at 0 range 0 .. 1;
end record;
type I2C_Clock_Selection is
(I2CSEL_PLL,
I2CSEL_CKIN)
with Size => 1;
type MCO_Clock_Selection is
(MCOSEL_Disabled,
MCOSEL_LSI,
MCOSEL_LSE,
MCOSEL_SYSCLK,
MCOSEL_HSI,
MCOSEL_HSE,
MCOSEL_PLL)
with Size => 3;
for MCO_Clock_Selection use
(MCOSEL_Disabled => 2#000#,
MCOSEL_LSI => 2#010#,
MCOSEL_LSE => 2#011#,
MCOSEL_SYSCLK => 2#100#,
MCOSEL_HSI => 2#101#,
MCOSEL_HSE => 2#110#,
MCOSEL_PLL => 2#111#);
type MCO_Prescaler is
(MCOPRE_DIV1,
MCOPRE_DIV2,
MCOPRE_DIV3,
MCOPRE_DIV4,
MCOPRE_DIV5,
MCOPRE_DIV6,
MCOPRE_DIV7,
MCOPRE_DIV8)
with Size => 3;
-- Constants for RCC CR register
subtype PREDIV_Range is Integer range 1 .. 16;
subtype PLLMUL_Range is Integer range 2 .. 16;
subtype HSECLK_Range is Integer range 1_000_000 .. 32_000_000;
subtype PLLIN_Range is Integer range 1_000_000 .. 24_000_000;
subtype PLLOUT_Range is Integer range 2_000_000 .. 72_000_000;
subtype SYSCLK_Range is Integer range 1 .. 72_000_000;
subtype HCLK_Range is Integer range 1 .. 72_000_000;
subtype PCLK1_Range is Integer range 1 .. 36_000_000;
subtype PCLK2_Range is Integer range 1 .. 72_000_000;
subtype SPII2C_Range is Integer range 1 .. 72_000_000;
pragma Unreferenced (SPII2C_Range);
-- Constants for Flash Latency
-- 000: Zero wait state, if 0 < HCLK ≤ 24 MHz
-- 001: One wait state, if 24 MHz < HCLK ≤ 48 MHz
-- 010: Two wait sates, if 48 < HCLK ≤ 72 MHz
-- RM STM32F334 pg. 66 chapter 3.5.1
subtype FLASH_Latency_0 is Integer range 1 .. 24_000_000;
subtype FLASH_Latency_1 is Integer range 25_000_000 .. 48_000_000;
subtype FLASH_Latency_2 is Integer range 49_000_000 .. 72_000_000;
-- Flash wait states
type FLASH_WS is (FWS0, FWS1, FWS2)
with Size => 3;
FLASH_Latency : Interfaces.STM32.UInt3 := FLASH_WS'Enum_Rep (FWS2);
-- These internal low and high speed clocks are fixed (do not modify)
HSICLK : constant := 8_000_000;
LSICLK : constant := 40_000;
MCU_ID : MCU_ID_Register
with Volatile, Address => System'To_Address (16#E004_2000#);
-- Only 32-bits access supported (read-only) RM pg. 1100 chapter 31.6.1
DEV_ID_STM32F40xxx : constant := 16#413#; -- STM32F40xxx/41xxx
DEV_ID_STM32F42xxx : constant := 16#419#; -- STM32F42xxx/43xxx
DEV_ID_STM32F46xxx : constant := 16#434#; -- STM32F469xx/479xx
DEV_ID_STM32F74xxx : constant := 16#449#; -- STM32F74xxx/75xxx
DEV_ID_STM32F76xxx : constant := 16#451#; -- STM32F76xxx/77xxx
DEV_ID_STM32F334xx : constant := 16#438#; -- STM32F334xx
end System.STM32;
|
src/MultiSorted/InterpretationCategory.agda | cilinder/formaltt | 21 | 15591 | open import Agda.Primitive using (_⊔_ ; lsuc ; Level)
import Categories.Category as Category
import Categories.Category.Cartesian as Cartesian
open import Categories.Object.Terminal using (Terminal)
open import Categories.Object.Product using (Product)
open import MultiSorted.AlgebraicTheory
import MultiSorted.Product as Product
import MultiSorted.Interpretation
module MultiSorted.InterpretationCategory
{o ℓ e}
{𝓈 ℴ}
(Σ : Signature {𝓈} {ℴ})
{𝒞 : Category.Category o ℓ e}
(cartesian-𝒞 : Cartesian.Cartesian 𝒞) where
open Signature Σ
open Category.Category 𝒞
open Cartesian.Cartesian cartesian-𝒞
open MultiSorted.Interpretation Σ cartesian-𝒞
-- Equality of homomorphisms of interpretations
_≈I_ : ∀ {I J : Interpretation} → I ⇒I J → I ⇒I J → Set (e ⊔ 𝓈)
_≈I_ {I} {J} ϕ ψ =
let open _⇒I_ in ∀ (A : sort) → hom-morphism ϕ {A} ≈ hom-morphism ψ
-- The category of interpretations of Σ in 𝒞
ℐ𝓃𝓉 : Category.Category (o ⊔ ℓ ⊔ e ⊔ 𝓈 ⊔ ℴ) (o ⊔ ℓ ⊔ e ⊔ 𝓈 ⊔ ℴ) (e ⊔ 𝓈)
ℐ𝓃𝓉 = record
{ Obj = Interpretation
; _⇒_ = _⇒I_
; _≈_ = _≈I_
; id = id-I
; _∘_ = _∘I_
; assoc = λ _ → assoc
; sym-assoc = λ _ → sym-assoc
; identityˡ = λ _ → identityˡ
; identityʳ = λ _ → identityʳ
; identity² = λ _ → identity²
; equiv = record { refl = λ A → Equiv.refl
; sym = λ p A → Equiv.sym (p A)
; trans = λ p₁ p₂ A → Equiv.trans (p₁ A) (p₂ A)
}
; ∘-resp-≈ = λ p₁ p₂ A → ∘-resp-≈ (p₁ A) (p₂ A)
}
-- Cartesian structure on the category on interpretations of Σ in 𝒞
module _ (I J : Interpretation) where
open Interpretation
open Product.Producted
open HomReasoning
A×B-ℐ𝓃𝓉 : Interpretation
interp-sort A×B-ℐ𝓃𝓉 A = interp-sort I A × interp-sort J A
-- Contexts
-- -- Structure
prod (interp-ctx A×B-ℐ𝓃𝓉) Γ = prod (interp-ctx I) Γ × prod (interp-ctx J) Γ
π (interp-ctx A×B-ℐ𝓃𝓉) x = (π (interp-ctx I) x) ⁂ (π (interp-ctx J) x)
tuple (interp-ctx A×B-ℐ𝓃𝓉) Γ fs = ⟨ (tuple (interp-ctx I) Γ λ x → π₁ ∘ fs x) , ((tuple (interp-ctx J) Γ λ x → π₂ ∘ fs x)) ⟩
project (interp-ctx A×B-ℐ𝓃𝓉) {Γ} {B} {x} {fs} =
begin
π (interp-ctx A×B-ℐ𝓃𝓉) x ∘
(tuple (interp-ctx A×B-ℐ𝓃𝓉) Γ fs) ≈⟨ ⁂∘⟨⟩ ⟩
⟨ π (interp-ctx I) x ∘ tuple (interp-ctx I) Γ (λ x₁ → π₁ ∘ fs x₁) ,
π (interp-ctx J) x ∘ tuple (interp-ctx J) Γ (λ x₁ → π₂ ∘ fs x₁) ⟩ ≈⟨ ⟨⟩-congʳ (project (interp-ctx I)) ⟩
⟨ π₁ ∘ fs x ,
π (interp-ctx J) x ∘ tuple (interp-ctx J) Γ (λ x₁ → π₂ ∘ fs x₁) ⟩ ≈⟨ ⟨⟩-congˡ (project (interp-ctx J)) ⟩
⟨ π₁ ∘ fs x , π₂ ∘ fs x ⟩ ≈⟨ Product.unique product Equiv.refl Equiv.refl ⟩
fs x ∎
unique (interp-ctx A×B-ℐ𝓃𝓉) {Γ} {A} {g} {fs} ps = Product.unique product
(⟺ (unique (interp-ctx I) λ i → begin
π (interp-ctx I) i ∘ product.π₁ ∘ fs ≈⟨ sym-assoc ⟩
(π (interp-ctx I) i ∘ product.π₁) ∘ fs ≈⟨ (Π-nat₁ i ⟩∘⟨refl) ⟩
(product.π₁ ∘ (π (interp-ctx A×B-ℐ𝓃𝓉) i)) ∘ fs ≈⟨ assoc ⟩
product.π₁ ∘((π (interp-ctx A×B-ℐ𝓃𝓉) i) ∘ fs) ≈⟨ (refl⟩∘⟨ ps i) ⟩
product.π₁ ∘ g i ∎))
(⟺ (unique (interp-ctx J) λ i → begin
(π (interp-ctx J) i ∘ π₂ ∘ fs) ≈⟨ sym-assoc ⟩
((π (interp-ctx J) i ∘ π₂) ∘ fs) ≈⟨ (Π-nat₂ i ⟩∘⟨refl) ⟩
((product.π₂ ∘ π (interp-ctx A×B-ℐ𝓃𝓉) i) ∘ fs) ≈⟨ assoc ⟩
(π₂ ∘ π (interp-ctx A×B-ℐ𝓃𝓉) i ∘ fs) ≈⟨ (refl⟩∘⟨ ps i) ⟩
(π₂ ∘ g i) ∎))
where
Π-nat₁ : {Γ : Context} → (i : var Γ) → π (interp-ctx I) i ∘ product.π₁ ≈ product.π₁ ∘ π (interp-ctx A×B-ℐ𝓃𝓉) i
Π-nat₁ = λ i → ⟺ project₁
Π-nat₂ : {Γ : Context} → (i : var Γ) → π (interp-ctx J) i ∘ product.π₂ ≈ product.π₂ ∘ π (interp-ctx A×B-ℐ𝓃𝓉) i
Π-nat₂ = λ i → ⟺ project₂
-- Operations
interp-oper A×B-ℐ𝓃𝓉 = λ f → (interp-oper I f) ⁂ (interp-oper J f)
-- Useful propoerties for the definition of projections
module _ (I J : Interpretation) f where
open Product.Producted
open Interpretation
open HomReasoning
Π-nat₁ : {Γ : Context} → (i : var Γ) → π (interp-ctx I) i ∘ product.π₁ ≈ product.π₁ ∘ π (interp-ctx (A×B-ℐ𝓃𝓉 I J)) i
Π-nat₁ = λ i → ⟺ project₁
Π-nat₂ : {Γ : Context} → (i : var Γ) → π (interp-ctx J) i ∘ product.π₂ ≈ product.π₂ ∘ π (interp-ctx (A×B-ℐ𝓃𝓉 I J)) i
Π-nat₂ = λ i → ⟺ project₂
π₁-tuple : π₁ ≈ tuple (interp-ctx I) (oper-arity f) (λ i → π₁ ∘ (π (interp-ctx I) i ⁂ π (interp-ctx J) i))
π₁-tuple = ⟺ (begin
tuple (interp-ctx I) (oper-arity f)
(λ i → π₁ ∘ (π (interp-ctx I) i ⁂ π (interp-ctx J) i)) ≈⟨ tuple-cong (interp-ctx I) (λ i → π₁∘⁂) ⟩
tuple (interp-ctx I) (oper-arity f) (λ x → π (interp-ctx I) x ∘ π₁) ≈⟨ ∘-distribʳ-tuple (interp-ctx I) ⟩
(tuple (interp-ctx I) (oper-arity f) (λ x → π (interp-ctx I) x) ∘ π₁) ≈⟨ ∘-resp-≈ˡ (Product.Producted.η (interp-ctx I)) ⟩
(id ∘ π₁) ≈⟨ identityˡ ⟩
π₁ ∎)
π₂-tuple : π₂ ≈ tuple (interp-ctx J) (oper-arity f) (λ i → π₂ ∘ (π (interp-ctx I) i ⁂ π (interp-ctx J) i))
π₂-tuple = ⟺ (begin
tuple (interp-ctx J) (oper-arity f)
(λ i → π₂ ∘ (π (interp-ctx I) i ⁂ π (interp-ctx J) i)) ≈⟨ tuple-cong (interp-ctx J) (λ i → π₂∘⁂) ⟩
tuple (interp-ctx J) (oper-arity f) (λ x → π (interp-ctx J) x ∘ π₂) ≈⟨ ∘-distribʳ-tuple (interp-ctx J) ⟩
(tuple (interp-ctx J) (oper-arity f) (λ x → π (interp-ctx J) x) ∘ π₂) ≈⟨ ∘-resp-≈ˡ (Product.Producted.η (interp-ctx J)) ⟩
(id ∘ π₂) ≈⟨ identityˡ ⟩
π₂ ∎)
-- Definition of projections
π₁-ℐ𝓃𝓉 : ∀ {I J : Interpretation} → A×B-ℐ𝓃𝓉 I J ⇒I I
π₁-ℐ𝓃𝓉 {I} {J} =
let open HomReasoning in
let open Product.Producted in
let open Interpretation in
record
{ hom-morphism = Cartesian.Cartesian.π₁ cartesian-𝒞
; hom-commute = λ f → begin
(π₁ ∘ interp-oper (A×B-ℐ𝓃𝓉 I J) f) ≈⟨ π₁∘⁂ ⟩
(interp-oper I f ∘ π₁) ≈⟨ ∘-resp-≈ʳ (π₁-tuple I J f) ⟩
(interp-oper I f ∘
tuple (interp-ctx I) (oper-arity f)
(λ i → π₁ ∘ (π (interp-ctx I) i ⁂ π (interp-ctx J) i))) ∎
}
π₂-ℐ𝓃𝓉 : ∀ {I J : Interpretation} → A×B-ℐ𝓃𝓉 I J ⇒I J
π₂-ℐ𝓃𝓉 {I} {J} =
let open HomReasoning in
let open Product.Producted in
let open Interpretation in
record
{ hom-morphism = Cartesian.Cartesian.π₂ cartesian-𝒞
; hom-commute = λ f → begin
(π₂ ∘ interp-oper (A×B-ℐ𝓃𝓉 I J) f) ≈⟨ π₂∘⁂ ⟩
(interp-oper J f ∘ π₂) ≈⟨ ∘-resp-≈ʳ (π₂-tuple I J f) ⟩
(interp-oper J f ∘
tuple (interp-ctx J) (oper-arity f)
(λ i → π₂ ∘ (π (interp-ctx I) i ⁂ π (interp-ctx J) i))) ∎
}
-- Useful properties for the definition of ⟨_,_⟩-ℐ𝓃𝓉
module _ (I J K : Interpretation) f (ϕ : I ⇒I J) (ψ : I ⇒I K) where
open Interpretation
open HomReasoning
open Product.Producted
⟨⟩-left : interp-oper J f ∘ tuple
(interp-ctx J)
(oper-arity f)
(λ x → π₁ ∘ ⟨ _⇒I_.hom-morphism ϕ , _⇒I_.hom-morphism ψ ⟩ ∘ π (interp-ctx I) x) ≈ _⇒I_.hom-morphism ϕ ∘ interp-oper I f
⟨⟩-left = begin
(interp-oper J f ∘
tuple (interp-ctx J) (oper-arity f)
(λ x →
π₁ ∘
⟨ _⇒I_.hom-morphism ϕ , _⇒I_.hom-morphism ψ ⟩ ∘ π (interp-ctx I) x)) ≈⟨ ∘-resp-≈ʳ (tuple-cong (interp-ctx J) λ i → sym-assoc) ⟩
(interp-oper J f ∘
tuple (interp-ctx J) (oper-arity f)
(λ x →
(π₁ ∘ ⟨ _⇒I_.hom-morphism ϕ , _⇒I_.hom-morphism ψ ⟩) ∘
π (interp-ctx I) x)) ≈⟨ ∘-resp-≈ʳ (tuple-cong (interp-ctx J) λ i → ∘-resp-≈ˡ project₁) ⟩
(interp-oper J f ∘
tuple (interp-ctx J) (oper-arity f)
(λ x → _⇒I_.hom-morphism ϕ ∘ π (interp-ctx I) x)) ≈⟨ ⟺ (_⇒I_.hom-commute ϕ f) ⟩
(_⇒I_.hom-morphism ϕ ∘ interp-oper I f) ∎
⟨⟩-right : interp-oper K f ∘ tuple
(interp-ctx K)
(oper-arity f)
(λ x → π₂ ∘ ⟨ _⇒I_.hom-morphism ϕ , _⇒I_.hom-morphism ψ ⟩ ∘ π (interp-ctx I) x) ≈ _⇒I_.hom-morphism ψ ∘ interp-oper I f
⟨⟩-right = begin
(interp-oper K f ∘
tuple (interp-ctx K) (oper-arity f)
(λ x →
π₂ ∘
⟨ _⇒I_.hom-morphism ϕ , _⇒I_.hom-morphism ψ ⟩ ∘ π (interp-ctx I) x)) ≈⟨ ∘-resp-≈ʳ (tuple-cong (interp-ctx K) λ i → sym-assoc) ⟩
(interp-oper K f ∘
tuple (interp-ctx K) (oper-arity f)
(λ x →
(π₂ ∘ ⟨ _⇒I_.hom-morphism ϕ , _⇒I_.hom-morphism ψ ⟩) ∘
π (interp-ctx I) x)) ≈⟨ ∘-resp-≈ʳ (tuple-cong (interp-ctx K) λ i → ∘-resp-≈ˡ project₂) ⟩
(interp-oper K f ∘
tuple (interp-ctx K) (oper-arity f)
(λ x → _⇒I_.hom-morphism ψ ∘ π (interp-ctx I) x)) ≈⟨ ⟺ (_⇒I_.hom-commute ψ f) ⟩
(_⇒I_.hom-morphism ψ ∘ interp-oper I f) ∎
-- Definition of pairing
⟨_,_⟩-ℐ𝓃𝓉 : ∀ {I J K : Interpretation} → I ⇒I J → I ⇒I K → I ⇒I A×B-ℐ𝓃𝓉 J K
⟨_,_⟩-ℐ𝓃𝓉 {I} {J} {K} ϕ ψ =
let open HomReasoning in
let open Product.Producted in
let open Interpretation in
record
{ hom-morphism = λ {A} → ⟨ _⇒I_.hom-morphism ϕ , _⇒I_.hom-morphism ψ ⟩
; hom-commute = λ f →
⟺ (begin
(interp-oper (A×B-ℐ𝓃𝓉 J K) f ∘
tuple (interp-ctx (A×B-ℐ𝓃𝓉 J K)) (oper-arity f)
(λ i →
⟨ _⇒I_.hom-morphism ϕ , _⇒I_.hom-morphism ψ ⟩ ∘ π (interp-ctx I) i)) ≈⟨ ⁂∘⟨⟩ ⟩
⟨
interp-oper J f ∘
tuple (interp-ctx J) (oper-arity f)
(λ x →
π₁ ∘
⟨ _⇒I_.hom-morphism ϕ , _⇒I_.hom-morphism ψ ⟩ ∘ π (interp-ctx I) x)
,
interp-oper K f ∘
tuple (interp-ctx K) (oper-arity f)
(λ x →
π₂ ∘
⟨ _⇒I_.hom-morphism ϕ , _⇒I_.hom-morphism ψ ⟩ ∘ π (interp-ctx I) x)
⟩ ≈⟨ ⟨⟩-cong₂ (⟨⟩-left I J K f ϕ ψ) (⟨⟩-right I J K f ϕ ψ) ⟩
product.⟨ _⇒I_.hom-morphism ϕ ∘ interp-oper I f ,
_⇒I_.hom-morphism ψ ∘ interp-oper I f ⟩ ≈˘⟨ ⟨⟩∘ ⟩
(⟨ _⇒I_.hom-morphism ϕ , _⇒I_.hom-morphism ψ ⟩ ∘ interp-oper I f) ∎)
}
-- Properties about projections and unicity
project₁-ℐ𝓃𝓉 : {I J K : Interpretation} {h : I ⇒I J} {i : I ⇒I K} (A : sort) → π₁ ∘ ⟨ _⇒I_.hom-morphism {I} {J} h {A} , _⇒I_.hom-morphism {I} {K} i ⟩ ≈ _⇒I_.hom-morphism h
project₁-ℐ𝓃𝓉 A = project₁
project₂-ℐ𝓃𝓉 : {I J K : Interpretation} {h : I ⇒I J} {i : I ⇒I K} (A : sort) → π₂ ∘ ⟨ _⇒I_.hom-morphism {I} {J} h {A} , _⇒I_.hom-morphism {I} {K} i ⟩ ≈ _⇒I_.hom-morphism i
project₂-ℐ𝓃𝓉 A = project₂
unique-ℐ𝓃𝓉 : {I J K : Interpretation}
{h : I ⇒I A×B-ℐ𝓃𝓉 J K}
{i : I ⇒I J} {j : I ⇒I K} →
((A : sort) → π₁ ∘ _⇒I_.hom-morphism h {A} ≈ _⇒I_.hom-morphism i) →
((A : sort) → π₂ ∘ _⇒I_.hom-morphism h {A} ≈ _⇒I_.hom-morphism j) →
(A : sort) →
⟨ _⇒I_.hom-morphism i {A} , _⇒I_.hom-morphism j ⟩ ≈ _⇒I_.hom-morphism h
unique-ℐ𝓃𝓉 = λ p₁ p₂ A → unique (p₁ A) (p₂ A)
-- Definition of the structure of the product
product-ℐ𝓃𝓉 : ∀ {I J} → Product ℐ𝓃𝓉 I J
product-ℐ𝓃𝓉 {I} {J} =
record
{ A×B = A×B-ℐ𝓃𝓉 I J
; π₁ = π₁-ℐ𝓃𝓉 {I} {J}
; π₂ = π₂-ℐ𝓃𝓉 {I} {J}
; ⟨_,_⟩ = ⟨_,_⟩-ℐ𝓃𝓉
; project₁ = λ {K} {h} {i} A → project₁-ℐ𝓃𝓉 {K} {I} {J} {h} {i} A
; project₂ = λ {K} {h} {i} A → project₂-ℐ𝓃𝓉 {K} {I} {J} {h} {i} A
; unique = λ {K} {h} {i} {j} p₁ p₂ A → unique-ℐ𝓃𝓉 {K} {I} {J} {h} {i} {j} p₁ p₂ A
}
-- The terminal object
terminal-ℐ𝓃𝓉 : Terminal ℐ𝓃𝓉
terminal-ℐ𝓃𝓉 =
record
{ ⊤ = Trivial
; ⊤-is-terminal =
record
{ ! =
record
{ hom-morphism = !
; hom-commute = λ f → !-unique₂
}
; !-unique = λ f A → !-unique₂
}
}
-- The category of interpretations is cartesian
cartesian-ℐ𝓃𝓉 : Cartesian.Cartesian ℐ𝓃𝓉
cartesian-ℐ𝓃𝓉 =
record
{ terminal = terminal-ℐ𝓃𝓉
; products = record { product = product-ℐ𝓃𝓉 }
}
-- Each projection is a natural transformation with respect to the interpretation
open Interpretation
open HomReasoning
open Product.Producted
natural-π₁ : {I J : Interpretation} {A : sort} {Γ : Context} (t : Term Γ A) → π₁ ∘ (interp-term (A×B-ℐ𝓃𝓉 I J) t) ≈ (interp-term I t) ∘ π₁
natural-π₁ {I} {J} (Signature.tm-var x) = project₁
natural-π₁ {I} {J} (Signature.tm-oper f xs) = begin
(π₁ ∘ interp-term (A×B-ℐ𝓃𝓉 I J) (tm-oper f xs)) ≈⟨ ∘-resp-≈ʳ ⁂∘⟨⟩ ⟩
(π₁ ∘
⟨
interp-oper I f ∘
Product.Producted.tuple (interp-ctx I) (oper-arity f)
(λ i → π₁ ∘ interp-term (A×B-ℐ𝓃𝓉 I J) (xs i))
,
interp-oper J f ∘
Product.Producted.tuple (interp-ctx J) (oper-arity f)
(λ i → π₂ ∘ interp-term (A×B-ℐ𝓃𝓉 I J) (xs i))
⟩) ≈⟨ project₁ ⟩
(interp-oper I f ∘
Product.Producted.tuple (interp-ctx I) (oper-arity f)
(λ i → π₁ ∘ interp-term (A×B-ℐ𝓃𝓉 I J) (xs i))) ≈⟨ ∘-resp-≈ʳ (tuple-cong (interp-ctx I) λ i → natural-π₁ {I} {J} {arg-sort f i} (xs i)) ⟩
(interp-oper I f ∘
tuple (interp-ctx I) (oper-arity f)
(λ i → interp-term I (xs i) ∘ π₁)) ≈⟨ ∘-resp-≈ʳ (∘-distribʳ-tuple (interp-ctx I)) ⟩
(interp-oper I f ∘
tuple (interp-ctx I) (oper-arity f) (λ x → interp-term I (xs x)) ∘
π₁) ≈⟨ sym-assoc ⟩
((interp-oper I f ∘
tuple (interp-ctx I) (oper-arity f) (λ x → interp-term I (xs x)))
∘ π₁) ∎
natural-π₂ : {I J : Interpretation} {A : sort} {Γ : Context} (t : Term Γ A) → π₂ ∘ (interp-term (A×B-ℐ𝓃𝓉 I J) t) ≈ (interp-term J t) ∘ π₂
natural-π₂ {I} {J} (Signature.tm-var x) = project₂
natural-π₂ {I} {J} (Signature.tm-oper f xs) = begin
(π₂ ∘ interp-term (A×B-ℐ𝓃𝓉 I J) (tm-oper f xs)) ≈⟨ ∘-resp-≈ʳ ⁂∘⟨⟩ ⟩
(π₂ ∘
⟨
interp-oper I f ∘
Product.Producted.tuple (interp-ctx I) (oper-arity f)
(λ i → π₁ ∘ interp-term (A×B-ℐ𝓃𝓉 I J) (xs i))
,
interp-oper J f ∘
Product.Producted.tuple (interp-ctx J) (oper-arity f)
(λ i → π₂ ∘ interp-term (A×B-ℐ𝓃𝓉 I J) (xs i))
⟩) ≈⟨ project₂ ⟩
(interp-oper J f ∘
Product.Producted.tuple (interp-ctx J) (oper-arity f)
(λ i → π₂ ∘ interp-term (A×B-ℐ𝓃𝓉 I J) (xs i))) ≈⟨ ∘-resp-≈ʳ (tuple-cong (interp-ctx J) λ i → natural-π₂ {I} {J} {arg-sort f i} (xs i)) ⟩
(interp-oper J f ∘
tuple (interp-ctx J) (oper-arity f)
(λ i → interp-term J (xs i) ∘ π₂)) ≈⟨ ∘-resp-≈ʳ (∘-distribʳ-tuple (interp-ctx J)) ⟩
(interp-oper J f ∘
tuple (interp-ctx J) (oper-arity f) (λ x → interp-term J (xs x)) ∘
π₂) ≈⟨ sym-assoc ⟩
((interp-oper J f ∘
tuple (interp-ctx J) (oper-arity f) (λ x → interp-term J (xs x)))
∘ π₂) ∎
|
projects/batfish/src/main/antlr4/org/batfish/grammar/arista/Arista_multicast.g4 | ton31337/batfish | 763 | 4154 | parser grammar Arista_multicast;
import Arista_common;
options {
tokenVocab = AristaLexer;
}
s_router_multicast
:
MULTICAST NEWLINE
rm_inner*
;
rm_inner
:
rm_ipv4
;
rm_ipv4
:
IPV4 NEWLINE
rm_ipv4_inner*
;
rm_ipv4_inner
:
rm_v4_routing
;
rm_v4_routing: ROUTING NEWLINE; |
stone/testcases/sub.asm | yutopp/sekki | 6 | 170227 | bits 64
sub rsp, 8
sub rsp, 128
sub rdi, r10
sub al, 10
sub ax, 10
sub rdx, rcx
sub rax, 32
sub [rbp-40], rax ;
sub rdi, [rbp-72]
sub eax, dword [rdi+44]
sub dword [rdi+44], 1
sub r10, rcx
|
examples/AIM6/Path/Span.agda | shlevy/agda | 1,989 | 7184 | <filename>examples/AIM6/Path/Span.agda
module Span where
open import Prelude
open import Star
open import Modal
data SpanView {A : Set}{R : Rel A}(p : {a b : A} -> R a b -> Bool) :
EdgePred (Star R) where
oneFalse : {a b c d : A}(xs : Star R a b)(pxs : All (\x -> IsTrue (p x)) xs)
(x : R b c)(¬px : IsFalse (p x))(ys : Star R c d) ->
SpanView p (xs ++ x • ys)
allTrue : {a b : A}{xs : Star R a b}(ts : All (\x -> IsTrue (p x)) xs) ->
SpanView p xs
span : {A : Set}{R : Rel A}(p : {a b : A} -> R a b -> Bool){a b : A}
(xs : Star R a b) -> SpanView p xs
span p ε = allTrue ε
span p (x • xs) with inspect (p x)
span p (x • xs) | itsFalse ¬px = oneFalse ε ε x ¬px xs
span p (x • xs) | itsTrue px with span p xs
span p (x • .(xs ++ y • ys)) | itsTrue px
| oneFalse xs pxs y ¬py ys =
oneFalse (x • xs) (check px • pxs) y ¬py ys
span p (x • xs) | itsTrue px | allTrue pxs =
allTrue (check px • pxs)
_│_ : {A : Set}(R : Rel A)(P : EdgePred R) -> Rel A
(R │ P) a b = Σ (R a b) P
forget : {A : Set}{R : Rel A}{P : EdgePred R} -> Star (R │ P) =[ id ]=> Star R
forget = map id fst
data SpanView' {A : Set}{R : Rel A}(p : {a b : A} -> R a b -> Bool) :
EdgePred (Star R) where
oneFalse' : {a b c d : A}(xs : Star (R │ \{a b} x -> IsTrue (p x)) a b)
(x : R b c)(¬px : IsFalse (p x))(ys : Star R c d) ->
SpanView' p (forget xs ++ x • ys)
allTrue' : {a b : A}(xs : Star (R │ \{a b} x -> IsTrue (p x)) a b) ->
SpanView' p (forget xs)
span' : {A : Set}{R : Rel A}(p : {a b : A} -> R a b -> Bool){a b : A}
(xs : Star R a b) -> SpanView' p xs
span' p ε = allTrue' ε
span' p (x • xs) with inspect (p x)
span' p (x • xs) | itsFalse ¬px = oneFalse' ε x ¬px xs
span' p (x • xs) | itsTrue px with span' p xs
span' p (x • .(forget xs ++ y • ys)) | itsTrue px
| oneFalse' xs y ¬py ys = oneFalse' ((x ,, px) • xs) y ¬py ys
span' p (x • .(forget xs)) | itsTrue px
| allTrue' xs = allTrue' ((x ,, px) • xs)
-- Can't seem to define it as 'map Some.a (\x -> (_ ,, uncheck x))'
all│ : {A : Set}{R : Rel A}{P : EdgePred R}{a b : A}{xs : Star R a b} ->
All P xs -> Star (R │ P) a b
all│ (check p • pxs) = (_ ,, p) • all│ pxs
all│ ε = ε
|
programs/oeis/061/A061001.asm | neoneye/loda | 22 | 84547 | ; A061001: x.x, x = first n terms of A060999.
; 0,1,10,59,255,831,2275,5524,12085,24406,46310,83174,142710,235735,376360,583385,881501,1301405,1882049,2672370,3731211,5130700,6958604,9317900,12331596,16145805,20928774,26877495,34221595,43221595
mov $3,$0
mov $5,$0
lpb $3
mov $0,$5
sub $3,1
sub $0,$3
mov $4,$0
mul $0,216
lpb $0
mov $0,1
add $4,1
mov $2,$4
mod $2,$4
pow $4,3
add $4,5
add $2,$4
div $2,9
lpe
pow $2,2
add $1,$2
lpe
mov $0,$1
|
wayland_ada_scanner/src/wayland_xml.ads | onox/wayland-ada | 5 | 18243 | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2018 - 2019 <NAME> <<EMAIL>>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Ada.Containers.Vectors;
with Aida.Deepend;
package Wayland_XML is
subtype String_Ptr is Aida.Deepend.String_Ptr;
Empty_String : aliased String := Aida.Deepend.Empty_String;
type Version_Number is new Positive;
type Arg_Type_Attribute is
(Type_Integer,
Type_Unsigned_Integer,
Type_String,
Type_FD,
Type_New_Id,
Type_Object,
Type_Fixed,
Type_Array);
TYPE_ATTRIBUTE_EXCEPTION : exception;
type Arg_Tag is limited private;
procedure Set_Name
(This : in out Arg_Tag;
Value : String) with
Global => null,
Pre => not Exists_Name (This),
Post => Exists_Name (This) and Name (This) = Value;
function Name (This : Arg_Tag) return String with
Global => null,
Pre => Exists_Name (This);
function Exists_Name (This : Arg_Tag) return Boolean with
Global => null;
procedure Set_Type_Attribute (This : in out Arg_Tag; Value : String) with
Global => null,
Pre => not Exists_Type_Attribute (This),
Post => Exists_Type_Attribute (This);
-- Raises TYPE_ATTRIBUTE_EXCEPTION if Value cannot be interpreted
function Type_Attribute (This : Arg_Tag) return Arg_Type_Attribute with
Global => null,
Pre => Exists_Type_Attribute (This);
function Exists_Type_Attribute (This : Arg_Tag) return Boolean with
Global => null;
procedure Set_Interface_Attribute
(This : in out Arg_Tag;
Value : String) with
Global => null,
Pre => not Exists_Interface_Attribute (This),
Post => Exists_Interface_Attribute (This) and
Interface_Attribute (This) = Value;
function Interface_Attribute (This : Arg_Tag) return String with
Global => null,
Pre => Exists_Interface_Attribute (This);
function Exists_Interface_Attribute (This : Arg_Tag) return Boolean with
Global => null;
procedure Set_Summary
(This : in out Arg_Tag;
Value : String) with
Global => null,
Pre => not Exists_Summary (This),
Post => Exists_Summary (This) and Summary (This) = Value;
function Summary (This : Arg_Tag) return String with
Global => null,
Pre => Exists_Summary (This);
function Exists_Summary (This : Arg_Tag) return Boolean with
Global => null;
procedure Set_Allow_Null (This : in out Arg_Tag; Value : Boolean) with
Global => null,
Pre => not Exists_Allow_Null (This),
Post => Exists_Allow_Null (This) and (Allow_Null (This) = Value);
function Allow_Null (This : Arg_Tag) return Boolean with
Global => null,
Pre => Exists_Allow_Null (This);
function Exists_Allow_Null (This : Arg_Tag) return Boolean with
Global => null;
procedure Set_Enum
(This : in out Arg_Tag;
Value : String) with
Global => null,
Pre => not Exists_Enum (This),
Post => Exists_Enum (This) and Enum (This) = Value;
function Enum (This : Arg_Tag) return String with
Global => null,
Pre => Exists_Enum (This);
function Exists_Enum (This : Arg_Tag) return Boolean with
Global => null;
type Arg_Tag_Ptr is access all Arg_Tag;
type Copyright_Tag is limited private;
procedure Set_Text
(This : in out Copyright_Tag;
Value : String) with
Global => null,
Pre => not Exists_Text (This),
Post => Exists_Text (This) and Text (This) = Value;
function Text (This : Copyright_Tag) return String with
Global => null,
Pre => Exists_Text (This);
function Exists_Text (This : Copyright_Tag) return Boolean with
Global => null;
type Copyright_Ptr is access all Copyright_Tag;
type Description_Tag is limited private;
procedure Set_Text
(This : in out Description_Tag;
Value : String) with
Global => null,
Pre => not Exists_Text (This),
Post => Exists_Text (This) and Text (This) = Value;
function Text (This : Description_Tag) return String with
Global => null,
Pre => Exists_Text (This);
function Exists_Text (This : Description_Tag) return Boolean with
Global => null;
procedure Set_Summary
(This : in out Description_Tag;
Value : String) with
Global => null,
Pre => not Exists_Summary (This),
Post => Exists_Summary (This) and Summary (This) = Value;
function Summary (This : Description_Tag) return String with
Global => null,
Pre => Exists_Summary (This);
function Exists_Summary (This : Description_Tag) return Boolean with
Global => null;
type Description_Tag_Ptr is access all Description_Tag;
type Entry_Value is new Natural;
type Entry_Tag is limited private;
procedure Set_Name
(This : in out Entry_Tag;
Value : String) with
Global => null,
Pre => not Exists_Name (This),
Post => Exists_Name (This) and Name (This) = Value;
function Name (This : Entry_Tag) return String with
Global => null,
Pre => Exists_Name (This);
function Exists_Name (This : Entry_Tag) return Boolean with
Global => null;
procedure Set_Summary
(This : in out Entry_Tag;
Value : String) with
Global => null,
-- Pre => not Exists_Summary (This),
Post => Exists_Summary (This) and Summary (This) = Value;
function Summary (This : Entry_Tag) return String with
Global => null,
Pre => Exists_Summary (This);
function Exists_Summary (This : Entry_Tag) return Boolean with
Global => null;
procedure Set_Value (This : in out Entry_Tag; V : Entry_Value) with
Global => null,
Pre => not Exists_Value (This),
Post => Exists_Value (This) and Value (This) = V;
function Value (This : Entry_Tag) return Entry_Value with
Global => null,
Pre => Exists_Value (This);
function Value_As_String (This : Entry_Tag) return String with
Global => null,
Pre => Exists_Value (This);
function Exists_Value (This : Entry_Tag) return Boolean with
Global => null;
procedure Set_Since (This : in out Entry_Tag; Value : Version_Number) with
Global => null,
Pre => not Exists_Since (This),
Post => Exists_Since (This) and Since (This) = Value;
function Since (This : Entry_Tag) return Version_Number with
Global => null,
Pre => Exists_Since (This);
function Exists_Since (This : Entry_Tag) return Boolean with
Global => null;
type Entry_Tag_Ptr is access all Entry_Tag;
type Enum_Child_Kind_Id is (Child_Dummy, Child_Description, Child_Entry);
type Enum_Child (Kind_Id : Enum_Child_Kind_Id := Child_Dummy) is record
case Kind_Id is
when Child_Dummy =>
Dummy : not null String_Ptr := Empty_String'Access;
when Child_Description =>
Description_Tag : not null Description_Tag_Ptr;
when Child_Entry =>
Entry_Tag : not null Entry_Tag_Ptr;
end case;
end record;
package Enum_Child_Vectors is new Ada.Containers.Vectors
(Index_Type => Positive,
Element_Type => Enum_Child,
"=" => "=");
function Is_Smaller_Enum_Value (Left, Right : Enum_Child) return Boolean is
(Value (Left.Entry_Tag.all) < Value (Right.Entry_Tag.all));
package Enum_Child_Sorting is new Enum_Child_Vectors.Generic_Sorting (Is_Smaller_Enum_Value);
type Enum_Children_Ref
(E : not null access constant Enum_Child_Vectors.Vector)
is limited null record with
Implicit_Dereference => E;
type Enum_Tag is limited private;
function Children (This : aliased Enum_Tag) return Enum_Children_Ref;
function Entries (This : aliased Enum_Tag) return Enum_Children_Ref;
procedure Sort_Entries (This : in out Enum_Tag);
procedure Append_Child
(This : in out Enum_Tag;
Item : not null Wayland_XML.Description_Tag_Ptr);
procedure Append_Child
(This : in out Enum_Tag;
Item : not null Entry_Tag_Ptr);
procedure Set_Name
(This : in out Enum_Tag;
Value : String) with
Global => null,
Pre => not Exists_Name (This),
Post => Exists_Name (This) and Name (This) = Value;
function Name (This : Enum_Tag) return String with
Global => null,
Pre => Exists_Name (This);
function Exists_Name (This : Enum_Tag) return Boolean with
Global => null;
procedure Set_Bitfield (This : in out Enum_Tag; Value : Boolean) with
Global => null,
Pre => not Exists_Bitfield (This),
Post => Exists_Bitfield (This) and (Bitfield (This) = Value);
function Bitfield (This : Enum_Tag) return Boolean with
Global => null,
Pre => Exists_Bitfield (This);
function Exists_Bitfield (This : Enum_Tag) return Boolean with
Global => null;
procedure Set_Since (This : in out Enum_Tag; Value : Version_Number) with
Global => null,
Pre => not Exists_Since (This),
Post => Exists_Since (This) and Since (This) = Value;
function Since (This : Enum_Tag) return Version_Number with
Global => null,
Pre => Exists_Since (This);
function Exists_Since (This : Enum_Tag) return Boolean with
Global => null;
type Enum_Tag_Ptr is access all Enum_Tag;
type Event_Child_Kind_Id is (Child_Dummy, Child_Description, Child_Arg);
type Event_Child (Kind_Id : Event_Child_Kind_Id := Child_Dummy) is record
case Kind_Id is
when Child_Dummy =>
Dummy : not null String_Ptr := Empty_String'Access;
when Child_Description =>
Description_Tag : not null Description_Tag_Ptr;
when Child_Arg =>
Arg_Tag : not null Arg_Tag_Ptr;
end case;
end record;
package Event_Child_Vectors is new Ada.Containers.Vectors
(Index_Type => Positive,
Element_Type => Event_Child,
"=" => "=");
type Event_Children_Ref
(E : not null access constant Event_Child_Vectors.Vector)
is limited null record with
Implicit_Dereference => E;
type Event_Tag is limited private;
function Children (This : aliased Event_Tag) return Event_Children_Ref;
procedure Append_Child
(This : in out Event_Tag;
Item : not null Description_Tag_Ptr);
procedure Append_Child
(This : in out Event_Tag;
Item : not null Wayland_XML.Arg_Tag_Ptr);
procedure Set_Name
(This : in out Event_Tag;
Value : String) with
Global => null,
Pre => not Exists_Name (This),
Post => Exists_Name (This) and Name (This) = Value;
function Name (This : Event_Tag) return String with
Global => null,
Pre => Exists_Name (This);
function Exists_Name (This : Event_Tag) return Boolean with
Global => null;
procedure Set_Since
(This : in out Event_Tag;
Value : Version_Number) with
Global => null,
Pre => not Exists_Since (This),
Post =>
Exists_Since (This) and Since (This) = Value;
function Since (This : Event_Tag) return Version_Number with
Global => null,
Pre => Exists_Since (This);
function Since_As_Pos32
(This : Event_Tag) return Positive with
Global => null,
Pre => Exists_Since (This);
function Exists_Since (This : Event_Tag) return Boolean with
Global => null;
type Event_Tag_Ptr is access all Event_Tag;
type Request_Child_Kind_Id is (Child_Dummy, Child_Description, Child_Arg);
type Request_Child
(Kind_Id : Request_Child_Kind_Id := Child_Dummy)
is record
case Kind_Id is
when Child_Dummy =>
Dummy : not null String_Ptr := Empty_String'Access;
when Child_Description =>
Description_Tag : not null Description_Tag_Ptr;
when Child_Arg =>
Arg_Tag : not null Arg_Tag_Ptr;
end case;
end record;
package Request_Child_Vectors is new Ada.Containers.Vectors
(Index_Type => Positive,
Element_Type => Request_Child,
"=" => "=");
type Request_Children_Ref
(E : not null access constant Request_Child_Vectors.Vector)
is limited null record with
Implicit_Dereference => E;
type Request_Tag is limited private;
function Children (This : aliased Request_Tag) return Request_Children_Ref;
procedure Append_Child
(This : in out Request_Tag;
Item : not null Description_Tag_Ptr);
procedure Append_Child
(This : in out Request_Tag;
Item : not null Arg_Tag_Ptr);
procedure Set_Name
(This : in out Request_Tag;
Value : String) with
Global => null,
Pre => not Exists_Name (This),
Post => Exists_Name (This) and Name (This) = Value;
function Name (This : Request_Tag) return String with
Global => null,
Pre => Exists_Name (This);
function Exists_Name (This : Request_Tag) return Boolean with
Global => null;
procedure Set_Type_Attribute
(This : in out Request_Tag;
Value : String) with
Global => null,
Pre => not Exists_Type_Attribute (This),
Post => Exists_Type_Attribute (This) and Type_Attribute (This) = Value;
function Type_Attribute (This : Request_Tag) return String with
Global => null,
Pre => Exists_Type_Attribute (This);
function Exists_Type_Attribute (This : Request_Tag) return Boolean with
Global => null;
procedure Set_Since (This : in out Request_Tag; Value : Version_Number) with
Global => null,
Pre => not Exists_Since (This),
Post => Exists_Since (This) and Since (This) = Value;
function Since (This : Request_Tag) return Version_Number with
Global => null,
Pre => Exists_Since (This);
function Since_As_Pos32 (This : Request_Tag) return Positive with
Global => null,
Pre => Exists_Since (This);
function Exists_Since (This : Request_Tag) return Boolean with
Global => null;
function Description (This : aliased Request_Tag) return String with
Global => null,
Pre => Exists_Description (This);
function Exists_Description (This : aliased Request_Tag) return Boolean with
Global => null;
-- Returns true if there is one unique description
type Request_Tag_Ptr is access all Request_Tag;
type Interface_Child_Kind_Id is
(Child_Dummy, Child_Description, Child_Request, Child_Event, Child_Enum);
type Interface_Child
(Kind_Id : Interface_Child_Kind_Id := Child_Dummy)
is record
case Kind_Id is
when Child_Dummy =>
Dummy : not null String_Ptr := Empty_String'Access;
when Child_Description =>
Description_Tag : not null Description_Tag_Ptr;
when Child_Request =>
Request_Tag : not null Request_Tag_Ptr;
when Child_Event =>
Event_Tag : not null Event_Tag_Ptr;
when Child_Enum =>
Enum_Tag : not null Enum_Tag_Ptr;
end case;
end record;
package Interface_Child_Vectors is new Ada.Containers.Vectors
(Index_Type => Positive,
Element_Type => Interface_Child,
"=" => "=");
type Interface_Children_Ref
(E : not null access constant Interface_Child_Vectors.Vector)
is limited null record with
Implicit_Dereference => E;
type Interface_Tag is limited private;
function Exists_Events (This : aliased Interface_Tag) return Boolean;
procedure Set_Name
(This : in out Interface_Tag;
Value : String) with
Global => null,
Pre => not Exists_Name (This),
Post => Exists_Name (This) and Name (This) = Value;
function Name (This : Interface_Tag) return String with
Global => null,
Pre => Exists_Name (This);
function Exists_Name (This : Interface_Tag) return Boolean with
Global => null;
procedure Set_Version (This : in out Interface_Tag; Value : Version_Number) with
Global => null,
Pre => not Exists_Version (This),
Post => Exists_Version (This) and Version (This) = Value;
function Version (This : Interface_Tag) return Version_Number with
Global => null,
Pre => Exists_Version (This);
function Exists_Version (This : Interface_Tag) return Boolean with
Global => null;
function Children
(This : aliased Interface_Tag) return Interface_Children_Ref;
procedure Append_Child
(This : in out Interface_Tag;
Item : not null Description_Tag_Ptr);
procedure Append_Child
(This : in out Interface_Tag;
Item : not null Request_Tag_Ptr);
procedure Append_Child
(This : in out Interface_Tag;
Item : not null Event_Tag_Ptr);
procedure Append_Child
(This : in out Interface_Tag;
Item : not null Enum_Tag_Ptr);
type Interface_Tag_Ptr is access all Interface_Tag;
type Protocol_Child_Kind_Id is
(Child_Dummy, Child_Copyright, Child_Interface, Child_Description);
type Protocol_Child
(Kind_Id : Protocol_Child_Kind_Id := Child_Dummy)
is record
case Kind_Id is
when Child_Dummy =>
Dummy : not null String_Ptr := Empty_String'Access;
when Child_Copyright =>
Copyright_Tag : not null Copyright_Ptr;
when Child_Interface =>
Interface_Tag : not null Interface_Tag_Ptr;
when Child_Description =>
Description_Tag : not null Description_Tag_Ptr;
end case;
end record;
package Protocol_Child_Vectors is new Ada.Containers.Vectors
(Index_Type => Positive,
Element_Type => Protocol_Child,
"=" => "=");
type Protocol_Children_Ref
(E : not null access constant Protocol_Child_Vectors.Vector)
is limited null record with
Implicit_Dereference => E;
type Protocol_Tag is limited private;
procedure Set_Name
(This : in out Protocol_Tag;
Value : String) with
Global => null,
Pre => not Exists_Name (This),
Post => Exists_Name (This) and Name (This) = Value;
function Name (This : Protocol_Tag) return String with
Global => null,
Pre => Exists_Name (This);
function Exists_Name (This : Protocol_Tag) return Boolean with
Global => null;
function Children
(This : aliased Protocol_Tag) return Protocol_Children_Ref;
procedure Append_Child
(This : in out Protocol_Tag;
Item : not null Copyright_Ptr);
procedure Append_Child
(This : in out Protocol_Tag;
Item : not null Interface_Tag_Ptr);
procedure Append_Child
(This : in out Protocol_Tag;
Item : not null Description_Tag_Ptr);
type Protocol_Tag_Ptr is access all Protocol_Tag;
private
type Nullable_String_Ptr (Exists : Boolean := False) is record
case Exists is
when True =>
Value : not null String_Ptr := Empty_String'Access;
when False =>
null;
end case;
end record;
type Nullable_Boolean (Exists : Boolean := False) is record
case Exists is
when True =>
Value : Boolean;
when False =>
null;
end case;
end record;
type Nullable_Version (Exists : Boolean := False) is record
case Exists is
when True =>
Value : Version_Number;
when False =>
null;
end case;
end record;
type Nullable_Allow_Null (Exists : Boolean := False) is record
case Exists is
when True =>
Value : Boolean;
when False =>
null;
end case;
end record;
type Nullable_Type_Attribute (Exists : Boolean := False) is record
case Exists is
when True =>
Value : Arg_Type_Attribute;
when False =>
null;
end case;
end record;
type Arg_Tag is limited record
My_Name : Nullable_String_Ptr;
My_Type_Attribute : Nullable_Type_Attribute;
My_Interface_Attribute : Nullable_String_Ptr;
My_Summary : Nullable_String_Ptr;
My_Allow_Null : Nullable_Allow_Null;
My_Enum : Nullable_String_Ptr;
end record;
function Name (This : Arg_Tag) return String is (This.My_Name.Value.all);
function Exists_Name
(This : Arg_Tag) return Boolean is
(This.My_Name.Exists);
function Type_Attribute
(This : Arg_Tag) return Arg_Type_Attribute is
(This.My_Type_Attribute.Value);
function Exists_Type_Attribute
(This : Arg_Tag) return Boolean is
(This.My_Type_Attribute.Exists);
function Interface_Attribute
(This : Arg_Tag) return String is
(This.My_Interface_Attribute.Value.all);
function Exists_Interface_Attribute
(This : Arg_Tag) return Boolean is
(This.My_Interface_Attribute.Exists);
function Summary
(This : Arg_Tag) return String is
(This.My_Summary.Value.all);
function Exists_Summary
(This : Arg_Tag) return Boolean is
(This.My_Summary.Exists);
function Allow_Null
(This : Arg_Tag) return Boolean is
(This.My_Allow_Null.Value);
function Exists_Allow_Null
(This : Arg_Tag) return Boolean is
(This.My_Allow_Null.Exists);
function Enum (This : Arg_Tag) return String is (This.My_Enum.Value.all);
function Exists_Enum
(This : Arg_Tag) return Boolean is
(This.My_Enum.Exists);
type Copyright_Tag is limited record
My_Text : Nullable_String_Ptr;
end record;
function Text
(This : Copyright_Tag) return String is
(This.My_Text.Value.all);
function Exists_Text
(This : Copyright_Tag) return Boolean is
(This.My_Text.Exists);
type Description_Tag is limited record
My_Text : Nullable_String_Ptr;
My_Summary : Nullable_String_Ptr;
end record;
function Text
(This : Description_Tag) return String is
(This.My_Text.Value.all);
function Exists_Text
(This : Description_Tag) return Boolean is
(This.My_Text.Exists);
function Summary
(This : Description_Tag) return String is
(This.My_Summary.Value.all);
function Exists_Summary
(This : Description_Tag) return Boolean is
(This.My_Summary.Exists);
type Nullable_Entry_Value (Exists : Boolean := False) is record
case Exists is
when True =>
Value : Entry_Value;
when False =>
null;
end case;
end record;
type Entry_Tag is limited record
My_Name : Nullable_String_Ptr;
My_Value : Nullable_Entry_Value;
My_Summary : Nullable_String_Ptr;
My_Since : Nullable_Version;
end record;
function Name (This : Entry_Tag) return String is (This.My_Name.Value.all);
function Exists_Name
(This : Entry_Tag) return Boolean is
(This.My_Name.Exists);
function Value
(This : Entry_Tag) return Entry_Value is
(This.My_Value.Value);
function Value_As_String
(This : Entry_Tag) return String is
(Aida.To_String (Natural (This.My_Value.Value)));
function Exists_Value
(This : Entry_Tag) return Boolean is
(This.My_Value.Exists);
function Summary
(This : Entry_Tag) return String is
(This.My_Summary.Value.all);
function Exists_Summary
(This : Entry_Tag) return Boolean is
(This.My_Summary.Exists);
function Since (This : Entry_Tag) return Version_Number is (This.My_Since.Value);
function Exists_Since
(This : Entry_Tag) return Boolean is
(This.My_Since.Exists);
type Enum_Tag is limited record
My_Name : Nullable_String_Ptr;
My_Bitfield : Nullable_Boolean;
My_Since : Nullable_Version;
My_Children : aliased Enum_Child_Vectors.Vector;
My_Entries : aliased Enum_Child_Vectors.Vector;
end record;
function Name (This : Enum_Tag) return String is (This.My_Name.Value.all);
function Exists_Name
(This : Enum_Tag) return Boolean is
(This.My_Name.Exists);
function Bitfield
(This : Enum_Tag) return Boolean is
(This.My_Bitfield.Value);
function Exists_Bitfield
(This : Enum_Tag) return Boolean is
(This.My_Bitfield.Exists);
function Since (This : Enum_Tag) return Version_Number is (This.My_Since.Value);
function Exists_Since
(This : Enum_Tag) return Boolean is
(This.My_Since.Exists);
function Children
(This : aliased Enum_Tag) return Enum_Children_Ref is
((E => This.My_Children'Access));
function Entries
(This : aliased Enum_Tag) return Enum_Children_Ref is
((E => This.My_Entries'Access));
type Nullable_Since_Attribute (Exists : Boolean := False) is record
case Exists is
when True =>
Value : Version_Number;
when False =>
null;
end case;
end record;
type Event_Tag is limited record
My_Name : Nullable_String_Ptr;
My_Since_Attribute : Nullable_Since_Attribute;
My_Children : aliased Event_Child_Vectors.Vector;
end record;
function Name (This : Event_Tag) return String is (This.My_Name.Value.all);
function Exists_Name
(This : Event_Tag) return Boolean is
(This.My_Name.Exists);
function Since
(This : Event_Tag) return Version_Number is
(This.My_Since_Attribute.Value);
function Since_As_Pos32
(This : Event_Tag) return Positive is
(Positive (This.My_Since_Attribute.Value));
function Exists_Since
(This : Event_Tag) return Boolean is
(This.My_Since_Attribute.Exists);
function Children
(This : aliased Event_Tag) return Event_Children_Ref is
((E => This.My_Children'Access));
type Nullable_Since_T (Exists : Boolean := False) is record
case Exists is
when True =>
Value : Version_Number;
when False =>
null;
end case;
end record;
type Request_Tag is limited record
My_Name : Nullable_String_Ptr;
My_Children : aliased Request_Child_Vectors.Vector;
My_Type_Attribute : Nullable_String_Ptr;
My_Since : Nullable_Since_T;
end record;
function Name
(This : Request_Tag) return String is
(This.My_Name.Value.all);
function Exists_Name
(This : Request_Tag) return Boolean is
(This.My_Name.Exists);
function Children
(This : aliased Request_Tag) return Request_Children_Ref is
((E => This.My_Children'Access));
function Type_Attribute
(This : Request_Tag) return String is
(This.My_Type_Attribute.Value.all);
function Exists_Type_Attribute
(This : Request_Tag) return Boolean is
(This.My_Type_Attribute.Exists);
function Since
(This : Request_Tag) return Version_Number is
(This.My_Since.Value);
function Since_As_Pos32
(This : Request_Tag) return Positive is
(Positive (This.My_Since.Value));
function Exists_Since
(This : Request_Tag) return Boolean is
(This.My_Since.Exists);
type Interface_Tag is limited record
My_Name : Nullable_String_Ptr;
My_Version : Nullable_Version;
My_Children : aliased Interface_Child_Vectors.Vector;
end record;
function Name
(This : Interface_Tag) return String is
(This.My_Name.Value.all);
function Exists_Name
(This : Interface_Tag) return Boolean is
(This.My_Name.Exists);
function Version
(This : Interface_Tag) return Version_Number is
(This.My_Version.Value);
function Exists_Version
(This : Interface_Tag) return Boolean is
(This.My_Version.Exists);
function Children
(This : aliased Interface_Tag) return Interface_Children_Ref is
((E => This.My_Children'Access));
type Protocol_Tag is limited record
My_Name : Nullable_String_Ptr;
My_Children : aliased Protocol_Child_Vectors.Vector;
end record;
function Name
(This : Protocol_Tag) return String is
(This.My_Name.Value.all);
function Exists_Name
(This : Protocol_Tag) return Boolean is
(This.My_Name.Exists);
function Children
(This : aliased Protocol_Tag) return Protocol_Children_Ref is
((E => This.My_Children'Access));
end Wayland_XML;
|
bb-runtimes/runtimes/zfp-stm32g474/gnat/g-souinf.ads | JCGobbi/Nucleo-STM32G474RE | 0 | 28444 | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . S O U R C E _ I N F O --
-- --
-- S p e c --
-- --
-- Copyright (C) 2000-2021, 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. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package provides some useful utility subprograms that provide access
-- to source code information known at compile time. These subprograms are
-- intrinsic operations that provide information known to the compiler in
-- a form that can be embedded into the source program for identification
-- and logging purposes. For example, an exception handler can print out
-- the name of the source file in which the exception is handled.
package GNAT.Source_Info is
pragma Preelaborate;
-- Note that this unit is Preelaborate, but not Pure, that's because the
-- functions here such as Line are clearly not pure functions, and normally
-- we mark intrinsic functions in a Pure unit as Pure, even though they are
-- imported.
--
-- Historical note: this used to be Pure, but that was when we marked all
-- intrinsics as not Pure, even in Pure units, so no problems arose.
function File return String with
Import, Convention => Intrinsic;
-- Return the name of the current file, not including the path information.
-- The result is considered to be a static string constant.
function Line return Positive with
Import, Convention => Intrinsic;
-- Return the current input line number. The result is considered to be a
-- static expression.
function Source_Location return String with
Import, Convention => Intrinsic;
-- Return a string literal of the form "name:line", where name is the
-- current source file name without path information, and line is the
-- current line number. In the event that instantiations are involved,
-- additional suffixes of the same form are appended after the separating
-- string " instantiated at ". The result is considered to be a static
-- string constant.
function Enclosing_Entity return String with
Import, Convention => Intrinsic;
-- Return the name of the current subprogram, package, task, entry or
-- protected subprogram. The string is in exactly the form used for the
-- declaration of the entity (casing and encoding conventions), and is
-- considered to be a static string constant. The name is fully qualified
-- using periods where possible (this is not always possible, notably in
-- the case of entities appearing in unnamed block statements.)
--
-- Note: if this function is used at the outer level of a generic package,
-- the string returned will be the name of the instance, not the generic
-- package itself. This is useful in identifying and logging information
-- from within generic templates.
function Compilation_ISO_Date return String with
Import, Convention => Intrinsic;
-- Returns date of compilation as a static string "yyyy-mm-dd".
function Compilation_Date return String with
Import, Convention => Intrinsic;
-- Returns date of compilation as a static string "mmm dd yyyy". This is
-- in local time form, and is exactly compatible with C macro __DATE__.
function Compilation_Time return String with
Import, Convention => Intrinsic;
-- Returns GMT time of compilation as a static string "hh:mm:ss". This is
-- in local time form, and is exactly compatible with C macro __TIME__.
end GNAT.Source_Info;
|
test/Fail/Issue2858-missing.agda | cruhland/agda | 1,989 | 8986 | <reponame>cruhland/agda
interleaved mutual
data Nat : Set
record IsNat (n : Nat) : Set
isNat : (n : Nat) → IsNat n
|
Cubical/Algebra/CommRing/Instances/BiInvInt.agda | marcinjangrzybowski/cubical | 301 | 7449 | <filename>Cubical/Algebra/CommRing/Instances/BiInvInt.agda<gh_stars>100-1000
-- It is recommended to use Cubical.Algebra.CommRing.Instances.Int
-- instead of this file.
{-# OPTIONS --safe #-}
module Cubical.Algebra.CommRing.Instances.BiInvInt where
open import Cubical.Foundations.Prelude
open import Cubical.Algebra.CommRing
open import Cubical.Data.Int.MoreInts.BiInvInt
renaming (
_+_ to _+ℤ_;
-_ to _-ℤ_;
+-assoc to +ℤ-assoc;
+-comm to +ℤ-comm
)
BiInvℤAsCommRing : CommRing ℓ-zero
BiInvℤAsCommRing =
makeCommRing
zero (suc zero) _+ℤ_ _·_ _-ℤ_
isSetBiInvℤ
+ℤ-assoc +-zero +-invʳ +ℤ-comm
·-assoc ·-identityʳ
(λ x y z → sym (·-distribˡ x y z))
·-comm
|
models/mondex/cw.als | transclosure/Amalgam | 4 | 2803 | <filename>models/mondex/cw.als
module mondex/cw
open mondex/c as mondexC
open mondex/common as mondexCOMMON
pred Logbook (log : ConPurse -> PayDetails) {
all c : ConPurse, pd : PayDetails | (c->pd) in log implies c in pd.(from + to)
}
sig ConWorld extends ConState {
conAuthPurse : set ConPurse,
ether : set MESSAGE,
archive : ConPurse -> PayDetails
}
fun allPayDetails (s : ConWorld) : set PayDetails {
s.conAuthPurse.(s.archive + (exLog + status.s.(STATUS - eaFrom) <: pdAuth).s) + s.ether.((req <: details) + (val <: details) + (ack <: details) + (exceptionLogResult <: details) + (exceptionLogClear <: pds))
}
pred Concrete_conAuthPurse (s : ConWorld) {
-- purse spec constraints
all c : ConPurse | c in s.conAuthPurse implies {
all p : PayDetails | p in c.exLog.s implies c in p.(from+to)
c.status.s = epr implies {
c.pdAuth.s.from = c
c.pdAuth.s.value in c.balance.s
Lt [c.pdAuth.s.fromSeqNo, c.nextSeqNo.s]
}
c.status.s = epv implies {
Lt [c.pdAuth.s.toSeqNo, c.nextSeqNo.s]
}
c.status.s = epa implies {
Lt [c.pdAuth.s.fromSeqNo, c.nextSeqNo.s]
}
}
}
pred Concrete_archive (s : ConWorld) {
-- world constraints
Logbook [s.archive]
s.archive.PayDetails in s.conAuthPurse
}
-- Concrete_mult and Concrete_PayDetails are actual constraints holding also for the Concrete.
-- They are already defined in the original Z spec, but are modified in some way due to language issues
-- On the contrary, Between_Coin (cf. b module) is due to the representation of the amounts by coins
-- which is a spec issue rather than a language issue
-- To allow the "construction" of a ConWorld by definition of its fields, those have to be declared
-- without any constraints, even multiplicity. To actually "prove the existence" of such objects, one
-- has to show that the ConWorld constraints hold. But those constraints are not only the formulae
-- defined by the Z spec, but also the schema structure, i.e. the "availability" of the fields.
pred Concrete_mult (s : ConWorld) {
-- multiplicity constraints for well-definedness
s.conAuthPurse <: status.s in s.conAuthPurse -> one STATUS
s.conAuthPurse <: nextSeqNo.s in s.conAuthPurse -> one SEQNO
(s.conAuthPurse :> status.s.(STATUS - eaFrom)) <: pdAuth.s in (s.conAuthPurse :> status.s.(STATUS - eaFrom)) -> one PayDetails
}
-- The PayDetails constraints are only relevant to the ConWorlds. I.e, we do not care about payDetails
-- not occuring in a ConWorld. Hence predicates instead of facts.
-- Since "the combination of purse name and sequence number uniquely identifies the transaction"
-- (PRG-126, p. 24), we may canonicalize all the PayDetails used in the ConWorld.
-- This canonicalization attempt fails because StartFrom or StartTo operations *create* PayDetails,
-- which might exist before (for instance as the counterparty purse's pdAuth).
-- Unless we explicitly enforce it in the StartFromEafrom
-- and the StartToEafrom operations at the world level.
pred PayDetails_canon (s : ConWorld) {
let f = allPayDetails [s] |
f->f & from.~from & to.~to & fromSeqNo.~fromSeqNo & toSeqNo.~toSeqNo in iden
}
pred Concrete_PayDetails (s : ConWorld) {
-- Spec constraint
let f = allPayDetails [s] | no iden & ~from.(f <: to)
-- canonicalization
PayDetails_canon [s]
}
pred Concrete (s : ConWorld) {
Concrete_conAuthPurse [s]
Concrete_archive [s]
Concrete_mult [s]
Concrete_PayDetails [s]
}
pred ConWorld_ex () {
some c :ConWorld {
Concrete [c]
some c.conAuthPurse
}
}
run ConWorld_ex for 3
|
ch4/mmap.asm | abhinav-upadhyay/low_level_programming | 0 | 1098 | <reponame>abhinav-upadhyay/low_level_programming<filename>ch4/mmap.asm<gh_stars>0
%define O_RDONLY 0
%define PROT_READ 0x1
%define MAP_PRIVATE 0x2
global _start
section .data
fname: db 'test.txt', 0
section .text
print_string:
push rdi
call string_length
pop rsi
mov rdx, rax
mov rax, 1
mov rdi, 1
syscall
ret
string_length:
xor rax, rax
.loop:
cmp byte[rdi + rax], 0
je .end
inc rax
jmp .loop
.end:
ret
_start:
; open the file
mov rax, 2
mov rdi, fname
mov rsi, O_RDONLY
mov rdx, 0
syscall
; mmap the file
mov r8, rax
mov rax, 9
mov rdi, 0 ; we don't have any specific address to map the pages at
mov rsi, 4096 ; page size
mov rdx, PROT_READ
mov r10, MAP_PRIVATE
mov r9, 0
syscall
mov rdi, rax ; rax holds address of the mapped memory pages of the file
call print_string
mov rax, 60
xor rdi, rdi
syscall
|
tm/interpreter/grammar/tm.g4 | w1jtoo/tmi | 0 | 3233 | <filename>tm/interpreter/grammar/tm.g4<gh_stars>0
grammar tm;
program : statement* EOF ;
statement : ZERO state_name ZERO symbol ZERO state_name ZERO symbol ZERO direction ZERO;
state_name : ONE+ ;
symbol : ONE # ZeroSymbol
| ONE ONE # OneSymbol
| # LambdaSymbol
;
direction : ONE # Left
| ONE ONE # Right
| # Neutral
;
ZERO: '0' ;
ONE : '1' ; |
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0xca_notsx.log_36_1835.asm | ljhsiun2/medusa | 9 | 164551 | .global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r15
push %r8
push %rax
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
// Load
lea addresses_A+0x505a, %rsi
nop
nop
nop
and %r15, %r15
vmovups (%rsi), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $1, %xmm6, %rdx
xor $1501, %rax
// Store
lea addresses_D+0x1bff2, %rsi
nop
nop
nop
nop
nop
add $63489, %r8
mov $0x5152535455565758, %r15
movq %r15, %xmm1
movups %xmm1, (%rsi)
nop
nop
nop
cmp $34260, %r15
// REPMOV
lea addresses_RW+0x115c2, %rsi
lea addresses_D+0x1c5c2, %rdi
nop
nop
nop
nop
cmp $32384, %rax
mov $36, %rcx
rep movsw
nop
nop
nop
xor %r15, %r15
// Store
mov $0x4e3cbd00000005c2, %rdi
nop
add %r15, %r15
mov $0x5152535455565758, %rsi
movq %rsi, %xmm5
vmovups %ymm5, (%rdi)
nop
nop
nop
cmp %rax, %rax
// Store
lea addresses_US+0x7132, %r15
nop
inc %rdx
mov $0x5152535455565758, %rsi
movq %rsi, (%r15)
nop
nop
nop
nop
xor $9566, %r10
// Store
lea addresses_D+0x1c5c2, %r10
nop
nop
nop
nop
nop
add %rdx, %rdx
mov $0x5152535455565758, %r8
movq %r8, %xmm5
movntdq %xmm5, (%r10)
nop
add $15273, %r15
// Store
lea addresses_normal+0xf734, %rsi
sub $8196, %r10
mov $0x5152535455565758, %rbp
movq %rbp, %xmm6
movups %xmm6, (%rsi)
nop
nop
xor $36193, %r15
// Faulty Load
lea addresses_D+0x1c5c2, %rsi
nop
nop
nop
and %rax, %rax
vmovaps (%rsi), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $1, %xmm5, %rcx
lea oracles, %rdi
and $0xff, %rcx
shlq $12, %rcx
mov (%rdi,%rcx,1), %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r8
pop %r15
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': True, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': True, 'type': 'addresses_D'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 2, 'same': False, 'type': 'addresses_A'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 3, 'same': False, 'type': 'addresses_D'}, 'OP': 'STOR'}
{'src': {'congruent': 11, 'same': False, 'type': 'addresses_RW'}, 'dst': {'congruent': 0, 'same': True, 'type': 'addresses_D'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 11, 'same': False, 'type': 'addresses_NC'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': True, 'size': 8, 'congruent': 2, 'same': False, 'type': 'addresses_US'}, 'OP': 'STOR'}
{'dst': {'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': True, 'type': 'addresses_D'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 1, 'same': False, 'type': 'addresses_normal'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': True, 'size': 32, 'congruent': 0, 'same': True, 'type': 'addresses_D'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'00': 36}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
components/src/printer/adafruit_thermal_printer/adafruit-thermal_printer.adb | rocher/Ada_Drivers_Library | 192 | 11145 | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2017, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with Ada.Unchecked_Conversion;
with HAL.UART; use HAL.UART;
with HAL.Bitmap; use HAL.Bitmap;
package body AdaFruit.Thermal_Printer is
function To_Char is new Ada.Unchecked_Conversion (Source => UInt8,
Target => Character);
function To_UInt8 is new Ada.Unchecked_Conversion (Source => Character,
Target => UInt8);
procedure Write (This : in out TP_Device; Cmd : String);
procedure Read (This : in out TP_Device; Str : out String);
-----------
-- Write --
-----------
procedure Write (This : in out TP_Device; Cmd : String) is
Status : UART_Status;
Data : UART_Data_8b (Cmd'Range);
begin
for Index in Cmd'Range loop
Data (Index) := To_UInt8 (Cmd (Index));
end loop;
This.Port.Transmit (Data, Status);
if Status /= Ok then
-- No error handling...
raise Program_Error;
end if;
-- This.Time.Delay_Microseconds ((11 * 1000000 / 19_2000) + Cmd'Length);
end Write;
----------
-- Read --
----------
procedure Read (This : in out TP_Device; Str : out String) is
Status : UART_Status;
Data : UART_Data_8b (Str'Range);
begin
This.Port.Receive (Data, Status);
if Status /= Ok then
-- No error handling...
raise Program_Error;
end if;
for Index in Str'Range loop
Str (Index) := To_Char (Data (Index));
end loop;
end Read;
----------------------
-- Set_Line_Spacing --
----------------------
procedure Set_Line_Spacing (This : in out TP_Device; Spacing : UInt8) is
begin
Write (This, ASCII.ESC & '3' & To_Char (Spacing));
end Set_Line_Spacing;
---------------
-- Set_Align --
---------------
procedure Set_Align (This : in out TP_Device; Align : Text_Align) is
Mode : Character;
begin
case Align is
when Left => Mode := '0';
when Center => Mode := '1';
when Right => Mode := '2';
end case;
Write (This, ASCII.ESC & 'a' & Mode);
end Set_Align;
----------------------
-- Set_Font_Enlarge --
----------------------
procedure Set_Font_Enlarge (This : in out TP_Device; Height, Width : Boolean) is
Data : UInt8 := 0;
begin
if Height then
Data := Data or 16#01#;
end if;
if Width then
Data := Data or 16#10#;
end if;
Write (This, ASCII.GS & '!' & To_Char (Data));
end Set_Font_Enlarge;
--------------
-- Set_Bold --
--------------
procedure Set_Bold (This : in out TP_Device; Bold : Boolean) is
begin
Write (This, ASCII.ESC & 'E' & To_Char (if Bold then 1 else 0));
end Set_Bold;
----------------------
-- Set_Double_Width --
----------------------
procedure Set_Double_Width (This : in out TP_Device; Double : Boolean) is
begin
if Double then
Write (This, ASCII.ESC & ASCII.SO);
else
Write (This, ASCII.ESC & ASCII.DC4);
end if;
end Set_Double_Width;
----------------
-- Set_UpDown --
----------------
procedure Set_UpDown (This : in out TP_Device; UpDown : Boolean) is
begin
Write (This, ASCII.ESC & '{' & To_Char (if UpDown then 1 else 0));
end Set_UpDown;
------------------
-- Set_Reversed --
------------------
procedure Set_Reversed (This : in out TP_Device; Reversed : Boolean) is
begin
Write (This, ASCII.GS & 'B' & To_Char (if Reversed then 1 else 0));
end Set_Reversed;
--------------------------
-- Set_Underline_Height --
--------------------------
procedure Set_Underline_Height (This : in out TP_Device; Height : Underline_Height) is
begin
Write (This, ASCII.ESC & '-' & To_Char (Height));
end Set_Underline_Height;
-----------------------
-- Set_Character_Set --
-----------------------
procedure Set_Character_Set (This : in out TP_Device; Set : Character_Set) is
begin
Write (This, ASCII.ESC & 't' & To_Char (Character_Set'Pos (Set)));
end Set_Character_Set;
----------
-- Feed --
----------
procedure Feed (This : in out TP_Device; Rows : UInt8) is
begin
Write (This, ASCII.ESC & 'd' & To_Char (Rows));
end Feed;
------------------
-- Print_Bitmap --
------------------
procedure Print_Bitmap (This : in out TP_Device;
BM : Thermal_Printer_Bitmap)
is
Nbr_Of_Rows : constant Natural := BM'Length (2);
Nbr_Of_Columns : constant Natural := BM'Length (1);
Str : String (1 .. Nbr_Of_Columns / 8);
begin
Write (This, ASCII.DC2 & 'v' &
To_Char (UInt8 (Nbr_Of_Rows rem 256)) &
To_Char (UInt8 (Nbr_Of_Rows / 256)));
for Row in 0 .. Nbr_Of_Rows - 1 loop
for Colum in 0 .. (Nbr_Of_Columns / 8) - 1 loop
declare
BM_Index : constant Natural := BM'First (1) + Colum * 8;
Str_Index : constant Natural := Str'First + Colum;
B : UInt8 := 0;
begin
for X in 0 .. 7 loop
B := B or (if BM (BM_Index + X,
BM'First (2) + Row)
then 2**X else 0);
end loop;
Str (Str_Index) := To_Char (B);
end;
end loop;
Write (This, Str);
This.Time.Delay_Microseconds (600 * Str'Length);
end loop;
end Print_Bitmap;
------------------
-- Print_Bitmap --
------------------
procedure Print_Bitmap (This : in out TP_Device;
BM : not null HAL.Bitmap.Any_Bitmap_Buffer)
is
Nbr_Of_Rows : constant Natural := BM.Height;
Nbr_Of_Columns : constant Natural := BM.Width;
Str : String (1 .. Nbr_Of_Columns / 8);
begin
Write (This, ASCII.DC2 & 'v' &
To_Char (UInt8 (Nbr_Of_Rows rem 256)) &
To_Char (UInt8 (Nbr_Of_Rows / 256)));
for Row in 0 .. Nbr_Of_Rows - 1 loop
for Colum in 0 .. (Nbr_Of_Columns / 8) - 1 loop
declare
B : UInt8 := 0;
Str_Index : constant Natural := Str'First + Colum;
begin
for X in 0 .. 7 loop
B := B or (if BM.Pixel (((Colum * 8) + X, Row)).Red < 127
then 2**X else 0);
end loop;
Str (Str_Index) := To_Char (B);
end;
end loop;
Write (This, Str);
This.Time.Delay_Microseconds (600 * Str'Length);
end loop;
end Print_Bitmap;
----------
-- Wake --
----------
procedure Wake (This : in out TP_Device) is
begin
Write (This, ASCII.ESC & '@');
end Wake;
-----------
-- Reset --
-----------
procedure Reset (This : in out TP_Device) is
begin
Write (This, "" & To_Char (16#FF#));
This.Time.Delay_Milliseconds (50);
Write (This, ASCII.ESC & '8' & ASCII.NUL & ASCII.NUL);
for X in 1 .. 10 loop
This.Time.Delay_Microseconds (10_000);
Write (This, "" & ASCII.NUL);
end loop;
end Reset;
-----------
-- Print --
-----------
procedure Print (This : in out TP_Device; Text : String) is
begin
Write (This, Text);
end Print;
----------------
-- Get_Status --
----------------
function Get_Status (This : in out TP_Device) return Printer_Status is
Ret : Printer_Status;
Status : String := "P1V72T30";
begin
Ret.Paper := False;
Ret.Voltage := 0;
Ret.Temperature := 0;
Write (This, ASCII.ESC & 'v');
Read (This, Status);
-- Parse status here
-- P<Paper>V<Voltage>T<Degree>
-- Example: P1V72T30 Mean:Paper Ready,Current voltage 7.2V,Printer degree:30
return Ret;
end Get_Status;
--------------------------
-- Set_Printer_Settings --
--------------------------
procedure Set_Printer_Settings (This : in out TP_Device; Settings : Printer_Settings) is
begin
Write (This, ASCII.ESC & '7'
& To_Char (Settings.Max_Printing_Dots)
& To_Char (if Settings.Heating_Time < 3
then 3 else Settings.Heating_Time)
& To_Char (Settings.Heating_Interval));
end Set_Printer_Settings;
-----------------
-- Set_Density --
-----------------
procedure Set_Density (This : in out TP_Device; Density, Breaktime : UInt8) is
begin
Write (This,
ASCII.DC2 & '#' & To_Char (Shift_Left (Breaktime, 5) or Density));
end Set_Density;
---------------------
-- Print_Test_Page --
---------------------
procedure Print_Test_Page (This : in out TP_Device) is
begin
Write (This, ASCII.DC2 & 'T');
end Print_Test_Page;
end AdaFruit.Thermal_Printer;
|
projects/vmt/scratch/push_const.asm | RobertCurry0216/nand2tetris | 0 | 166428 | // push constant 4
// set D to value
@4
D=A
// push to stack
@SP
A=M
M=D
// inc sp
@SP
M=M+1
|
components/src/motion/l3gd20/l3gd20.adb | rocher/Ada_Drivers_Library | 192 | 19990 | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015, 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 STMicroelectronics nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
-- --
-- This file is based on: --
-- --
-- @file l3gd20.c --
-- @author MCD Application Team --
-- @version V1.1.0 --
-- @date 19-June-2014 --
-- @brief This file provides a set of functions needed to manage the --
-- L3GD20, ST MEMS motion sensor, 3-axis digital output --
-- gyroscope. --
-- --
-- COPYRIGHT(c) 2014 STMicroelectronics --
------------------------------------------------------------------------------
with Ada.Unchecked_Conversion;
with System;
package body L3GD20 is
-- the following are per Table 4 of the L3GD20 Datasheet, pg 9.
-- the values are millidegrees per second, so we scale accordingly
Sensitivity_250dps : constant := 8.75 * 0.001; -- mdps/digit
Sensitivity_500dps : constant := 17.5 * 0.001; -- mdps/digit
Sensitivity_2000dps : constant := 70.0 * 0.001; -- mdps/digit
ReadWrite_CMD : constant := 16#80#;
MultiUInt8_CMD : constant := 16#40#;
-- bit definitions for the CTRL_REG3 register
INT1_Interrupt_Enable : constant := 2#1000_0000#;
Interrupt_Pin_Mode_Bit : constant := 2#0001_0000#;
INT2_Data_Ready_Interrupt_Enable : constant := 2#0000_1000#;
INT2_Watermark_Interrupt_Enable : constant := 2#0000_0100#;
INT2_Overrun_Interrupt_Enable : constant := 2#0000_0010#;
INT2_FIFO_Empty_Interrupt_Enable : constant := 2#0000_0001#;
-- bit definitions for the CTRL_REG4 register
Endian_Selection_Mask : constant := 2#0100_0000#;
Fullscale_Selection_Bits : constant := 2#0011_0000#;
-- bit definitions for the CTRL_REG5 register
Boot_Bit : constant := 2#1000_0000#;
FIFO_Enable_Bit : constant := 2#0100_0000#;
HighPass_Filter_Enable : constant := 2#0001_0000#;
LowPass_Filter_Enable : constant := 2#0000_0010#;
-- bit definitions for the FIFO_CTRL register
FIFO_Mode_Bits : constant := 2#1110_0000#;
Watermark_Threshold_Bits : constant := 2#0001_1111#;
-- bit definitions for the FIFO_SRC register
Watermark_Status_Bit : constant := 2#1000_0000#;
FIFO_Overrun_Bit : constant := 2#0100_0000#;
FIFO_Empty_Bit : constant := 2#0010_0000#;
FIFO_Depth_Bits : constant := 2#0001_1111#;
-- bit definitions for the INT1_CFG register
Logically_And_Or_Events_Bit : constant := 2#1000_0000#;
Int1_Latch_Enable_Bit : constant := 2#0100_0000#;
Axes_Interrupt_Enablers : constant array (Axes_Interrupts) of UInt8 :=
(Z_High_Interrupt => 2#0010_0000#,
Z_Low_Interrupt => 2#0001_0000#,
Y_High_Interrupt => 2#0000_1000#,
Y_Low_Interrupt => 2#0000_0100#,
X_High_Interrupt => 2#0000_0010#,
X_Low_Interrupt => 2#0000_0001#);
function As_UInt8 is new Ada.Unchecked_Conversion
(Source => High_Pass_Filter_Mode, Target => UInt8);
function As_UInt8 is new Ada.Unchecked_Conversion
(Source => High_Pass_Cutoff_Frequency, Target => UInt8);
function As_UInt8 is new Ada.Unchecked_Conversion
(Source => Power_Mode_Selection, Target => UInt8);
function As_UInt8 is new Ada.Unchecked_Conversion
(Source => Output_Data_Rate_Selection, Target => UInt8);
function As_UInt8 is new Ada.Unchecked_Conversion
(Source => Axes_Selection, Target => UInt8);
function As_UInt8 is new Ada.Unchecked_Conversion
(Source => Bandwidth_Selection, Target => UInt8);
function As_UInt8 is new Ada.Unchecked_Conversion
(Source => Block_Data_Update_Selection, Target => UInt8);
function As_UInt8 is new Ada.Unchecked_Conversion
(Source => Endian_Data_Selection, Target => UInt8);
function As_UInt8 is new Ada.Unchecked_Conversion
(Source => Full_Scale_Selection, Target => UInt8);
type Angle_Rate_Pointer is access all Angle_Rate with Storage_Size => 0;
function As_Angle_Rate_Pointer is new Ada.Unchecked_Conversion
(Source => System.Address, Target => Angle_Rate_Pointer);
-- So that we can treat the address of a UInt8 as a pointer to a two-UInt8
-- sequence representing a signed integer quantity.
procedure Swap2 (Location : System.Address) with Inline;
-- Swaps the two UInt8s at Location and Location+1
procedure SPI_Mode (This : Three_Axis_Gyroscope; Enabled : Boolean);
-- Enable or disable SPI mode communication with the device. This is named
-- "chip select" in other demos/examples.
----------------
-- Initialize --
----------------
procedure Initialize
(This : in out Three_Axis_Gyroscope;
Port : Any_SPI_Port;
Chip_Select : Any_GPIO_Point)
is
begin
This.Port := Port;
This.CS := Chip_Select;
SPI_Mode (This, Enabled => False);
end Initialize;
-----------------
-- SPI_Mode --
-----------------
procedure SPI_Mode (This : Three_Axis_Gyroscope; Enabled : Boolean) is
-- When the pin is low (cleared), the device is in SPI mode.
-- When the pin is high (set), the device is in I2C mode.
-- We want SPI mode communication, so Enabled, when True,
-- means we must drive the pin low.
begin
if Enabled then
This.CS.Clear;
else
This.CS.Set;
end if;
end SPI_Mode;
-----------
-- Write --
-----------
procedure Write (This : Three_Axis_Gyroscope; Addr : Register; Data : UInt8)
is
Status : SPI_Status;
begin
SPI_Mode (This, Enabled => True);
This.Port.Transmit (SPI_Data_8b'(1 => UInt8 (Addr)), Status);
if Status /= Ok then
raise Program_Error;
end if;
This.Port.Transmit (SPI_Data_8b'(1 => Data), Status);
if Status /= Ok then
raise Program_Error;
end if;
SPI_Mode (This, Enabled => False);
end Write;
----------
-- Read --
----------
procedure Read
(This : Three_Axis_Gyroscope;
Addr : Register;
Data : out UInt8)
is
Status : SPI_Status;
Tmp_Data : SPI_Data_8b (1 .. 1);
begin
SPI_Mode (This, Enabled => True);
This.Port.Transmit (SPI_Data_8b'(1 => UInt8 (Addr) or ReadWrite_CMD),
Status);
if Status /= Ok then
raise Program_Error;
end if;
This.Port.Receive (Tmp_Data, Status);
if Status /= Ok then
raise Program_Error;
end if;
Data := Tmp_Data (Tmp_Data'First);
SPI_Mode (This, Enabled => False);
end Read;
----------------
-- Read_UInt8s --
----------------
procedure Read_UInt8s
(This : Three_Axis_Gyroscope;
Addr : Register;
Buffer : out SPI_Data_8b;
Count : Natural)
is
Index : Natural := Buffer'First;
Status : SPI_Status;
Tmp_Data : SPI_Data_8b (1 .. 1);
begin
SPI_Mode (This, Enabled => True);
This.Port.Transmit
(SPI_Data_8b'(1 => UInt8 (Addr) or ReadWrite_CMD or MultiUInt8_CMD),
Status);
if Status /= Ok then
raise Program_Error;
end if;
for K in 1 .. Count loop
This.Port.Receive (Tmp_Data, Status);
if Status /= Ok then
raise Program_Error;
end if;
Buffer (Index) := Tmp_Data (Tmp_Data'First);
Index := Index + 1;
end loop;
SPI_Mode (This, Enabled => False);
end Read_UInt8s;
---------------
-- Configure --
---------------
procedure Configure
(This : in out Three_Axis_Gyroscope;
Power_Mode : Power_Mode_Selection;
Output_Data_Rate : Output_Data_Rate_Selection;
Axes_Enable : Axes_Selection;
Bandwidth : Bandwidth_Selection;
BlockData_Update : Block_Data_Update_Selection;
Endianness : Endian_Data_Selection;
Full_Scale : Full_Scale_Selection)
is
Ctrl1 : UInt8;
Ctrl4 : UInt8;
begin
Ctrl1 := As_UInt8 (Power_Mode) or
As_UInt8 (Output_Data_Rate) or
As_UInt8 (Axes_Enable) or
As_UInt8 (Bandwidth);
Ctrl4 := As_UInt8 (BlockData_Update) or
As_UInt8 (Endianness) or
As_UInt8 (Full_Scale);
Write (This, CTRL_REG1, Ctrl1);
Write (This, CTRL_REG4, Ctrl4);
end Configure;
-----------
-- Sleep --
-----------
procedure Sleep (This : in out Three_Axis_Gyroscope) is
Ctrl1 : UInt8;
Sleep_Mode : constant := 2#1000#; -- per the Datasheet, Table 22, pg 32
begin
Read (This, CTRL_REG1, Ctrl1);
Ctrl1 := Ctrl1 or Sleep_Mode;
Write (This, CTRL_REG1, Ctrl1);
end Sleep;
--------------------------------
-- Configure_High_Pass_Filter --
--------------------------------
procedure Configure_High_Pass_Filter
(This : in out Three_Axis_Gyroscope;
Mode_Selection : High_Pass_Filter_Mode;
Cutoff_Frequency : High_Pass_Cutoff_Frequency)
is
Ctrl2 : UInt8;
begin
-- note that the two high-order bits must remain zero, per the datasheet
Ctrl2 := As_UInt8 (Mode_Selection) or As_UInt8 (Cutoff_Frequency);
Write (This, CTRL_REG2, Ctrl2);
end Configure_High_Pass_Filter;
-----------------------------
-- Enable_High_Pass_Filter --
-----------------------------
procedure Enable_High_Pass_Filter (This : in out Three_Axis_Gyroscope) is
Ctrl5 : UInt8;
begin
Read (This, CTRL_REG5, Ctrl5);
-- set HPen bit
Ctrl5 := Ctrl5 or HighPass_Filter_Enable;
Write (This, CTRL_REG5, Ctrl5);
end Enable_High_Pass_Filter;
------------------------------
-- Disable_High_Pass_Filter --
------------------------------
procedure Disable_High_Pass_Filter (This : in out Three_Axis_Gyroscope) is
Ctrl5 : UInt8;
begin
Read (This, CTRL_REG5, Ctrl5);
-- clear HPen bit
Ctrl5 := Ctrl5 and (not HighPass_Filter_Enable);
Write (This, CTRL_REG5, Ctrl5);
end Disable_High_Pass_Filter;
----------------------------
-- Enable_Low_Pass_Filter --
----------------------------
procedure Enable_Low_Pass_Filter (This : in out Three_Axis_Gyroscope) is
Ctrl5 : UInt8;
begin
Read (This, CTRL_REG5, Ctrl5);
Ctrl5 := Ctrl5 or LowPass_Filter_Enable;
Write (This, CTRL_REG5, Ctrl5);
end Enable_Low_Pass_Filter;
-----------------------------
-- Disable_Low_Pass_Filter --
-----------------------------
procedure Disable_Low_Pass_Filter (This : in out Three_Axis_Gyroscope) is
Ctrl5 : UInt8;
begin
Read (This, CTRL_REG5, Ctrl5);
-- clear HPen bit
Ctrl5 := Ctrl5 and (not LowPass_Filter_Enable);
Write (This, CTRL_REG5, Ctrl5);
end Disable_Low_Pass_Filter;
---------------------
-- Reference_Value --
---------------------
function Reference_Value (This : Three_Axis_Gyroscope) return UInt8 is
Result : UInt8;
begin
Read (This, Reference, Result);
return Result;
end Reference_Value;
-------------------
-- Set_Reference --
-------------------
procedure Set_Reference (This : in out Three_Axis_Gyroscope; Value : UInt8) is
begin
Write (This, Reference, Value);
end Set_Reference;
-----------------
-- Data_Status --
-----------------
function Data_Status (This : Three_Axis_Gyroscope) return Gyro_Data_Status is
Result : UInt8;
function As_Gyro_Data_Status is
new Ada.Unchecked_Conversion (Source => UInt8,
Target => Gyro_Data_Status);
begin
Read (This, Status, Result);
return As_Gyro_Data_Status (Result);
end Data_Status;
---------------
-- Device_Id --
---------------
function Device_Id (This : Three_Axis_Gyroscope) return UInt8 is
Result : UInt8;
begin
Read (This, Who_Am_I, Result);
return Result;
end Device_Id;
-----------------
-- Temperature --
-----------------
function Temperature (This : Three_Axis_Gyroscope) return UInt8 is
Result : UInt8;
begin
Read (This, OUT_Temp, Result);
return Result;
end Temperature;
------------
-- Reboot --
------------
procedure Reboot (This : Three_Axis_Gyroscope) is
Ctrl5 : UInt8;
begin
Read (This, CTRL_REG5, Ctrl5);
-- set the boot bit
Ctrl5 := Ctrl5 or Boot_Bit;
Write (This, CTRL_REG5, Ctrl5);
end Reboot;
----------------------------
-- Full_Scale_Sensitivity --
----------------------------
function Full_Scale_Sensitivity (This : Three_Axis_Gyroscope) return Float is
Ctrl4 : UInt8;
Result : Float;
Fullscale_Selection : UInt8;
begin
Read (This, CTRL_REG4, Ctrl4);
Fullscale_Selection := Ctrl4 and Fullscale_Selection_Bits;
if Fullscale_Selection = L3GD20_Fullscale_250'Enum_Rep then
Result := Sensitivity_250dps;
elsif Fullscale_Selection = L3GD20_Fullscale_500'Enum_Rep then
Result := Sensitivity_500dps;
else
Result := Sensitivity_2000dps;
end if;
return Result;
end Full_Scale_Sensitivity;
-------------------------
-- Get_Raw_Angle_Rates --
-------------------------
procedure Get_Raw_Angle_Rates
(This : Three_Axis_Gyroscope;
Rates : out Angle_Rates)
is
Ctrl4 : UInt8;
UInt8s_To_Read : constant Integer := 6; -- ie, three 2-UInt8 integers
-- the number of UInt8s in an Angle_Rates record object
Received : SPI_Data_8b (1 .. UInt8s_To_Read);
begin
Read (This, CTRL_REG4, Ctrl4);
Read_UInt8s (This, OUT_X_L, Received, UInt8s_To_Read);
-- The above has the effect of separate reads, as follows:
-- Read (This, OUT_X_L, Received (1));
-- Read (This, OUT_X_H, Received (2));
-- Read (This, OUT_Y_L, Received (3));
-- Read (This, OUT_Y_H, Received (4));
-- Read (This, OUT_Z_L, Received (5));
-- Read (This, OUT_Z_H, Received (6));
if (Ctrl4 and Endian_Selection_Mask) = L3GD20_Big_Endian'Enum_Rep then
Swap2 (Received (1)'Address);
Swap2 (Received (3)'Address);
Swap2 (Received (5)'Address);
end if;
Rates.X := As_Angle_Rate_Pointer (Received (1)'Address).all;
Rates.Y := As_Angle_Rate_Pointer (Received (3)'Address).all;
Rates.Z := As_Angle_Rate_Pointer (Received (5)'Address).all;
end Get_Raw_Angle_Rates;
--------------------------
-- Configure_Interrupt1 --
--------------------------
procedure Configure_Interrupt1
(This : in out Three_Axis_Gyroscope;
Triggers : Threshold_Event_List;
Latched : Boolean := False;
Active_Edge : Interrupt1_Active_Edge := L3GD20_Interrupt1_High_Edge;
Combine_Events : Boolean := False;
Sample_Count : Sample_Counter := 0)
is
Config : UInt8;
Ctrl3 : UInt8;
begin
Read (This, CTRL_REG3, Ctrl3);
Ctrl3 := Ctrl3 and 16#DF#;
Ctrl3 := Ctrl3 or Active_Edge'Enum_Rep;
Ctrl3 := Ctrl3 or INT1_Interrupt_Enable;
Write (This, CTRL_REG3, Ctrl3);
if Sample_Count > 0 then
Set_Duration_Counter (This, Sample_Count);
end if;
Config := 0;
if Latched then
Config := Config or Int1_Latch_Enable_Bit;
end if;
if Combine_Events then
Config := Config or Logically_And_Or_Events_Bit;
end if;
for Event of Triggers loop
Config := Config or Axes_Interrupt_Enablers (Event.Axis);
end loop;
Write (This, INT1_CFG, Config);
for Event of Triggers loop
Set_Threshold (This, Event.Axis, Event.Threshold);
end loop;
end Configure_Interrupt1;
----------------------------
-- Set_Interrupt_Pin_Mode --
----------------------------
procedure Set_Interrupt_Pin_Mode
(This : in out Three_Axis_Gyroscope;
Mode : Pin_Modes)
is
Ctrl3 : UInt8;
begin
Read (This, CTRL_REG3, Ctrl3);
Ctrl3 := Ctrl3 and (not Interrupt_Pin_Mode_Bit);
Ctrl3 := Ctrl3 or Mode'Enum_Rep;
Write (This, CTRL_REG3, Ctrl3);
end Set_Interrupt_Pin_Mode;
-----------------------
-- Enable_Interrupt1 --
-----------------------
procedure Enable_Interrupt1 (This : in out Three_Axis_Gyroscope) is
Ctrl3 : UInt8;
begin
Read (This, CTRL_REG3, Ctrl3);
Ctrl3 := Ctrl3 or INT1_Interrupt_Enable;
Write (This, CTRL_REG3, Ctrl3);
end Enable_Interrupt1;
------------------------
-- Disable_Interrupt1 --
------------------------
procedure Disable_Interrupt1 (This : in out Three_Axis_Gyroscope) is
Ctrl3 : UInt8;
begin
Read (This, CTRL_REG3, Ctrl3);
Ctrl3 := Ctrl3 and (not INT1_Interrupt_Enable);
Write (This, CTRL_REG3, Ctrl3);
end Disable_Interrupt1;
-----------------------
-- Interrupt1_Status --
-----------------------
function Interrupt1_Source (This : Three_Axis_Gyroscope) return Interrupt1_Sources is
Result : UInt8;
function As_Interrupt_Source is new Ada.Unchecked_Conversion
(Source => UInt8, Target => Interrupt1_Sources);
begin
Read (This, INT1_SRC, Result);
return As_Interrupt_Source (Result);
end Interrupt1_Source;
--------------------------
-- Set_Duration_Counter --
--------------------------
procedure Set_Duration_Counter
(This : in out Three_Axis_Gyroscope;
Value : Sample_Counter)
is
Wait_Bit : constant := 2#1000_0000#;
begin
Write (This, INT1_Duration, UInt8 (Value) or Wait_Bit);
end Set_Duration_Counter;
------------------
-- Enable_Event --
------------------
procedure Enable_Event
(This : in out Three_Axis_Gyroscope;
Event : Axes_Interrupts)
is
Config : UInt8;
begin
Read (This, INT1_CFG, Config);
Config := Config or Axes_Interrupt_Enablers (Event);
Write (This, INT1_CFG, Config);
end Enable_Event;
-------------------
-- Disable_Event --
-------------------
procedure Disable_Event
(This : in out Three_Axis_Gyroscope;
Event : Axes_Interrupts)
is
Config : UInt8;
begin
Read (This, INT1_CFG, Config);
Config := Config and (not Axes_Interrupt_Enablers (Event));
Write (This, INT1_CFG, Config);
end Disable_Event;
-------------------
-- Set_Threshold --
-------------------
procedure Set_Threshold
(This : in out Three_Axis_Gyroscope;
Event : Axes_Interrupts;
Value : Axis_Sample_Threshold)
is
begin
case Event is
when Z_High_Interrupt | Z_Low_Interrupt =>
Write (This, INT1_TSH_ZL, UInt8 (Value));
Write (This, INT1_TSH_ZH, UInt8 (Shift_Right (Value, 8)));
when Y_High_Interrupt | Y_Low_Interrupt =>
Write (This, INT1_TSH_YL, UInt8 (Value));
Write (This, INT1_TSH_YH, UInt8 (Shift_Right (Value, 8)));
when X_High_Interrupt | X_Low_Interrupt =>
Write (This, INT1_TSH_XL, UInt8 (Value));
Write (This, INT1_TSH_XH, UInt8 (Shift_Right (Value, 8)));
end case;
end Set_Threshold;
-------------------
-- Set_FIFO_Mode --
-------------------
procedure Set_FIFO_Mode
(This : in out Three_Axis_Gyroscope;
Mode : FIFO_Modes)
is
FIFO : UInt8;
begin
Read (This, FIFO_CTRL, FIFO);
FIFO := FIFO and (not FIFO_Mode_Bits); -- clear the current bits
FIFO := FIFO or Mode'Enum_Rep;
Write (This, FIFO_CTRL, FIFO);
end Set_FIFO_Mode;
-----------------
-- Enable_FIFO --
-----------------
procedure Enable_FIFO (This : in out Three_Axis_Gyroscope) is
Ctrl5 : UInt8;
begin
Read (This, CTRL_REG5, Ctrl5);
Ctrl5 := Ctrl5 or FIFO_Enable_Bit;
Write (This, CTRL_REG5, Ctrl5);
end Enable_FIFO;
------------------
-- Disable_FIFO --
------------------
procedure Disable_FIFO (This : in out Three_Axis_Gyroscope) is
Ctrl5 : UInt8;
begin
Read (This, CTRL_REG5, Ctrl5);
Ctrl5 := Ctrl5 and (not FIFO_Enable_Bit);
Write (This, CTRL_REG5, Ctrl5);
end Disable_FIFO;
------------------------
-- Set_FIFO_Watermark --
------------------------
procedure Set_FIFO_Watermark
(This : in out Three_Axis_Gyroscope;
Level : FIFO_Level)
is
Value : UInt8;
begin
Read (This, FIFO_CTRL, Value);
Value := Value and (not Watermark_Threshold_Bits); -- clear the bits
Value := Value or UInt8 (Level);
Write (This, FIFO_CTRL, Value);
end Set_FIFO_Watermark;
------------------------------
-- Get_Raw_Angle_Rates_FIFO --
------------------------------
procedure Get_Raw_Angle_Rates_FIFO
(This : in out Three_Axis_Gyroscope;
Buffer : out Angle_Rates_FIFO_Buffer)
is
Ctrl4 : UInt8;
Angle_Rate_Size : constant Integer := 6; -- UInt8s
UInt8s_To_Read : constant Integer := Buffer'Length * Angle_Rate_Size;
Received : SPI_Data_8b (0 .. UInt8s_To_Read - 1)
with Alignment => 2;
begin
Read (This, CTRL_REG4, Ctrl4);
Read_UInt8s (This, OUT_X_L, Received, UInt8s_To_Read);
if (Ctrl4 and Endian_Selection_Mask) = L3GD20_Big_Endian'Enum_Rep then
declare
J : Integer := 0;
begin
for K in Received'First .. Received'Last / 2 loop
Swap2 (Received (J)'Address);
J := J + 2;
end loop;
end;
end if;
declare
J : Integer := 0;
begin
for K in Buffer'Range loop
Buffer (K).X := As_Angle_Rate_Pointer (Received (J)'Address).all;
J := J + 2;
Buffer (K).Y := As_Angle_Rate_Pointer (Received (J)'Address).all;
J := J + 2;
Buffer (K).Z := As_Angle_Rate_Pointer (Received (J)'Address).all;
J := J + 2;
end loop;
end;
end Get_Raw_Angle_Rates_FIFO;
------------------------
-- Current_FIFO_Depth --
------------------------
function Current_FIFO_Depth (This : Three_Axis_Gyroscope) return FIFO_Level is
Result : UInt8;
begin
Read (This, FIFO_SRC, Result);
Result := Result and FIFO_Depth_Bits;
return FIFO_Level (Result);
end Current_FIFO_Depth;
--------------------------
-- FIFO_Below_Watermark --
--------------------------
function FIFO_Below_Watermark (This : Three_Axis_Gyroscope) return Boolean is
Result : UInt8;
begin
Read (This, FIFO_SRC, Result);
Result := Result and Watermark_Status_Bit;
return Result = 0;
end FIFO_Below_Watermark;
----------------
-- FIFO_Empty --
----------------
function FIFO_Empty (This : Three_Axis_Gyroscope) return Boolean is
Result : UInt8;
begin
Read (This, FIFO_SRC, Result);
Result := Result and FIFO_Empty_Bit;
return Result = FIFO_Empty_Bit;
end FIFO_Empty;
------------------
-- FIFO_Overrun --
------------------
function FIFO_Overrun (This : Three_Axis_Gyroscope) return Boolean is
Result : UInt8;
begin
Read (This, FIFO_SRC, Result);
Result := Result and FIFO_Overrun_Bit;
return Result = FIFO_Overrun_Bit;
end FIFO_Overrun;
---------------------------------
-- Enable_Data_Ready_Interrupt --
---------------------------------
procedure Enable_Data_Ready_Interrupt (This : in out Three_Axis_Gyroscope) is
Ctrl3 : UInt8;
begin
Read (This, CTRL_REG3, Ctrl3);
Ctrl3 := Ctrl3 or INT2_Data_Ready_Interrupt_Enable;
Write (This, CTRL_REG3, Ctrl3);
end Enable_Data_Ready_Interrupt;
----------------------------------
-- Disable_Data_Ready_Interrupt --
----------------------------------
procedure Disable_Data_Ready_Interrupt (This : in out Three_Axis_Gyroscope) is
Ctrl3 : UInt8;
begin
Read (This, CTRL_REG3, Ctrl3);
Ctrl3 := Ctrl3 and (not INT2_Data_Ready_Interrupt_Enable);
Write (This, CTRL_REG3, Ctrl3);
end Disable_Data_Ready_Interrupt;
-------------------------------------
-- Enable_FIFO_Watermark_Interrupt --
-------------------------------------
procedure Enable_FIFO_Watermark_Interrupt (This : in out Three_Axis_Gyroscope) is
Ctrl3 : UInt8;
begin
Read (This, CTRL_REG3, Ctrl3);
Ctrl3 := Ctrl3 or INT2_Watermark_Interrupt_Enable;
Write (This, CTRL_REG3, Ctrl3);
end Enable_FIFO_Watermark_Interrupt;
-----------------------------
-- Disable_Int1_Interrupts --
-----------------------------
procedure Disable_Int1_Interrupts (This : in out Three_Axis_Gyroscope) is
Ctrl3 : UInt8;
begin
Read (This, CTRL_REG3, Ctrl3);
Ctrl3 := Ctrl3 and 2#0001_1111#;
Write (This, CTRL_REG3, Ctrl3);
end Disable_Int1_Interrupts;
-----------------------------
-- Disable_Int2_Interrupts --
-----------------------------
procedure Disable_Int2_Interrupts (This : in out Three_Axis_Gyroscope) is
Ctrl3 : UInt8;
begin
Read (This, CTRL_REG3, Ctrl3);
Ctrl3 := Ctrl3 and 2#1111_0000#;
Write (This, CTRL_REG3, Ctrl3);
end Disable_Int2_Interrupts;
--------------------------------------
-- Disable_FIFO_Watermark_Interrupt --
--------------------------------------
procedure Disable_FIFO_Watermark_Interrupt
(This : in out Three_Axis_Gyroscope)
is
Ctrl3 : UInt8;
begin
Read (This, CTRL_REG3, Ctrl3);
Ctrl3 := Ctrl3 and (not INT2_Watermark_Interrupt_Enable);
Write (This, CTRL_REG3, Ctrl3);
end Disable_FIFO_Watermark_Interrupt;
-----------------------------------
-- Enable_FIFO_Overrun_Interrupt --
-----------------------------------
procedure Enable_FIFO_Overrun_Interrupt
(This : in out Three_Axis_Gyroscope)
is
Ctrl3 : UInt8;
begin
Read (This, CTRL_REG3, Ctrl3);
Ctrl3 := Ctrl3 or INT2_Overrun_Interrupt_Enable;
Write (This, CTRL_REG3, Ctrl3);
end Enable_FIFO_Overrun_Interrupt;
------------------------------------
-- Disable_FIFO_Overrun_Interrupt --
------------------------------------
procedure Disable_FIFO_Overrun_Interrupt
(This : in out Three_Axis_Gyroscope)
is
Ctrl3 : UInt8;
begin
Read (This, CTRL_REG3, Ctrl3);
Ctrl3 := Ctrl3 and (not INT2_Overrun_Interrupt_Enable);
Write (This, CTRL_REG3, Ctrl3);
end Disable_FIFO_Overrun_Interrupt;
---------------------------------
-- Enable_FIFO_Empty_Interrupt --
---------------------------------
procedure Enable_FIFO_Empty_Interrupt
(This : in out Three_Axis_Gyroscope)
is
Ctrl3 : UInt8;
begin
Read (This, CTRL_REG3, Ctrl3);
Ctrl3 := Ctrl3 or INT2_FIFO_Empty_Interrupt_Enable;
Write (This, CTRL_REG3, Ctrl3);
end Enable_FIFO_Empty_Interrupt;
----------------------------------
-- Disable_FIFO_Empty_Interrupt --
----------------------------------
procedure Disable_FIFO_Empty_Interrupt
(This : in out Three_Axis_Gyroscope)
is
Ctrl3 : UInt8;
begin
Read (This, CTRL_REG3, Ctrl3);
Ctrl3 := Ctrl3 and (not INT2_FIFO_Empty_Interrupt_Enable);
Write (This, CTRL_REG3, Ctrl3);
end Disable_FIFO_Empty_Interrupt;
-----------
-- Swap2 --
-----------
procedure Swap2 (Location : System.Address) is
X : UInt16;
for X'Address use Location;
function Bswap_16 (X : UInt16) return UInt16;
pragma Import (Intrinsic, Bswap_16, "__builtin_bswap16");
begin
X := Bswap_16 (X);
end Swap2;
-----------
-- Reset --
-----------
procedure Reset (This : in out Three_Axis_Gyroscope) is
begin
-- per the Datasheet, Table 17, pg 29
Write (This, CTRL_REG1, 2#0000_0111#);
Write (This, CTRL_REG2, 0);
Write (This, CTRL_REG3, 0);
Write (This, CTRL_REG4, 0);
Write (This, CTRL_REG5, 0);
Write (This, Reference, 0);
Write (This, FIFO_CTRL, 0);
Write (This, INT1_CFG, 0);
Write (This, INT1_TSH_ZL, 0);
Write (This, INT1_TSH_ZH, 0);
Write (This, INT1_TSH_YL, 0);
Write (This, INT1_TSH_YH, 0);
Write (This, INT1_TSH_XL, 0);
Write (This, INT1_TSH_XH, 0);
Write (This, INT1_Duration, 0);
end Reset;
end L3GD20;
|
oeis/077/A077974.asm | neoneye/loda-programs | 11 | 96350 | <gh_stars>10-100
; A077974: Expansion of 1/(1+x+2*x^3).
; Submitted by <NAME>
; 1,-1,1,-3,5,-7,13,-23,37,-63,109,-183,309,-527,893,-1511,2565,-4351,7373,-12503,21205,-35951,60957,-103367,175269,-297183,503917,-854455,1448821,-2456655,4165565,-7063207,11976517,-20307647,34434061,-58387095,99002389,-167870511,284644701
add $0,1
lpb $0
sub $0,1
mov $1,$2
add $4,1
mov $2,$4
mul $2,2
add $3,$2
sub $4,$3
mov $3,$1
lpe
sub $2,$1
mov $0,$2
div $0,2
|
x86/Move_Undo.asm | lantonov/asm | 150 | 163811 |
calign 16
Move_Undo:
; in: rbp address of Pos
; rbx address of State
; ecx move
push rsi
Display 2, "Move_Undo(move=%m1)%n"
if DEBUG
mov dword[rbp+Pos.debugDWORD1], ecx
end if
mov esi, dword[rbp+Pos.sideToMove]
xor esi, 1
mov r8d, ecx
shr r8d, 6
and r8d, 63 ; r8d = from
mov r9d, ecx
and r9d, 63 ; r9d = to
shr ecx, 12
movzx r11d, byte[rbx+State.capturedPiece] ; r11 = TO PIECE
movzx r10d, byte[rbp+Pos.board+r9] ; r10 = FROM PIECE
xor edx, edx
bts rdx, r8
bts rdx, r9
mov eax, r10d
and eax, 7
sub rbx, sizeof.State
mov dword[rbp+Pos.sideToMove], esi
mov byte[rbp+Pos.board+r8], r10l
mov byte[rbp+Pos.board+r9], r11l
xor qword[rbp+Pos.typeBB+8*rax], rdx
xor qword[rbp+Pos.typeBB+8*rsi], rdx
cmp ecx, MOVE_TYPE_PROM
jae .Special
movzx eax, byte[rbp+Pos.pieceIdx+r9]
mov byte[rbp+Pos.pieceList+rax], r8l
mov byte[rbp+Pos.pieceIdx+r8], al
mov eax, r11d ; save a copy of captured piece
and r11d, 7
jnz .Captured
if DEBUG
jmp Move_Undo_Check
end if
pop rsi
ret
calign 8
.Captured:
xor esi, 1
btr rdx, r8
or qword[rbp+Pos.typeBB+8*r11], rdx
or qword[rbp+Pos.typeBB+8*rsi], rdx
movzx ecx, byte[rbp+Pos.pieceEnd+rax]
mov byte[rbp+Pos.pieceIdx+r9], cl
mov byte[rbp+Pos.pieceList+rcx], r9l
add ecx, 1
mov byte[rbp+Pos.pieceEnd+rax], cl
if DEBUG
jmp Move_Undo_Check
end if
pop rsi
ret
calign 8
.Special:
xor edx, edx
cmp ecx, MOVE_TYPE_EPCAP
ja .Castle
movzx eax, byte[rbp+Pos.pieceIdx+r9]
mov byte[rbp+Pos.pieceList+rax], r8l
mov byte[rbp+Pos.pieceIdx+r8], al
mov eax, r11d ; save a copy of captured piece
je .EpCapture
.Prom:
; change promoted piece back to pawn on r8d
lea eax, [8*rsi+Pawn]
lea ecx, [rcx-MOVE_TYPE_PROM+Knight]
bts rdx, r8
or qword[rbp+Pos.typeBB+8*Pawn], rdx
xor qword[rbp+Pos.typeBB+8*rcx], rdx
mov byte[rbp+Pos.board+r8], al
mov byte[rbp+Pos.board+r9], r11l
push rdi
lea ecx, [8*rsi+rcx]
movzx edi, byte[rbp+Pos.pieceEnd+rcx]
sub edi, 1
movzx edx, byte[rbp+Pos.pieceList+rdi]
movzx eax, byte[rbp+Pos.pieceIdx+r8]
mov byte[rbp+Pos.pieceEnd+rcx], dil
mov byte[rbp+Pos.pieceIdx+rdx], al
mov byte[rbp+Pos.pieceList+rax], dl
mov byte[rbp+Pos.pieceList+rdi], 64
movzx edx, byte[rbp+Pos.pieceEnd+8*rsi+Pawn]
mov byte[rbp+Pos.pieceIdx+r8], dl
mov byte[rbp+Pos.pieceList+rdx], r8l
add edx, 1
mov byte[rbp+Pos.pieceEnd+8*rsi+Pawn], dl
mov eax, r11d
pop rdi
xor edx, edx
and r11d, 7
jnz .PromCapture
if DEBUG
jmp Move_Undo_Check
end if
pop rsi
ret
.PromCapture:
xor esi, 1
bts rdx, r9
or qword[rbp+Pos.typeBB+8*r11], rdx
or qword[rbp+Pos.typeBB+8*rsi], rdx
movzx ecx, byte[rbp+Pos.pieceEnd+rax]
mov byte[rbp+Pos.pieceIdx+r9], cl
mov byte[rbp+Pos.pieceList+rcx], r9l
add ecx, 1
mov byte[rbp+Pos.pieceEnd+rax], cl
if DEBUG
jmp Move_Undo_Check
end if
pop rsi
ret
calign 8
.EpCapture:
; place 8*rsi+Pawn on square rcx
lea ecx, [2*rsi-1]
lea ecx, [r9+8*rcx]
xor esi, 1
bts rdx, rcx
or qword[rbp+Pos.typeBB+8*Pawn], rdx
or qword[rbp+Pos.typeBB+8*rsi], rdx
mov byte[rbp+Pos.board+r9], 0
mov byte[rbp+Pos.board+rcx], r11l
movzx eax, byte[rbp+Pos.pieceEnd+r11]
mov byte[rbp+Pos.pieceIdx+rcx], al
mov byte[rbp+Pos.pieceList+rax], cl
add eax, 1
mov byte[rbp+Pos.pieceEnd+r11], al
if DEBUG
jmp Move_Undo_Check
end if
pop rsi
ret
calign 8
.Castle:
; r8 = kfrom
; r9 = rfrom
; ecx = kto
; edx = rto
; r10 = ourking
; r11 = our rook
bts rdx, r8
bts rdx, r9
xor qword[rbp+Pos.typeBB+8*rax], rdx
xor qword[rbp+Pos.typeBB+8*rsi], rdx
lea r10d, [8*rsi+King]
lea r11d, [8*rsi+Rook]
mov edx, r8d
and edx, 56
cmp r9d, r8d
sbb eax, eax
lea ecx, [rdx+4*rax+FILE_G]
lea edx, [rdx+2*rax+FILE_F]
mov byte[rbp+Pos.board+rcx], 0
mov byte[rbp+Pos.board+rdx], 0
mov byte[rbp+Pos.board+r8], r10l
mov byte[rbp+Pos.board+r9], r11l
push rdi
; movzx eax, byte[rbp+Pos.pieceIdx+rcx]
; movzx edi, byte[rbp+Pos.pieceIdx+rdx]
; mov byte[rbp+Pos.pieceList+rax], r8l
; mov byte[rbp+Pos.pieceList+rdi], r9l
; mov byte[rbp+Pos.pieceIdx+r8], al
; mov byte[rbp+Pos.pieceIdx+r9], dil
; no! above not enough instructions! official stockfish has
; castling rook moved to the back of the list
; of course this for absolutely no good reason
movzx eax, byte[rbp+Pos.pieceIdx+rcx]
movzx edi, byte[rbp+Pos.pieceIdx+rdx]
mov byte[rbp+Pos.pieceList+rax], r8l
mov byte[rbp+Pos.pieceList+rdi], r9l
mov byte[rbp+Pos.pieceIdx+r8], al
mov byte[rbp+Pos.pieceIdx+r9], dil
; now move rook to the back of the list
movzx eax, byte[rbp+Pos.pieceEnd+r11]
sub eax, 1
movzx r10d, byte[rbp+Pos.pieceList+rax]
;;xchg byte[rbp+Pos.pieceList+rdi], byte[rbp+Pos.pieceList+rax]
movzx r9d, byte[rbp+Pos.pieceList+rdi]
movzx r11d, byte[rbp+Pos.pieceList+rax]
mov byte[rbp+Pos.pieceList+rdi], r11l
mov byte[rbp+Pos.pieceList+rax], r9l
;;xchg byte[rbp+Pos.pieceIdx+rdx], byte[rbp+Pos.pieceIdx+r12]
movzx edi, byte[rbp+Pos.pieceIdx+r9]
movzx r11d, byte[rbp+Pos.pieceIdx+r10]
mov byte[rbp+Pos.pieceIdx+r9], r11l
mov byte[rbp+Pos.pieceIdx+r10], dil
pop rdi
mov rax, qword[rbp+Pos.typeBB+8*rsi]
mov r10, qword[rbp+Pos.typeBB+8*King]
mov r11, qword[rbp+Pos.typeBB+8*Rook]
btr rax, rcx
btr rax, rdx
bts rax, r8
bts rax, r9
btr r10, rcx
bts r10, r8
btr r11, rdx
bts r11, r9
mov qword[rbp+Pos.typeBB+8*rsi], rax
mov qword[rbp+Pos.typeBB+8*King], r10
mov qword[rbp+Pos.typeBB+8*Rook], r11
if DEBUG
jmp Move_Undo_Check
end if
pop rsi
ret
if DEBUG
Move_Undo_Check:
mov qword[rbp+Pos.state], rbx
call Position_IsLegal
test eax, eax
jnz @f
pop rsi
ret
@@:
lea rdi,[DebugOutput]
mov rax, 'UndoMove'
stosq
PrintNewLine
mov ecx, dword[rbp+Pos.debugDWORD1]
xor edx, edx
call PrintUciMoveLong
PrintNewLine
lea rdi, [DebugOutput]
call Os_ErrorBox
int3
end if
|
compiler/ti-cgt-arm_18.12.4.LTS/lib/src/fd_mul16.asm | JosiahCraw/TI-Arm-Docker | 0 | 8639 | ;******************************************************************************
;* FD_MUL16.ASM - 16 BIT STATE - *
;* *
;* Copyright (c) 1996 Texas Instruments Incorporated *
;* http://www.ti.com/ *
;* *
;* Redistribution and use in source and binary forms, with or without *
;* modification, are permitted provided that the following conditions *
;* are met: *
;* *
;* Redistributions of source code must retain the above copyright *
;* notice, this list of conditions and the following disclaimer. *
;* *
;* Redistributions in binary form must reproduce the above copyright *
;* notice, this list of conditions and the following disclaimer in *
;* the documentation and/or other materials provided with the *
;* distribution. *
;* *
;* Neither the name of Texas Instruments Incorporated nor the names *
;* of its contributors may be used to endorse or promote products *
;* derived from this software without specific prior written *
;* permission. *
;* *
;* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
;* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
;* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
;* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
;* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
;* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
;* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
;* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
;* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
;* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
;* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
;* *
;******************************************************************************
;****************************************************************************
;* FD$MUL - MULTIPLY TWO IEEE 754 FORMAT DOUBLE PRECISION FLOATING
;* POINT NUMBERS.
;****************************************************************************
;*
;* o INPUT OP1 IS IN r0:r1
;* o INPUT OP2 IS IN r2:r3
;* o RESULT IS RETURNED IN r0:r1
;* o INPUT OP2 IN r2:r3 IS NOT DESTROYED
;*
;* o SIGNALLING NOT-A-NUMBER (SNaN) AND QUIET NOT-A-NUMBER (QNaN)
;* ARE TREATED AS INFINITY
;* o OVERFLOW RETURNS +/- INFINITY
;* (0x7ff00000:00000000) or (0xfff00000:00000000)
;* o UNDERFLOW RETURNS ZERO (0x00000000:00000000)
;* o DENORMALIZED NUMBERS ARE TREATED AS UNDERFLOWS
;* o ROUNDING MODE: ROUND TO NEAREST
;*
;* o IF THE OPERATION INVOLVES INFINITY AS AN INPUT, UNLESS THE OTHER INPUT
;* IS ZERO, THE RESULT IS INFINITY WITH THE SIGN DETERMINED IN THE USUAL
;* FASHION.
;*
;****************************************************************************
;*
;* +------------------------------------------------------------------+
;* | DOUBLE PRECISION FLOATING POINT FORMAT |
;* | 64-bit representation |
;* | 31 30 20 19 0 |
;* | +-+----------+---------------------+ |
;* | |S| E | M1 | |
;* | +-+----------+---------------------+ |
;* | |
;* | 31 0 |
;* | +----------------------------------+ |
;* | | M2 | |
;* | +----------------------------------+ |
;* | |
;* | <S> SIGN FIELD : 0 - POSITIVE VALUE |
;* | 1 - NEGATIVE VALUE |
;* | |
;* | <E> EXPONENT FIELD: 0000000000 - ZERO IFF M == 0 |
;* | 0000000001..1111111110 - EXPONENT VALUE(1023 BIAS) |
;* | 1111111111 - INFINITY |
;* | |
;* | <M1:M2> MANTISSA FIELDS: FRACTIONAL MAGNITUDE WITH IMPLIED 1 |
;* +------------------------------------------------------------------+
;*
;****************************************************************************
.global __TI_umull
.thumb
.if __TI_EABI_ASSEMBLER ; ASSIGN EXTERNAL NAMES BASED ON
.asg __aeabi_dmul, __TI_FD$MUL ; RTS BEING BUILT
.else
.clink
.asg FD$MUL, __TI_FD$MUL
.endif
.global __TI_FD$MUL
.if .TMS470_BIG_DOUBLE
rp1_hi .set r0 ; High word of regpair 1
rp1_lo .set r1 ; Low word of regpair 1
rp2_hi .set r2 ; High word of regpair 2
rp2_lo .set r3 ; Low word of regpair 2
res1 .set r0 ; OVERLOADED WITH INPUT #1
op1e .set r1 ; OVERLOADED WITH INPUT #1
op1m1 .set r2 ; OVERLOADED WITH INPUT #2
op1m2 .set r3 ; OVERLOADED WITH INPUT #2
.else
rp1_hi .set r1 ; High word of regpair 1
rp1_lo .set r0 ; Low word of regpair 1
rp2_hi .set r3 ; High word of regpair 2
rp2_lo .set r2 ; Low word of regpair 2
res1 .set r1 ; OVERLOADED WITH INPUT #1
op1e .set r0 ; OVERLOADED WITH INPUT #1
op1m1 .set r3 ; OVERLOADED WITH INPUT #2
op1m2 .set r2 ; OVERLOADED WITH INPUT #2
.endif
tmp .set r4
op2m1 .set r5
op2m2 .set r6
op2e .set r7
res2 .set r7 ; OVERLOADED WITH op2e
.if __TI_ARM9ABI_ASSEMBLER | __TI_EABI_ASSEMBLER
.thumbfunc __TI_FD$MUL
.endif
.if __TI_ARM_V6M0__
__TI_FD$MUL: .asmfunc stack_usage(40) ; V6M0 needs a little more stack
.else ; space to work in thumb mode.
__TI_FD$MUL: .asmfunc stack_usage(32)
.endif
.if __TI_ARM7ABI_ASSEMBLER | __TI_ARM9ABI_ASSEMBLER | !__TI_TMS470_V4__
PUSH {r2-r7, lr} ;
.else
PUSH {r2-r7} ; PUSH THE LR SEPARATELY SO IT CAN BE
PUSH {lr} ; POPPED FIRST.
.endif
MOVS tmp, rp1_hi ; SET THE SIGN OF THE RESULT
EORS tmp, rp2_hi ;
LSRS tmp, tmp, #31 ;
LSLS tmp, tmp, #31 ;
PUSH {tmp} ;
LSLS op2m1, rp2_hi, #11 ; BUILD INPUT #2 MANTISSA
LSRS tmp, rp2_lo, #21 ;
ORRS op2m1, tmp ;
LSLS op2m2, rp2_lo, #11 ;
LSLS op2e, rp2_hi, #1 ; BUILD INPUT #2 EXPONENT
LSRS op2e, op2e, #21 ;
BEQ unfl ;
MOVS tmp, #0x1 ;
LSLS tmp, tmp, #31 ; SET IMPLIED ONE IN MANTISSA
ORRS op2m1, tmp ;
MOVS tmp, #0x7 ;
LSLS tmp, tmp, #8 ;
ADDS tmp, #0xFF ;
CMP op2e, tmp ; IF op2e == 0x7FF, THEN OVERFLOW
BEQ ovfl ;
LSLS op1m1, rp1_hi, #11 ; BUILD INPUT #1 MANTISSA
LSRS tmp, rp1_lo, #21 ;
ORRS op1m1, tmp ;
LSLS op1m2, rp1_lo, #11 ;
LSLS op1e, rp1_hi, #1 ; BUILD INPUT #1 EXPONENT
LSRS op1e, op1e, #21 ;
BEQ unfl ;
MOVS tmp, #0x1 ; SET IMPLIED ONE IN MANTISSA
LSLS tmp, tmp, #31 ;
ORRS op1m1, tmp ;
MOVS tmp, #0x7 ;
LSLS tmp, tmp, #8 ;
ADDS tmp, #0xFF ;
CMP op1e, tmp ; IF op1e == 0x7FF, THEN OVERFLOW
BEQ ovfl ;
ADDS op1e, op1e, op2e ; ADD EXPONENTS
.if __TI_ARM_V6M0__
PUSH {op1e} ; Store this off since we need the register
MOVS r0, op1m1 ; Setup arguments for the first UMULL
MOVS r1, op2m1
BL __TI_umull ; r0:r1 = r0 * r1
MOVS res2, r1 ; Move the results around
PUSH {r0} ; Store this off since we need the register
MOVS r0, op1m1 ; Again...
MOVS r1, op2m2
BL __TI_umull
MOVS op1m1, r0
MOVS tmp, r1
MOVS r0, op1m2 ; Again...
MOVS r1, op2m2
BL __TI_umull
MOVS op2m2, r0 ; We only need the high word
MOVS r0, op1m2 ; Again...
MOVS r1, op2m1
BL __TI_umull
MOVS op2m1, r0
ADDS op2m2, r1 ; The low word gets added into op2m2
MOVS op1m2, #0
.if .TMS470_BIG_DOUBLE
POP {res1, op1e} ; Grab that stuff we stored off
.else
POP {res1} ; Grab that stuff we stored off
POP {op1e} ; Grab that stuff we stored off
.endif
.else
NOP ;
BX pc ; CHANGE TO 32 BIT STATE FOR MULTIPLY
NOP ;
.arm
; MULTIPLY THE MANTISAE: op1m * op2m => res1:res2
UMULL res2, res1, op1m1, op2m1; op1m1*op2m1 =>res1:res2: 0 : 0
UMULL tmp, op1m1, op2m2, op1m1; op1m1*op2m2 => 0 :op1m1:tmp : 0
UMULL lr, op2m2, op1m2, op2m2 ; op1m2*op2m2 => 0 : 0 :op2m2: lr
UMULL lr, op2m1, op1m2, op2m1 ; op1m2*op2m1 => 0 :op2m1: lr : 0
ADDS op2m2, op2m2, lr ; 0 : 0 :op2m2: 0
MOV op1m2, #0x0
ADD lr, pc, #0x1 ; CHANGE BACK TO 16 BIT STATE
BX lr ;
.thumb
.endif
ADCS op2m1, op1m2 ; 0 :op2m1: 0 : 0
ADCS res1, op1m2 ; res1: 0 : 0 : 0
ADDS tmp, op2m2 ; 0 : 0 : tmp : 0
ADCS op2m1, op1m2 ; 0 :op2m1: 0 : 0
ADCS res1, op1m2 ; res1: 0 : 0 : 0
MOVS tmp, #0x80 ; SETUP 1/2 CONSTANT FOR ROUNDING
LSLS tmp, tmp, #2 ;
ADDS op1m1, op2m1 ; 0 :op1m1: 0 : 0
ADCS res1, op1m2 ; res1: 0 : 0 : 0
ADDS res2, op1m1 ; 0 :res2: 0 : 0
ADCS res1, op1m2 ; res1: 0 : 0 : 0
BPL $1 ; IF THE MANTISSA WILL NOT NEED
LSLS tmp, tmp, #0x1 ; ALIGNMENT, ADJUST 1/2 CONSTANT.
$1: ADDS res2, res2, tmp ; ADD 1/2 FOR ROUNDING
ADCS res1, op1m2 ;
BMI $2 ; ALIGN THE RESULT
LSLS res2, res2, #1 ;
ADCS res1, res1 ;
B $3 ;
$2: ADDS op1e, op1e, #0x1 ;
$3: MOVS tmp, #0x3 ;
LSLS tmp, tmp, #8 ;
ADDS tmp, #0xFF ;
SUBS op1e, op1e, tmp ; ADJUST FOR BIAS
BLE unfl ; AND CHECK FOR UNDERFLOW
ADDS tmp, tmp, tmp ;
CMP op1e, tmp ; AND CHECK FOR EXPONENT OVERFLOW
BHI ovfl ;
LSLS op1m1, op1e, #20 ; ALIGN EXPONENT INTO op1m1
LSRS rp1_lo, res2, #11 ; REPACK LOW PART OF RESULT
LSLS tmp, res1, #21 ;
ORRS rp1_lo, tmp ;
LSLS rp1_hi, res1, #1 ; REPACK HIGH PART OF RESULT
LSRS rp1_hi, rp1_hi, #12 ;
ORRS rp1_hi, op1m1 ; REPACK THE EXPONENT INTO rp1_hi
POP {tmp} ;
ORRS rp1_hi, tmp ; REPACK THE SIGN INTO rp1_hi
.if __TI_ARM7ABI_ASSEMBLER | __TI_ARM9ABI_ASSEMBLER | !__TI_TMS470_V4__
POP {r2-r7, pc} ;
.else
POP {r2}
MOV lr, r2
POP {r2-r7}
BX lr
.endif
ovfl: MOVS rp1_lo, #0 ; IF OVERFLOW, RETURN +/- INFINITY
MOVS rp1_hi, #0xFF
LSLS rp1_hi, rp1_hi, #3
ADDS rp1_hi, rp1_hi, #7
LSLS rp1_hi, rp1_hi, #20
POP {tmp} ;
ORRS rp1_hi, tmp ;
.if __TI_ARM7ABI_ASSEMBLER | __TI_ARM9ABI_ASSEMBLER | !__TI_TMS470_V4__
POP {r2-r7, pc} ;
.else
POP {r2}
MOV lr, r2
POP {r2-r7}
BX lr
.endif
unfl: MOVS rp1_hi, #0 ; UNDERFLOW, SO RETURN ZERO
MOVS rp1_lo, #0 ;
ADD sp, #4 ;
.if __TI_ARM7ABI_ASSEMBLER | __TI_ARM9ABI_ASSEMBLER | !__TI_TMS470_V4__
POP {r2-r7, pc} ;
.else
POP {r2}
MOV lr, r2
POP {r2-r7}
BX lr
.endif
.endasmfunc
.end
|
backdoor.scpt | R3dFruitRollUp/iMessagesBackdoor | 129 | 4735 | <reponame>R3dFruitRollUp/iMessagesBackdoor
using terms from application "Messages"
# This entire file is needed for the handler otherwise errors will be thrown.
on received text invitation theText from theBuddy for theChat
end received text invitation
on received audio invitation theText from theBuddy for theChat
end received audio invitation
on received video invitation theText from theBuddy for theChat
end received video invitation
on received file transfer invitation theFileTransfer
end received file transfer invitation
on buddy authorization requested theRequest
end buddy authorization requested
on message sent theMessage for theChat
end message sent
on message received theMessage from theBuddy for theChat
if theMessage contains "helloworld" then
display dialog "Hello from message received handler!"
end if
end message received
on chat room message received theMessage from theBuddy for theChat
end chat room message received
on active chat message received
end active chat message received
on addressed chat room message received theMessage from theBuddy for theChat
end addressed chat room message received
on addressed message received theMessage from theBuddy for theChat
end addressed message received
on av chat started
end av chat started
on av chat ended
end av chat ended
on login finished for theService
end login finished
on logout finished for theService
end logout finished
on buddy became available theBuddy
end buddy became available
on buddy became unavailable theBuddy
end buddy became unavailable
on completed file transfer
end completed file transfer
end using terms from
|
data/tilesets/train_station_collision.asm | Dev727/ancientplatinum | 28 | 177051 | <filename>data/tilesets/train_station_collision.asm
tilecoll FF, FF, FF, FF ; 00
tilecoll UP_WALL, UP_WALL, FLOOR, FLOOR ; 01
tilecoll UP_WALL, FLOOR, UP_WALL, FLOOR ; 02
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 03
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 04
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 05
tilecoll FLOOR, FLOOR, WALL, WALL ; 06
tilecoll WALL, FLOOR, WALL, FLOOR ; 07
tilecoll WALL, FLOOR, WALL, WALL ; 08
tilecoll FLOOR, FLOOR, WARP_CARPET_DOWN, WARP_CARPET_DOWN ; 09
tilecoll WALL, WALL, WALL, WALL ; 0a
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 0b
tilecoll WALL, FLOOR, WALL, FLOOR ; 0c
tilecoll WALL, WALL, WALL, WALL ; 0d
tilecoll FLOOR, WALL, FLOOR, WALL ; 0e
tilecoll WALL, WALL, WALL, WALL ; 0f
tilecoll WALL, WALL, WALL, WALL ; 10
tilecoll WALL, WALL, DOOR, WALL ; 11
tilecoll WALL, WALL, WALL, DOOR ; 12
tilecoll WALL, WALL, WALL, WALL ; 13
tilecoll WALL, WALL, WALL, WALL ; 14
tilecoll WALL, WALL, WALL, WALL ; 15
tilecoll WALL, WALL, WALL, WALL ; 16
tilecoll WALL, WALL, WALL, WALL ; 17
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 18
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 19
tilecoll WALL, WALL, WALL, WALL ; 1a
tilecoll WALL, WALL, WALL, WALL ; 1b
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 1c
tilecoll WALL, FLOOR, WALL, FLOOR ; 1d
tilecoll FLOOR, WALL, FLOOR, WALL ; 1e
tilecoll FLOOR, FLOOR, WARP_CARPET_DOWN, WARP_CARPET_DOWN ; 1f
tilecoll WALL, WALL, WALL, WALL ; 20
tilecoll WALL, FLOOR, WALL, FLOOR ; 21
tilecoll FLOOR, WALL, FLOOR, WALL ; 22
tilecoll WALL, WALL, FLOOR, FLOOR ; 23
tilecoll WALL, WALL, FLOOR, FLOOR ; 24
tilecoll WALL, WALL, FLOOR, FLOOR ; 25
tilecoll WALL, FLOOR, WALL, FLOOR ; 26
tilecoll FLOOR, WALL, FLOOR, WALL ; 27
tilecoll WALL, WALL, WALL, FLOOR ; 28
tilecoll WALL, WALL, FLOOR, WALL ; 29
tilecoll WALL, FLOOR, WALL, FLOOR ; 2a
tilecoll FLOOR, WALL, FLOOR, WALL ; 2b
tilecoll FLOOR, WALL, FLOOR, WALL ; 2c
tilecoll FLOOR, WALL, FLOOR, WALL ; 2d
tilecoll WALL, WALL, WALL, WALL ; 2e
tilecoll WALL, WALL, FLOOR, FLOOR ; 2f
tilecoll WALL, WALL, FLOOR, FLOOR ; 30
tilecoll WALL, FLOOR, WALL, FLOOR ; 31
tilecoll FLOOR, WALL, FLOOR, WALL ; 32
tilecoll WALL, FLOOR, FLOOR, FLOOR ; 33
tilecoll WALL, FLOOR, WALL, FLOOR ; 34
tilecoll FLOOR, WALL, FLOOR, WALL ; 35
tilecoll WALL, WALL, WALL, FLOOR ; 36
tilecoll WALL, WALL, FLOOR, FLOOR ; 37
tilecoll WALL, WALL, FLOOR, WALL ; 38
tilecoll WALL, FLOOR, WALL, WALL ; 39
tilecoll WALL, WALL, WALL, WALL ; 3a
tilecoll FLOOR, WALL, WALL, WALL ; 3b
tilecoll WALL, WALL, WALL, WALL ; 3c
tilecoll WALL, WALL, WALL, WALL ; 3d
tilecoll WALL, WALL, WALL, WALL ; 3e
tilecoll WALL, WALL, WALL, WALL ; 3f
|
oeis/127/A127554.asm | neoneye/loda-programs | 11 | 241619 | ; A127554: Sum of the digits of left factorial !n.
; Submitted by <NAME>
; 0,1,2,4,1,7,10,19,19,19,19,28,37,37,55,55,37,46,46,73,73,64,82,100,100,118,109,100,127,127,145,118,163,145,154,172,172,154,181,181,199,172,226,208,253,226,262,262,253,271,235,271,262,280,325,325,307,343,334,334,298,352,361,352,334,388,406,370,424,442,433,424,433,460,460,451,505,451,478,496,532,541,532,568,514,577,586,613,532,568,586,523,550,667,631,676,631,676,667,694
seq $0,3422 ; Left factorials: !n = Sum_{k=0..n-1} k!.
seq $0,7953 ; Digital sum (i.e., sum of digits) of n; also called digsum(n).
|
src/tom/library/sl/ada/muvarstrategy.ads | rewriting/tom | 36 | 8453 | <reponame>rewriting/tom<gh_stars>10-100
with ObjectPack, AbstractStrategyCombinatorPackage, IntrospectorPackage, StrategyPackage;
use ObjectPack, AbstractStrategyCombinatorPackage, IntrospectorPackage, StrategyPackage;
package MuVarStrategy is
type MuVar is new AbstractStrategyCombinator and Object with
record
instance : StrategyPtr := null;
name : access String := null;
end record;
type MuVarPtr is access all MuVar;
----------------------------------------------------------------------------
-- Object implementation
----------------------------------------------------------------------------
function toString(c: MuVar) return String;
----------------------------------------------------------------------------
-- Strategy implementation
----------------------------------------------------------------------------
function visitLight(str:access MuVar; any: ObjectPtr; i: access Introspector'Class) return ObjectPtr;
function visit(str: access MuVar; i: access Introspector'Class) return Integer;
----------------------------------------------------------------------------
function newMuVar(s : access String) return StrategyPtr;
function newMuVar(s : String) return StrategyPtr;
function equals(m : access MuVar; o : ObjectPtr) return Boolean;
function hashCode(m : access MuVar) return Integer;
function getInstance(m: access MuVar) return StrategyPtr;
procedure setInstance(m: access MuVar; s: StrategyPtr);
procedure setName(m: access MuVar; n: access String);
function isExpanded(m: access Muvar) return Boolean;
function getName(m: access Muvar) return access String;
end MuVarStrategy;
|
in/int/clk/clk.asm | Daliji/Diers | 4 | 174108 | <filename>in/int/clk/clk.asm
[bits 32]
[extern do_timer]
[extern sys_tick]
[extern process_disp]
[global clock_int_start]
[extern show_number]
clock_int_start:
push esi
push ebx
push ecx
push edx
push edi
push ebp
push ds
push es
push fs
mov bx,0x10
mov ds,bx
mov es,bx
mov bx,0x17
mov fs,bx
clock_int:
mov eax,[sys_tick]
inc eax
mov [sys_tick],eax
mov al,0x20
out 0xa0,al
out 0x20,al
mov ax,[esp+40]
and eax,0x03
push eax
call do_timer
pop eax
pop fs
pop es
pop ds
pop ebp
pop edi
pop edx
pop ecx
pop ebx
pop esi
clk_end:
iret |
src/aco-nodes-remotes.adb | jonashaggstrom/ada-canopen | 6 | 3323 | <gh_stars>1-10
with ACO.Protocols.Service_Data;
package body ACO.Nodes.Remotes is
overriding
procedure Set_State
(This : in out Remote;
State : in ACO.States.State)
is
begin
This.NMT.Request_State (State);
-- If there is no heartbeat or node guarding, just assume the requested
-- state is correct...
if This.Od.Get_Heartbeat_Producer_Period = 0 then
This.NMT.Set (State);
end if;
end Set_State;
overriding
function Get_State
(This : Remote)
return ACO.States.State
is
begin
return This.NMT.Get;
end Get_State;
overriding
procedure Start
(This : in out Remote)
is
begin
This.Handler.Start;
end Start;
function Is_Complete
(This : SDO_Request)
return Boolean
is
begin
return ACO.SDO_Sessions.Is_Complete (This.Status);
end Is_Complete;
procedure Suspend_Until_Result
(This : in out SDO_Request;
Result : out SDO_Result)
is
begin
if This.Id in ACO.SDO_Sessions.Valid_Endpoint_Nr then
declare
Request : Request_Data renames This.Node.SDO.Requests (This.Id);
begin
Ada.Synchronous_Task_Control.Suspend_Until_True (Request.Suspension);
Result := Request.Status;
end;
else
Result := ACO.SDO_Sessions.Error;
end if;
end Suspend_Until_Result;
procedure Suspend_Until_Result
(This : in out SDO_Read_Request;
Result : out SDO_Result)
is
begin
SDO_Request (This).Suspend_Until_Result (Result);
case Result is
when ACO.SDO_Sessions.Complete =>
This.Get_Entry;
when ACO.SDO_Sessions.Error =>
This.Node.SDO.Clear (This.Id);
end case;
end Suspend_Until_Result;
procedure Get_Entry
(This : in out SDO_Read_Request)
is
begin
This.Node.SDO.Get_Read_Entry (This.Id, This.To_Entry.all);
This.Node.SDO.Clear (This.Id);
end Get_Entry;
function Status
(This : SDO_Request)
return SDO_Status
is
begin
if This.Id in ACO.SDO_Sessions.Valid_Endpoint_Nr then
return This.Node.SDO.Requests (This.Id).Status;
else
return ACO.SDO_Sessions.Error;
end if;
end Status;
procedure Write
(This : in out Remote;
Request : in out SDO_Write_Request'Class;
Index : in ACO.OD_Types.Object_Index;
Subindex : in ACO.OD_Types.Object_Subindex;
An_Entry : in ACO.OD_Types.Entry_Base'Class)
is
begin
This.SDO.Write_Remote_Entry
(Node => This.Id,
Index => Index,
Subindex => Subindex,
An_Entry => An_Entry,
Endpoint_Id => Request.Id);
if Request.Id in ACO.SDO_Sessions.Valid_Endpoint_Nr'Range then
declare
Req_Data : Request_Data renames This.SDO.Requests (Request.Id);
begin
Req_Data.Status := ACO.SDO_Sessions.Pending;
Req_Data.Operation := Write;
Ada.Synchronous_Task_Control.Set_False (Req_Data.Suspension);
end;
end if;
end Write;
overriding
procedure Write
(This : in out Remote;
Index : in ACO.OD_Types.Object_Index;
Subindex : in ACO.OD_Types.Object_Subindex;
An_Entry : in ACO.OD_Types.Entry_Base'Class)
is
Request : SDO_Write_Request (This'Access);
begin
This.Write (Request => Request,
Index => Index,
Subindex => Subindex,
An_Entry => An_Entry);
declare
Result : SDO_Result;
begin
Request.Suspend_Until_Result (Result);
end;
end Write;
overriding
procedure Read
(This : in out Remote;
Index : in ACO.OD_Types.Object_Index;
Subindex : in ACO.OD_Types.Object_Subindex;
To_Entry : out ACO.OD_Types.Entry_Base'Class)
is
Result : ACO.Nodes.Remotes.SDO_Result;
begin
This.Read
(Index => Index,
Subindex => Subindex,
Result => Result,
To_Entry => To_Entry);
case Result is
when ACO.SDO_Sessions.Complete =>
null;
when ACO.SDO_Sessions.Error =>
raise Failed_To_Read_Entry_Of_Node
with Result'Img & " index =" & Index'Img;
end case;
end Read;
procedure Read
(This : in out Remote;
Index : in ACO.OD_Types.Object_Index;
Subindex : in ACO.OD_Types.Object_Subindex;
Result : out ACO.Nodes.Remotes.SDO_Result;
To_Entry : out ACO.OD_Types.Entry_Base'Class)
is
Request : ACO.Nodes.Remotes.SDO_Read_Request
(This'Access, To_Entry'Access);
begin
This.Read
(Request => Request,
Index => Index,
Subindex => Subindex);
Request.Suspend_Until_Result (Result);
end Read;
procedure Read
(This : in out Remote;
Request : in out SDO_Read_Request'Class;
Index : in ACO.OD_Types.Object_Index;
Subindex : in ACO.OD_Types.Object_Subindex)
is
begin
This.SDO.Read_Remote_Entry
(Node => This.Id,
Index => Index,
Subindex => Subindex,
Endpoint_Id => Request.Id);
if Request.Id in ACO.SDO_Sessions.Valid_Endpoint_Nr'Range then
declare
Req_Data : Request_Data renames This.SDO.Requests (Request.Id);
begin
Req_Data.Status := ACO.SDO_Sessions.Pending;
Req_Data.Operation := Read;
Ada.Synchronous_Task_Control.Set_False (Req_Data.Suspension);
end;
end if;
end Read;
function Generic_Read
(This : in out Remote;
Index : ACO.OD_Types.Object_Index;
Subindex : ACO.OD_Types.Object_Subindex)
return Entry_T
is
An_Entry : aliased Entry_T;
Request : ACO.Nodes.Remotes.SDO_Read_Request
(This'Access, An_Entry'Access);
Result : ACO.Nodes.Remotes.SDO_Result;
begin
This.Read
(Request => Request,
Index => Index,
Subindex => Subindex);
Request.Suspend_Until_Result (Result);
if not Request.Is_Complete then
raise Failed_To_Read_Entry_Of_Node
with Result'Img & " index =" & Index'Img;
end if;
return An_Entry;
end Generic_Read;
procedure Set_Heartbeat_Timeout
(This : in out Remote;
Timeout : in Natural)
is
begin
This.NMT.Set_Heartbeat_Timeout (Timeout);
end Set_Heartbeat_Timeout;
procedure On_Message_Dispatch
(This : in out Remote;
Msg : in ACO.Messages.Message)
is
begin
if This.NMT.Is_Valid (Msg) then
This.NMT.Message_Received (Msg);
elsif This.EC.Is_Valid (Msg) then
This.EC.Message_Received (Msg);
elsif This.SDO.Is_Valid (Msg) then
This.SDO.Message_Received (Msg);
end if;
end On_Message_Dispatch;
procedure Periodic_Actions
(This : in out Remote;
T_Now : in Ada.Real_Time.Time)
is
begin
This.NMT.Periodic_Actions (T_Now);
This.SDO.Periodic_Actions (T_Now);
end Periodic_Actions;
overriding
procedure Result_Callback
(This : in out Remote_Client;
Session : in ACO.SDO_Sessions.SDO_Session;
Result : in ACO.SDO_Sessions.SDO_Result)
is
Request : Request_Data renames This.Requests (Session.Endpoint.Id);
begin
Request.Status := Result;
case Request.Operation is
when Write =>
This.Clear (Session.Endpoint.Id);
when Read =>
null;
end case;
Ada.Synchronous_Task_Control.Set_True (Request.Suspension);
This.Od.Events.Node_Events.Put
((Event => ACO.Events.SDO_Status_Update,
SDO_Status => (Endpoint_Id => Session.Endpoint.Id,
Result => Result)));
end Result_Callback;
overriding
function Tx_CAN_Id
(This : Remote_Client;
Parameter : ACO.SDO_Sessions.SDO_Parameters)
return ACO.Messages.Id_Type
is
(Parameter.CAN_Id_C2S);
overriding
function Rx_CAN_Id
(This : Remote_Client;
Parameter : ACO.SDO_Sessions.SDO_Parameters)
return ACO.Messages.Id_Type
is
(Parameter.CAN_Id_S2C);
overriding
function Get_Endpoint
(This : Remote_Client;
Rx_CAN_Id : ACO.Messages.Id_Type)
return ACO.SDO_Sessions.Endpoint_Type
is
use type ACO.Messages.Id_Type;
-- Clients always initiate a session and a remote client always use the
-- default mandatory Id's, meaning we should make sure we use the same
-- endpoint as when we sent the initial request...
Endpoint : constant ACO.SDO_Sessions.Endpoint_Type :=
This.Get_Endpoint (Server_Node => This.Id);
begin
if This.Rx_CAN_Id (Endpoint.Parameters) = Rx_CAN_Id then
return Endpoint;
else
return ACO.SDO_Sessions.No_Endpoint;
end if;
end Get_Endpoint;
overriding
function Get_Endpoint
(This : Remote_Client;
Server_Node : ACO.Messages.Node_Nr)
return ACO.SDO_Sessions.Endpoint_Type
is
use type ACO.Messages.Id_Type;
-- As a remote client we only know the OD of the server, therefore we can
-- use any of the C2S-Id's of the server.
-- But the mandatory Server-Rx-Id is a good choice...
Tx_CAN_Id : constant ACO.Messages.CAN_Id_Type :=
(As_Id => False,
Code => ACO.Protocols.Service_Data.SDO_C2S_Id,
Node => Server_Node);
I : ACO.SDO_Sessions.Endpoint_Nr :=
ACO.SDO_Sessions.Valid_Endpoint_Nr'First;
begin
for P of This.Od.Get_SDO_Server_Parameters loop
if This.Tx_CAN_Id (P) = Tx_CAN_Id.Id then
return (Id => I, Parameters => P);
end if;
I := ACO.SDO_Sessions.Endpoint_Nr'Succ (I);
end loop;
return ACO.SDO_Sessions.No_Endpoint;
end Get_Endpoint;
end ACO.Nodes.Remotes;
|
programs/oeis/168/A168105.asm | jmorken/loda | 1 | 161565 | ; A168105: a(n) = sum of natural numbers m such that n - 6 <= m <= n + 6.
; 21,28,36,45,55,66,78,91,104,117,130,143,156,169,182,195,208,221,234,247,260,273,286,299,312,325,338,351,364,377,390,403,416,429,442,455,468,481,494,507,520,533,546,559,572,585,598,611,624,637,650,663,676,689,702,715,728,741,754,767,780,793,806,819,832,845,858,871,884,897,910,923,936,949,962,975,988,1001,1014,1027,1040,1053,1066,1079,1092,1105,1118,1131,1144,1157,1170,1183,1196,1209,1222,1235,1248,1261,1274,1287,1300,1313,1326,1339,1352,1365,1378,1391,1404,1417,1430,1443,1456,1469,1482,1495,1508,1521,1534,1547,1560,1573,1586,1599,1612,1625,1638,1651,1664,1677,1690,1703,1716,1729,1742,1755,1768,1781,1794,1807,1820,1833,1846,1859,1872,1885,1898,1911,1924,1937,1950,1963,1976,1989,2002,2015,2028,2041,2054,2067,2080,2093,2106,2119,2132,2145,2158,2171,2184,2197,2210,2223,2236,2249,2262,2275,2288,2301,2314,2327,2340,2353,2366,2379,2392,2405,2418,2431,2444,2457,2470,2483,2496,2509,2522,2535,2548,2561,2574,2587,2600,2613,2626,2639,2652,2665,2678,2691,2704,2717,2730,2743,2756,2769,2782,2795,2808,2821,2834,2847,2860,2873,2886,2899,2912,2925,2938,2951,2964,2977,2990,3003,3016,3029,3042,3055,3068,3081,3094,3107,3120,3133,3146,3159,3172,3185,3198,3211,3224,3237
mov $2,$0
mov $0,13
add $2,7
lpb $0
sub $0,1
trn $2,1
add $1,$2
lpe
|
Cubical/Relation/Nullary/Decidable.agda | bijan2005/univalent-foundations | 0 | 5603 | <filename>Cubical/Relation/Nullary/Decidable.agda
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.Relation.Nullary.Decidable where
open import Cubical.Core.Everything
open import Cubical.Data.Empty using (⊥)
private
variable
ℓ : Level
-- Negation
infix 3 ¬_
¬_ : Type ℓ → Type ℓ
¬ A = A → ⊥
-- Decidable types (inspired by standard library)
data Dec (P : Type ℓ) : Type ℓ where
yes : ( p : P) → Dec P
no : (¬p : ¬ P) → Dec P
data IsYes {P : Type ℓ} : Dec P → Type ℓ where
isYes : ∀ {x} → IsYes (yes x)
Discrete : Type ℓ → Type ℓ
Discrete A = ∀ x y → Dec (Path A x y)
|
ada/euler42.adb | procrastiraptor/euler | 1 | 15579 | <filename>ada/euler42.adb
with Ada.Integer_Text_IO;
with Ada.Text_IO;
with Words;
procedure Euler42 is
function Is_Triangular(I: Integer) return Boolean is
T: Integer := 1;
N: Integer := 2;
begin
while T <= I loop
if T = I then return True; end if;
T := T + N;
N := N + 1;
end loop;
return False;
end Is_Triangular;
begin
declare
List: Words.List := Words.Split(Ada.Text_IO.Get_Line);
Count: Natural := 0;
begin
for W of List loop
if Is_Triangular(Words.Score(W.all)) then
Count := Count + 1;
end if;
end loop;
Words.Free(List);
Ada.Integer_Text_IO.Put(Count);
end;
end Euler42;
|
src/Categories/Category/Complete/Finitely/Properties.agda | MirceaS/agda-categories | 0 | 8328 | <filename>src/Categories/Category/Complete/Finitely/Properties.agda
{-# OPTIONS --without-K --safe #-}
open import Categories.Category
open import Categories.Category.Complete.Finitely
module Categories.Category.Complete.Finitely.Properties {o ℓ e} {C : Category o ℓ e} (finite : FinitelyComplete C) where
open import Level using (Level)
open import Data.Nat using (ℕ)
open import Data.Product using (Σ; _,_; proj₁; ∃₂) renaming (_×_ to _&_)
open import Data.Fin
open import Data.Fin.Properties
open import Data.Sum using (inj₁; inj₂)
open import Data.List hiding ([_])
open import Data.List.Relation.Unary.Any as Any using (here; there)
open import Data.List.Relation.Unary.Any.Properties
open import Data.List.Relation.Unary.Unique.Propositional
open import Data.List.Membership.Propositional
open import Relation.Binary.PropositionalEquality as ≡ using (refl; _≡_; cong)
open import Function renaming (_∘_ to _∙_)
import Data.List.Relation.Unary.Unique.Propositional.Properties as Uₚ
import Data.List.Membership.Propositional.Properties as ∈ₚ
import Data.List.Membership.Setoid.Properties as S∈ₚ
open import Categories.Category
open import Categories.Category.Cartesian.Properties C
open import Categories.Category.Finite.Fin
open import Categories.Diagram.Equalizer C
open import Categories.Morphism.Reasoning C
open import Categories.Functor
import Categories.Category.Construction.Cones as Co
import Categories.Diagram.Limit as Lim
open FinitelyComplete finite
module GeneralProperties where
module _ {a} {A : Set a} where
concatMap-∈ : ∀ {b} {B : Set b} (f : A → List B) {l : List A} →
∀ {x y} → x ∈ l → y ∈ f x → y ∈ concatMap f l
concatMap-∈ f (here refl) y∈fx = ++⁺ˡ y∈fx
concatMap-∈ f (there {z} x∈l) y∈fx = ++⁺ʳ (f z) (concatMap-∈ f x∈l y∈fx)
module _ {a} {A : Set a} where
concatMap²-∈ : ∀ {m n} {ms : List (Fin m)} {ns : List (Fin n)}
(f : Fin m → Fin n → List A) →
∀ {x y k} → x ∈ ms → y ∈ ns → k ∈ f x y →
k ∈ concatMap (λ z → concatMap (λ w → f z w) ns) ms
concatMap²-∈ {m} {n} {ms} {ns} f {x} {y} {k} x∈ms y∈ns k∈fxy = concatMap-∈ _ x∈ms k∈ns
where k∈ns : k ∈ concatMap (λ w → f x w) ns
k∈ns = concatMap-∈ _ y∈ns k∈fxy
module _ {b} {B : Set b} where
concatMap²-map-∈ : ∀ {m n} {ms : List (Fin m)} {ns : List (Fin n)}
(f : Fin m → Fin n → List A) →
(g : A → B) →
∀ {x y k} → x ∈ ms → y ∈ ns → k ∈ f x y →
g k ∈ map g (concatMap (λ z → concatMap (λ w → f z w) ns) ms)
concatMap²-map-∈ f g x∈ms y∈ns k∈fxy = map⁺ (Any.map (cong g) (concatMap²-∈ f x∈ms y∈ns k∈fxy))
open GeneralProperties
open Prods cartesian
-- construct a finite limit from cartesian products and equalizer
--
-- c.f. Awodey 5.21
module _ (shape : FinCatShape) (F : Functor (FinCategory shape) C) where
private
module C = Category C
open C
open HomReasoning
S = FinCategory shape
open Co F
open Lim F
open FinCatShape shape using (size; ∣_⇒_∣; objects; morphisms; wrap-arr; Obj-UIP)
module S = Category S
module F = Functor F
obj∈-irr : ∀ {x} → (p q : x ∈ objects) → p ≡ q
obj∈-irr = S∈ₚ.unique⇒irrelevant (≡.setoid _) Obj-UIP (Uₚ.allFin⁺ size)
prods-gen : List (Fin size) → Obj
prods-gen ns = prod (map F.₀ ns)
prods : Obj
prods = prods-gen objects
cods : List Obj
cods = map (λ n → F.₀ (Arrow.cod n)) morphisms
arrs : Obj
arrs = prod cods
∈-objects : ∀ n → n ∈ objects
∈-objects n = ∈ₚ.∈-allFin n
Fn∈obj : ∀ n → F.₀ n ∈ map F.₀ objects
Fn∈obj n = ∈ₚ.∈-map⁺ F.₀ (∈-objects n)
π : ∀ n → prods ⇒ F.₀ n
π n = π[ Fn∈obj n ]
ϕ⇒ : ∀ (a : Arrow size ∣_⇒_∣) → prods ⇒ F.F₀ (Arrow.cod a)
ϕ⇒ a = π (Arrow.cod a)
ϕπ : prods ⇒ cods *
ϕπ = build-mors _ ϕ⇒ morphisms
ϕ : prods ⇒ arrs
ϕ = ⟨ ϕπ ⟩*
ψ⇒ : ∀ a → prods ⇒ F.F₀ (Arrow.cod a)
ψ⇒ a = F.₁ (Arrow.arr a) ∘ π (Arrow.dom a)
ψπ : prods ⇒ cods *
ψπ = build-mors _ ψ⇒ morphisms
ψ : prods ⇒ arrs
ψ = ⟨ ψπ ⟩*
∈-morphisms : ∀ {d c} (f : Fin ∣ d ⇒ c ∣) → record { arr = f } ∈ morphisms
∈-morphisms {d} {c} f = concatMap²-∈ (λ _ _ → tabulate wrap-arr) (∈-objects d) (∈-objects c) (∈ₚ.∈-tabulate⁺ f)
Fc∈cods : ∀ {d c} (f : Fin ∣ d ⇒ c ∣) → F.₀ c ∈ cods
Fc∈cods f = ∈ₚ.∈-map⁺ (λ a → F.₀ (Arrow.cod a)) (∈-morphisms f)
π′ : ∀ {d c} (f : Fin ∣ d ⇒ c ∣) → arrs ⇒ F.₀ c
π′ f = π[ Fc∈cods f ]
ψπ-proj : ∀ {d c} (f : Fin ∣ d ⇒ c ∣) →
F.₁ f ∘ π d ≈ π[ Fc∈cods f ] ∘ ψ
ψπ-proj f = build-proj (λ a → F.₀ (Arrow.cod a))
(λ a → F.₁ (Arrow.arr a) ∘ π (Arrow.dom a))
(∈-morphisms f)
ϕπ-proj : ∀ {d c} (f : Fin ∣ d ⇒ c ∣) →
π c ≈ π[ Fc∈cods f ] ∘ ϕ
ϕπ-proj f = build-proj (λ a → F.₀ (Arrow.cod a))
(λ a → π (Arrow.cod a))
(∈-morphisms f)
e⇒prods : Equalizer ψ ϕ
e⇒prods = equalizer ψ ϕ
module e⇒prods = Equalizer e⇒prods
open e⇒prods
⊤cone : Cone
⊤cone = record
{ N = obj
; apex = record
{ ψ = λ n → π n ∘ arr
; commute = λ {m n} f → begin
F.₁ f ∘ π m ∘ arr ≈⟨ pullˡ (ψπ-proj f) ⟩
(π′ f ∘ ψ) ∘ arr ≈⟨ pullʳ equality ⟩
π′ f ∘ ϕ ∘ arr ≈˘⟨ pushˡ (ϕπ-proj f) ⟩
π n ∘ arr ∎
}
}
module _ {K : Cone} where
private
module K = Cone K
N⇒* : K.N ⇒ map F.₀ objects *
N⇒* = build-mors F.₀ K.ψ objects
Kmor : K.N ⇒ prods
Kmor = ⟨ N⇒* ⟩*
ψ∘Kmor≈ϕ∘Kmor : ∀ a → ψ⇒ a ∘ Kmor ≈ ϕ⇒ a ∘ Kmor
ψ∘Kmor≈ϕ∘Kmor a = begin
ψ⇒ a ∘ Kmor ≈˘⟨ pushʳ (build-proj F.₀ K.ψ (∈-objects (Arrow.dom a))) ⟩
F.₁ (Arrow.arr a) ∘ K.ψ (Arrow.dom a) ≈⟨ K.commute (Arrow.arr a) ⟩
K.ψ (Arrow.cod a) ≈⟨ build-proj F.₀ K.ψ (∈-objects (Arrow.cod a)) ⟩
ϕ⇒ a ∘ Kmor ∎
equalize-eq : ψ ∘ Kmor ≈ ϕ ∘ Kmor
equalize-eq = begin
ψ ∘ Kmor ≈⟨ build-⟨⟩*∘ _ ψ⇒ Kmor morphisms ⟩
⟨ build-mors _ (λ a → ψ⇒ a ∘ Kmor) morphisms ⟩* ≈⟨ build-uniqueness* _ ψ∘Kmor≈ϕ∘Kmor morphisms ⟩
⟨ build-mors _ (λ a → ϕ⇒ a ∘ Kmor) morphisms ⟩* ≈˘⟨ build-⟨⟩*∘ _ ϕ⇒ Kmor morphisms ⟩
ϕ ∘ Kmor ∎
!cone : Cone⇒ K ⊤cone
!cone = record
{ arr = equalize equalize-eq
; commute = commute _
}
where commute : ∀ n → (π n ∘ arr) ∘ equalize equalize-eq ≈ K.ψ n
commute n = begin
(π n ∘ arr) ∘ equalize equalize-eq ≈˘⟨ pushʳ universal ⟩
π n ∘ Kmor ≈˘⟨ build-proj _ K.ψ (∈-objects n) ⟩
K.ψ n ∎
module _ {K : Cone} (f : Cones [ K , ⊤cone ]) where
private
module K = Cone K
module f = Cone⇒ f
!cone-unique : Cones [ !cone ≈ f ]
!cone-unique = begin
equalize equalize-eq ≈˘⟨ e⇒prods.unique eq ⟩
f.arr ∎
where eq″ : ∀ y → π y ∘ arr ∘ f.arr ≈ π y ∘ Kmor {K}
eq″ y = begin
π y ∘ arr ∘ f.arr ≈⟨ sym-assoc ⟩
(π y ∘ arr) ∘ f.arr ≈⟨ f.commute ⟩
K.ψ y ≈⟨ build-proj _ K.ψ (∈-objects y) ⟩
π y ∘ Kmor {K} ∎
eq′ : ∀ {y : Fin size} (y∈ys : y ∈ objects) →
π[ ∈ₚ.∈-map⁺ F.₀ y∈ys ] ∘ arr ∘ f.arr ≈ π[ ∈ₚ.∈-map⁺ F.₀ y∈ys ] ∘ Kmor {K}
eq′ {y} y∈ys with obj∈-irr y∈ys (∈-objects y)
... | refl = eq″ y
eq : Kmor {K} ≈ arr ∘ f.arr
eq = sym (uniqueness*′ F.₀ {K.N} {objects} eq′)
finiteLimit : Limit
finiteLimit = record
{ terminal = record
{ ⊤ = ⊤cone
; ! = !cone
; !-unique = !cone-unique
}
}
|
apps/breakfast/pde_fw/toast/examples/Assembly (CCE)/msp430x24x_hfxt2.asm | tp-freeforall/breakfast | 1 | 166930 | <filename>apps/breakfast/pde_fw/toast/examples/Assembly (CCE)/msp430x24x_hfxt2.asm<gh_stars>1-10
;*******************************************************************************
; MSP430x24x Demo - Basic Clock, MCLK Sourced from HF XTAL
;
; Description: Proper selection of an external HF XTAL for MCLK is shown by
; first polling the OSC fault until XTAL is stable - only then is MCLK
; sourced by LFXT1. MCLK/10 is on P1.1 driven by a software loop taking
; exactly 10 CPU cycles.
; ACLK = MCLK = LFXT1 = HF XTAL, SMCLK = default DCO ~1.025MHz
; //* HF XTAL NOT INSTALLED ON FET *//
; //* Min Vcc required varies with MCLK frequency - refer to datasheet *//
;
; MSP430F249
; -----------------
; /|\| XIN|-
; | | | HF XTAL (3 16MHz crystal or resonator)
; --|RST XOUT|-
; | |
; | P1.1|-->MCLK/10 = HFXTAL/10
; | P5.4/MCLK|-->MCLK = XT2 HFXTAL
;
; <NAME>
; Texas Instruments Inc.
; May 2008
; Built Code Composer Essentials: v3 FET
;*******************************************************************************
.cdecls C,LIST, "msp430x24x.h"
;-------------------------------------------------------------------------------
.text ;Program Start
;-------------------------------------------------------------------------------
RESET mov.w #0500h,SP ; Initialize stackpointer
StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT
SetupBC bic.b #XT2OFF,&BCSCTL1 ; Activate XT2 high freq xtal
bis.b #XT2S_2,&BCSCTL3 ; 3 16MHz crystal or resonator
SetupOsc bic.b #OFIFG,&IFG1 ; Clear OSC fault flag
mov.w #0FFh,R15 ; R15 = Delay
SetupOsc1 dec.w R15 ; Additional delay to ensure start
jnz SetupOsc1 ;
bit.b #OFIFG,&IFG1 ; OSC fault flag set?
jnz SetupOsc ; OSC Fault, clear flag again
bis.b #SELM_2, &BCSCTL2 ; MCLK = XT2 HF XTAL (safe)
bis.b #010h,&P5DIR ; P5.4 = output direction
bis.b #010h,&P5SEL ; P5.4 = ACLK function
bis.b #002h,&P1DIR ; P1.1 = output direction
Mainloop bis.b #002h,&P1OUT ; P1.1 = 1
bic.b #002h,&P1OUT ; P1.1 = 0
jmp Mainloop ; Repeat
;
;-------------------------------------------------------------------------------
; Interrupt Vectors
;-------------------------------------------------------------------------------
.sect ".reset" ; POR, ext. Reset
.short RESET
.end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.