mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Compare commits
3 Commits
hardsector
...
375/merge
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0457282d47 | ||
|
|
06d8609200 | ||
|
|
fa975b5511 |
@@ -1,42 +0,0 @@
|
||||
---
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: DontAlign
|
||||
AlignArrayOfStructures: Left
|
||||
AlignEscapedNewlines: Left
|
||||
AllowAllArgumentsOnNextLine: 'true'
|
||||
AllowAllConstructorInitializersOnNextLine: 'false'
|
||||
AllowAllParametersOfDeclarationOnNextLine: 'true'
|
||||
AllowShortBlocksOnASingleLine: 'true'
|
||||
AllowShortCaseLabelsOnASingleLine: 'false'
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLambdasOnASingleLine: None
|
||||
AllowShortLoopsOnASingleLine: 'false'
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: 'true'
|
||||
AlwaysBreakTemplateDeclarations: 'Yes'
|
||||
BinPackArguments: 'false'
|
||||
BinPackParameters: 'false'
|
||||
BreakConstructorInitializers: 'AfterColon'
|
||||
BreakBeforeBraces: Allman
|
||||
BreakInheritanceList: AfterColon
|
||||
BreakStringLiterals: 'true'
|
||||
IndentCaseLabels: 'true'
|
||||
IndentWidth: '4'
|
||||
ColumnLimit: '80'
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'
|
||||
IncludeBlocks: Preserve
|
||||
IndentWrappedFunctionNames: 'false'
|
||||
KeepEmptyLinesAtTheStartOfBlocks: 'true'
|
||||
PointerAlignment: Left
|
||||
ReflowComments: 'true'
|
||||
SortIncludes: 'false'
|
||||
SortUsingDeclarations: 'true'
|
||||
SpaceAfterTemplateKeyword: 'true'
|
||||
SpaceBeforeAssignmentOperators: 'true'
|
||||
SpaceBeforeCtorInitializerColon: 'false'
|
||||
SpaceBeforeInheritanceColon: 'true'
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceInEmptyParentheses: 'false'
|
||||
...
|
||||
15
.github/workflows/ccpp.yml
vendored
15
.github/workflows/ccpp.yml
vendored
@@ -10,7 +10,7 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 1
|
||||
- name: apt
|
||||
run: sudo apt update && sudo apt install libudev-dev libsqlite3-dev ninja-build protobuf-compiler libwxgtk3.0-gtk3-dev
|
||||
run: sudo apt update && sudo apt install libusb-1.0-0-dev libsqlite3-dev ninja-build protobuf-compiler
|
||||
- name: make
|
||||
run: make
|
||||
|
||||
@@ -21,7 +21,7 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 1
|
||||
- name: brew
|
||||
run: brew install sqlite pkg-config libusb ninja protobuf truncate wxwidgets
|
||||
run: brew install sqlite pkg-config libusb ninja protobuf truncate
|
||||
- name: make
|
||||
run: make
|
||||
|
||||
@@ -45,8 +45,6 @@ jobs:
|
||||
zip
|
||||
mingw-w64-i686-protobuf
|
||||
vim
|
||||
diffutils
|
||||
mingw-w64-i686-wxWidgets
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
fetch-depth: 1
|
||||
@@ -54,12 +52,3 @@ jobs:
|
||||
run: |
|
||||
make
|
||||
|
||||
- name: zip
|
||||
run: |
|
||||
zip -9 fluxengine.zip fluxengine.exe fluxengine-debug.exe fluxengine-gui.exe fluxengine-gui-debug.exe upgrade-flux-file.exe brother120tool.exe brother240tool.exe FluxEngine.cydsn/CortexM3/ARM_GCC_541/Release/FluxEngine.hex
|
||||
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{ github.event.repository.name }}.${{ github.sha }}
|
||||
path: fluxengine.zip
|
||||
|
||||
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
@@ -26,8 +26,6 @@ jobs:
|
||||
zip
|
||||
mingw-w64-i686-protobuf
|
||||
vim
|
||||
diffutils
|
||||
mingw-w64-i686-wxWidgets
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 1
|
||||
@@ -36,7 +34,7 @@ jobs:
|
||||
make
|
||||
- name: zip
|
||||
run: |
|
||||
zip -9 fluxengine.zip fluxengine.exe fluxengine-gui.exe upgrade-flux-file.exe brother120tool.exe brother240tool.exe FluxEngine.cydsn/CortexM3/ARM_GCC_541/Release/FluxEngine.hex
|
||||
zip -9 fluxengine.zip fluxengine.exe brother120tool.exe brother240tool.exe FluxEngine.cydsn/CortexM3/ARM_GCC_541/Release/FluxEngine.hex
|
||||
- name: date
|
||||
run: |
|
||||
echo "RELEASE_DATE=$(date --rfc-3339=date)" >> ${GITHUB_ENV}
|
||||
|
||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1,9 +1,2 @@
|
||||
.obj
|
||||
.project
|
||||
/.ninja*
|
||||
/brother120tool
|
||||
/brother240tool
|
||||
/fluxengine
|
||||
/brother120tool-*
|
||||
/brother240tool-*
|
||||
/fluxengine-*
|
||||
|
||||
@@ -1,249 +1,249 @@
|
||||
:4000000000800020110000009D1000009D100000064A08B5136843F020031360044B1A6803F53F5302331A6001F056F8E8460040FA46004010B5054C237833B9044B13B17D
|
||||
:400040000448AFF300800123237010BD6881FF1F00000000E8380000084B10B51BB108490848AFF300800848036803B910BD074B002BFBD0BDE81040184700BF0000000021
|
||||
:400080006C81FF1FE8380000C880FF1F000000000A4A0B4B116801310B40002BBEBF03F1FF3363F03F030133136011685368994202BF024B01221A72704700BF8881FF1F9C
|
||||
:4000000000800020110000004110000041100000064A08B5136843F020031360044B1A6803F53F5302331A6001F028F8E8460040FA46004010B5054C237833B9044B13B163
|
||||
:400040000448AFF300800123237010BD6881FF1F00000000C8380000084B10B51BB108490848AFF300800848036803B910BD074B002BFBD0BDE81040184700BF0000000041
|
||||
:400080006C81FF1FC8380000C880FF1F000000000A4A0B4B116801310B40002BBEBF03F1FF3363F03F030133136011685368994202BF024B01221A72704700BF8881FF1FBC
|
||||
:4000C0003F0000800A4A0B4B516801310B40002BBEBF03F1FF3363F03F030133536051681368994202BF024B01221A72704700BF8881FF1F3F000080114BDA68196919B9FD
|
||||
:4001000001221A75597514E09969521A19698A4294BF587D00201875187D094908B1002204E0086982428CBF002201224A75DA689A611B7D13B1002002F056B9704700BF60
|
||||
:400140008881FF1F10B5C4B2204601F087F90128FAD110BD08B572B60F4B0F49DA680132DA60DA690132C82A08BF0022DA611A6AD8690132A72A08BF00220A621B6A002BE5
|
||||
:400180000CBF02230023002814BF184643F0010002F092FE62B608BD8881FF1F38B50446C5B2284602F0C2F8062002F0DFFA44F00200C0B202F0BAF8062002F0D7FA2846BD
|
||||
:4001C00002F0B4F8BDE83840062002F0B9BA10B5642402F0A5F828B9FFF7E0FF013CF8D1204610BD012010BD70B5C4B2054620460E4601F033F9012805D0204601F04CFAA8
|
||||
:400200002846FFF79FFF204601F030F9314605460246204601F0ECF9204601F01FF90028FAD1284670BD000038B5044D0024285D013402F04BFA402CF9D138BDAC81FF1F30
|
||||
:4002400008B502F065FC002002F06EFC02F080FC02F08AFC80B208BD10B50446012002F07DF8642002F06CFAFFF7EAFF2080002002F074F8642002F063FAFFF7E1FF60801C
|
||||
:4002800010BD08B502F070FD002002F079FD02F08BFD02F095FD80B208BD10B50446FFF796FF322002F04CFAFFF7EBFF20800120FFF774FF322002F043FAFFF7E2FF608072
|
||||
:4002C00010BD0FB400B593B014AB53F8042B402102A8019302F0F0FE02A802F08CF802F096F813B05DF804EB04B0704710B5044601780648FFF7E5FF0420FFF723FF6278E6
|
||||
:400300002146BDE81040042001F000B9043A000007B50023ADF804308DF80600032301A88DF80530FFF7E2FF03B05DF804FB000010B5074C94F8643043B1002001F0EAFF85
|
||||
:40034000002002F07DFD002384F8643010BD00BF8881FF1F38B5124D837895F8672004469A4204D0FFF7E4FF002385F86A302368C5F8653022790B4B1A71A378002B14BF31
|
||||
:400380000220012002F05CFDE078B0FA80F0400902F050FD2079BDE8384002F087BD00BF8881FF1FED81FF1F38B50D4C94F8645065B904F16500FFF7CDFF012001F0AAFFDC
|
||||
:4003C0004FF47A7002F0BCF984F86A50E368E366012384F86430BDE8384002F0EFB900BF8881FF1FF8B5214C0546FFF7DDFF94F86A3003B15DB91E48FFF763FFFFF7E7FECE
|
||||
:400400000120002384F86A00236702F0AFF92A46216F1848FFF755FF144E0027236F9D4216D001F07DFF00B13767236F9D4205DD0120FFF7B3FE336F013305E005DA002053
|
||||
:40044000FFF7ACFE336F013B336702F0B7F9E5E7322002F075F92A2DCCBF0020012002F031FDBDE8F8400448FFF72BBF8881FF1F113A0000183A0000353A00002DE9F04F70
|
||||
:4004800099B062B602F004FA9E49042002F028FA9D4801F051FF9D4802F0F4FC9C4801F085FF02F0D5FB02F0A7FA002002F0C8FC01F0A0FF0221002000F086FF954C012011
|
||||
:4004C00001F0FEF8002384F86730FFF76DFFFFF77EFE84F87400FFF72BFF012384F86730FFF762FFFFF773FE84F87500FFF720FF894B94F87400894994F875202546002AA4
|
||||
:4005000014BF0A461A46002808BF19468448FFF7D8FE0321084602F031F9264602F04EF994F8643043B1EA6EEB689B1A41F28832934201D9FFF7FCFE00F07EFF18B9794820
|
||||
:40054000FFF7BFFE04E000F07DFF0028F7D10BE000F072FF10B902F031F9F9E77248FFF7B0FE032001F098F8032000F077FF0128D4D16E48FFF7EEFE6D490320FFF734FE85
|
||||
:4005800094F876106B48FFF79CFE94F87630023B142B00F2D683DFE813F01500D4031E00D4032400D4035000D4037600D403D900D403C101D4030803D4032C03D40333036C
|
||||
:4005C000D4034D0303238DF820308DF8213010238DF822302AE394F87800FFF703FF564B21E340F2DC57FFF7DFFE00232375E068227D02F0FF012AB9EB681B1ABB42F7DD43
|
||||
:400600000B4611E083B10022174696F87810F068277594F814E0BEF1000F02D1EB681B1AF7E701329142F3DA07228DF8202004228DF82120ADF82230F8E20220FFF782FD2F
|
||||
:400640004FF000080DF1200A02F0B8F84FF480790027C9EB0803DA1907F80A200137402FF9D10220FFF76EFD3A465146022000F04DFFB9F10109EBD108F10108B8F1400F58
|
||||
:40068000E2D12E4B38E04FF0010A4FF000080DF1200B02F093F84FF0000959460120FFF7A3FD08EB090300270493049B1BF807203B44DBB29A4209D08DE80C0041463B4641
|
||||
:4006C0004A461F48FFF7FDFD4FF0000A0137402FEBD109F10109B9F5807FDED108F10108B8F1400FD5D151461648FFF7EAFDBAF1000F00F01B81144B1B8807A8ADF81C30AD
|
||||
:4007000095E200BF55010000F900000091000000C50000008881FF1F473A0000433A00004A3A0000623A0000753A0000ED81FF1FFE81FF1F7F3A0000EC380000EE380000BE
|
||||
:400740008E3A0000AA3A0000F0380000206FFFF749FE94F8780001F001FE94F8780001F0E5FD02F015FCB94BDFF8FC821A78002702F0FB021A701A7842F001021A701A789D
|
||||
:4007800002F0FE021A701A7802F0FE021A7002F003FC0220FFF7D6FC012141F6FF734FF48042084602F052FB84F8B60001F074FF08F807000137402FF8D1DFF8B0A200271A
|
||||
:4007C0000AF195091FFA89F80137402F14BF3A4600221AF8010F2244062392F82420402101F08EFF424646F24B419AF8000001F099FF08F14008402F1FFA88F8E4D196F859
|
||||
:40080000793053B196F87C30336100233375237D002BFCD000233375336100234FF0FF32236062602372236894F8B600234493F8241001F0E9FE94F8B60001F0A7FE01214A
|
||||
:4008400094F8B60001F07AFE2368002BFCD0002398467360D6F80CA0012701F0AFFFE368B4F87A20CAEB030393420DD367B1042195F8B60001F0D4FE94F8B60001F0E0FEE1
|
||||
:400880000028F9D107463072237AFBB96A682B689A4202D1002FE0D118E00220FFF752FC6968402209EB8111022000F02FFE6A68674B01321340002BBEBF03F1FF3363F091
|
||||
:4008C0003F03013308F101086360C6E70220277AFFF738FC00221146022000F017FE0220FFF730FCFFB2FFF79FFC002001F01EFD37B15848FFF7E5FC0220FFF709FD06E06E
|
||||
:40090000554B08A81B88ADF82030FFF7EFFC227D4146237A5148FFF7D4FC15E25048FFF7D0FCD4F87A7017F03F0701D0032009E2286FFFF757FD95F8780001F00FFD95F829
|
||||
:40094000780001F0F3FC012001F00EFD02F020FB444BDFF814811A7842F004021A701A7842F001021A701A7802F0FE021A701A7802F0FE021A7002F00FFB01214FF4804315
|
||||
:4009800041F6FF72084601F0F5FC85F8B60001F083FE08F807000137402FF8D1DFF8CC90002709F195031FFA83F804930137402F14BF3A46002219F8010F2244052392F8D7
|
||||
:4009C0002420402101F09CFE414646F2495299F8000001F0A7FE08F14008402F1FFA88F8E4D100274FF0FF33376098467360BB463B46D6F87A9037725FEA99190CBF4FF060
|
||||
:400A0000010A4FF0000A2168114A01310A40002ABCBF02F1FF3262F03F026068B8BF013282426FD02BB1227A002A7AD12A7D002A77D12068049A059302EB8010BAF1000F36
|
||||
:400A400016D040223F2102F003FB1CE09B6400403F000080B43A0000F2380000CE3A0000E13A000099650040AC81FF1FAB81FF1F014601370120FFF7B7FBC7EB0903D3F10C
|
||||
:400A8000000A4AEB030A2168B34A01310A40002ABEBF02F1FF3262F03F02013222606268059B01322ED12A683F2A2BD14FF00008C5F8048001F08CFC85F808806B6895F8DC
|
||||
:400AC000B6002B4493F8241001F09EFD95F8B60001F05CFD012195F8B60001F02FFD95F87E302B6185F81480237D002BFCD04FF00008012086F8148001F076FC404601F0B4
|
||||
:400B000033FC00E023B1237A5BB92B7D4BB90123626842453FF477AF0BF1010BD5F8048071E701F05BFC012001F01EFC002001F05BFC042194F8B60001F072FD94F8B60011
|
||||
:400B400001F07EFD80460028F8D196F8B60001F00BFD337D327A0293012303920193CDF800A05B463A4649467C48FFF7AAFBC6F81080BAF1000F0BD0FFF756FB002001F028
|
||||
:400B8000D5FB237A63B17648FFF79BFB0220D9E0B945F1D073490120FFF726FB0137F7E77148FFF78EFB714B3DE094F8780001F0D5FB206FFFF716FC6D48FFF782FB94F8A5
|
||||
:400BC0007930236100232375237D002BFCD0012001F00AFC00233375237D002BFCD0002001F002FC002363483361FFF76AFB624B19E0002084F86A00FFF7F4FB5F4B12E003
|
||||
:400C000094F8743023B195F875200AB985F8782094F875201AB113B9012385F878305848FFF798FB574B1B88ADF8203008A8FFF75DFB89E0FFF77CFB02F088F8002002F0FA
|
||||
:400C40002BF82A2701F056FF002001F0F9FE3A46002108A802F0FCF917238DF820308DF8217001F0ABFD002001F054FB002002F0E7F8C82001F064FD0DF12200FFF7ECFA35
|
||||
:400C80000DF13600FFF709FB01F098FD012002F0D7F8322001F054FD0DF12600FFF7DCFA0DF13A00FFF7F9FA012001F033FB4FF4967001F045FD01F081FD0DF12E00FFF7AC
|
||||
:400CC000CBFA0DF14200FFF7E8FA002001F022FB4FF4967001F034FD01F070FD022002F0AFF8322001F02CFD0DEB0700FFF7B4FA0DF13E00FFF7D1FA012001F00BFB4FF4FE
|
||||
:400D0000967001F01DFD01F059FD0DF13200FFF7A3FA0DF14600FFF7C0FA002001F0FAFA4FF4967001F00CFD01F048FD002002F087F8002384F86A3001F08AFF01F05CFE97
|
||||
:400D400074E70120FFF7E4FA032000F0A5FC0E48FFF7B7FAFFF7E2BB3F000080EB3A00001B3B00004092FF1F253B0000F43800002D3B00003B3B0000F6380000F8380000ED
|
||||
:400D8000FE81FF1FFA380000483B00000F4B1A78120616D55878C0B2012814D11B79DBB2042B02D0052B05D07047094A094B5A60282203E0084A074B5A60E0221A8000F04C
|
||||
:400DC00045BE002070470120704700BF00600040FC380000C492FF1F243900002DE9F04172B68A4B61221A70A3F5F06301221A801924874A9C7092E803008033062283F8F7
|
||||
:400E0000002283E80300522203F580731A70814B814A1B78814EDBB2137040F61802804B00251A8041F2512223F8022C33784FF4F07003F0010343EA450502F0A1F8013CE3
|
||||
:400E400005F003052ED0032DF0D1764B4FF480721A8007221A70744A002548211570917002221D705D7103F8032C0422DA716F4A6F4C13786F4E43F00103137012F8013C9A
|
||||
:400E8000062743F0030302F8013C2378012243F0800323705D4B1A70674A137843F02003137000E0FEE707FB056300219A881868013502F0CDF8072DF5D16048604E0025F3
|
||||
:400EC00050F8041F05F1105303F14A0221F0FF074B33C9B20B4452005B0002329A4206D012F802EC12F801CC0EF807C0F5E7B0420D44E5D1534A00231360936013619361FD
|
||||
:400F0000514B524F1A68524BDFF88C811A60514B1A6803F1784303F5D6431A604E4A137843F002031370137C43F0020313742378A2F5863243F040032370413A137843F047
|
||||
:400F400010031370454A464B07CA03C31A80454A2833106843F8250C127903F8212C424A07CA03C31A80414AE83B07CA03C31A803F4A083307CA03C31A803E4A3E4BA2F5B0
|
||||
:400F8000616203CBC2F8100EC2F8141E1378042043F008031370394B02F5AA521B783D78DBB298F80060EDB203F007010C321B091170F6B2537045F003033B7046F0030326
|
||||
:400FC00088F800302E4B48221A702E4A402313702D49937013729372082382F81F3220220A7048710A72294A0A20137001F0BEFB274B88F8006044223D70264D1A7094E8E4
|
||||
:401000000F0007C52B80BDE8F08100BF004800401C0B00480F010049A146004025420040224200400440004006400040A2430040A04300404D3B0000E8460040FCFFFF470A
|
||||
:401040009000004800760040240B0048F846004020760040280B004803500140DC0A0048C0510040E80A0048F00A0048FC0A0048080B004832510040140B0048CF01004921
|
||||
:401080001D51004001590040235B0040585B004076580040B0430040F946004008B501F0ABFF03680C2B00D1FEE7FEE7084908B50B68084A1844821A802A01DC086005E043
|
||||
:4010C00001F09AFF0C2303604FF0FF33184608BDCC80FF1F9093FF1F80B51148114B0025C0B1A3F1100192C922460439161BB74204D051F8046F42F8046BF7E7114653F88D
|
||||
:40110000046C8C1AA64202D041F8045BF9E701381033E5E701F076FFFFF7B0F9FEE700BF01000000E03C0000124A134B10B51A60124A134C1368134843F40073136000238F
|
||||
:40114000032B98BF54F823204FEA830188BF0E4A0133302B4250F3D10C4B1A780C4B1A700C4B084A1A60FFF739FEBDE8104001F0CFB900BF0004FA050CED00E014ED00E016
|
||||
:40118000000000000080FF1F9D100000BC760040C080FF1F08ED00E0F8B501F0F9FE4B4A01271378022643F001031370137C484C43F001031374474B02F5E3521F700B3215
|
||||
:4011C00003F8946C1378054603F07F031370002001F0CCFA2378404A03F0F90323701378384603F0DF03137023783B43237001F0BDFA282001F0BAFA384B30461A7802F089
|
||||
:401200007F021A701A7802F0BF021A7023783343237001F0ABFA2378314A43F0040323700023137053702F4AFF2199540133092BFBD1284601F0B0FE0721172001F0DEFA5F
|
||||
:401240002949172001F0CCFA0721182001F0D6FA2649182001F0C4FA0721152001F0CEFA2349152001F0BCFA0721052001F0C6FA2049052001F0B4FA0721062001F0BEFA17
|
||||
:401280001D49062001F0ACFA0721084601F0B6FA1A49072001F0A4FA0721082001F0AEFA1749082001F09CFA0021162001F0A6FA1449162001F094FA07210C2001F09EFA0C
|
||||
:4012C000BDE8F84010490C2001F08ABAA5430040944300409D60004012600040F851004084600040B592FF1F671B0000A1190000651B0000991A0000C51A0000F51A0000BA
|
||||
:401300002D1B00006D1B0000E11B0000214B224A10B5187000231370204A40201370204A0F2413701F4A13701F4A13701F4A13701F4A13701F4B4FF400021A604FF080729F
|
||||
:401340001A604FF400121A6020221A601860802018604FF480701860174804704FF480001860164B1A70933B19B91A7802F0FE0202E01A7842F001021A70114B03221A70D2
|
||||
:40138000802203F8202C012001F0FAFD0D4B04221A7010BDD092FF1FD692FF1FD492FF1FD592FF1FD192FF1FC092FF1FD392FF1F4893FF1F00E100E09E6000409C600040AF
|
||||
:4013C000286000401260004070B5074C054623780E461BB9FFF7E0FE0123237031462846BDE87040FFF792BF8092FF1F0A4A002313700A4A13700A4A13700A4A13700A4ADE
|
||||
:4014000013700A4A13700A4A13700A4B03221A70802203F8202C7047D692FF1FD492FF1FD592FF1FD192FF1FC092FF1FD392FF1F4893FF1F28600040014B1878704700BFC1
|
||||
:40144000D592FF1F044B1A7802F0FF001AB118780022C0B21A707047D492FF1F024A0C2303FB002040787047DC92FF1F431E072B0CD8074A064B00010344805C5B7800F0CD
|
||||
:401480000F0043EA0020023880B2704700207047FC5F00401A4A38B50C2303FB00231B79090C13F0800F00F1FF35044619BF8AB24FF480438BB24FF48042032D18D8DFE8AD
|
||||
:4014C00005F002070C110021084600F0FDFF0DE00021084600F0DCFF08E00021084600F0BBFF03E00021084600F09AFF054B1855EDB2072D03D801F0CFF8034B185538BDA0
|
||||
:40150000DC92FF1FAC92FF1FB592FF1F431E072B2DE9F0470446894615465CD82F4F0C2202FB0072D388DFF8B8A09BB2C3F500739D424FF00C0303FB007388BFD588DB7824
|
||||
:4015400084BFC5F50075ADB2254A43EA15230601B354B244EBB28AF80130224B1A5C9846FF2A01D1FFF796FF0C2303FB047200215170B9F1000F28D03DB31B4F385D00F016
|
||||
:40158000F3FF11232946FE2218F8040001F0B8F806F5C04278321FFA89F118F8040001F0C1F8124D18F80410385D01F02DF80121385D00F0C3FF735D43F002037355735D92
|
||||
:4015C00003F0FD037355BDE8F08703FB04746379DBB28AF80230BDE8F08700BFDC92FF1FFC5F0040B592FF1FAC92FF1F706000402DE9F047044615468846002940D0431E54
|
||||
:40160000072B3FD8FFF732FFA84203D22046FFF72DFF05461D4E335DFF2B03D141462046FFF738FFDFF868A027011AF8040000F09BFF1223FE222946305D01F061F807F557
|
||||
:40164000C0411FFA88F27831305D01F06BF8DFF84490315D1AF8040000F0D6FF01211AF8040000F06BFF17F8093043F0020307F8093017F8093003F0FD0307F8093002E099
|
||||
:401680000D4600E000252846BDE8F087B592FF1FAC92FF1F70600040431E072B0AD8064A0C2303FB002300225A705A79034BD2B200011A54704700BFDC92FF1FFE5F0040C3
|
||||
:4016C000431E072B9FBF024B000108221A547047FE5F004030B51A4A1A491B4D0878138803449BB21380194A00231488D8B2A4B27CB1082B0CD050680078C0B2E854506895
|
||||
:401700000133013050601088013880B21080ECE718460B780E4C082B0E4A00D040B10E4D2B7883F080032B700F232370022301E0022323701370094B1870087030BD00BF12
|
||||
:401740004C93FF1F4893FF1F00600040C492FF1FC192FF1FD692FF1FD292FF1F4993FF1F074B02221A70074B80221A70064B0F221A70064A00231370054A012013707047C2
|
||||
:40178000D692FF1FD292FF1FC192FF1F4893FF1F4993FF1F30B5164B16491B780A8803F00F03023BDBB21A4492B20A80124C134A0020118889B279B173B15568215C013B85
|
||||
:4017C000C9B229705168DBB20131516011880130013989B21180ECE7094A1370094A137883F080031370084B0B221A7030BD00BF296000404C93FF1F00600040C492FF1F4C
|
||||
:401800004993FF1FD292FF1FC192FF1F064A06231370064A01201370054B80221A70054B00221A70704700BFD692FF1FC192FF1FD292FF1F4993FF1F054B9A683AB19A682B
|
||||
:40184000044910709A680988518000229A607047C492FF1F4C93FF1F08B5124B1A78D2B21A701B78DBB21A0602D50F4A137008BD0220FFF7E1FF0D4B1B7803F06003202BFD
|
||||
:4018800005D0402B06D043B900F012FC04E001F087FB01E0FFF77AFA10B9034B03221A7008BD00BF28600040C192FF1F0060004008B5084A084B0120197813880B449BB208
|
||||
:4018C0001380064B00221A70FFF7B6FF044B03221A7008BD4C93FF1F4893FF1FD692FF1FC192FF1F08B50C4B1B78DBB2042B07D0062B09D0022B0DD1BDE80840FFF7D8BF34
|
||||
:40190000BDE80840FFF746BF0320FFF795FF034B03221A7008BD00BFD692FF1FC192FF1F08B5054B002201201A70FFF785FF034B03221A7008BD00BFD692FF1FC192FF1FCE
|
||||
:4019400008B50A4B1A7832B11A78094942F080020A7000221A70074B002201201A70FFF76BFF054B03221A7008BD00BFC092FF1F08600040D692FF1FC192FF1F074B1B782C
|
||||
:40198000DBB2042B05D0062B05D0022B05D1FFF7A1BEFFF7C5BFFFF7D3BF7047D692FF1F38B51D4C2378DBB2DD0634D518060AD503F00F03012B2ED1FFF74EFF174B1B782A
|
||||
:4019C000190609D538BD5A0602D5FFF7D7FF03E09D0620D5FFF786FF23781B061BD4104B1A78104B1B7813430F4A13701278934211D10A4A0849154613782078DBB200064D
|
||||
:401A000005D41378DBB20B700B7803F00F0328788342F1D138BD38BD28600040C192FF1FD292FF1F4993FF1F29600040054A00231380054A916819B191680B7092685380CB
|
||||
:401A4000704700BF4C93FF1FC492FF1F0E4808B503889BB213B9FFF783FE13E00B4B02221A700B4B00221A70FFF7E0FF094AD1799379028843EA012392B2934238BF03806C
|
||||
:401A8000FFF728FE012008BDC492FF1FD692FF1FD292FF1F00600040084B01221A700F3B9B7C074B1A7B02F00302012A1EBFDA7B82F08002DA7301225A7370470B600040D9
|
||||
:401AC000DC92FF1F094B02221A700F3B93F82230074B1A7E02F00302012A1EBFDA7E82F08002DA7601225A76704700BF0B600040DC92FF1F0B4B04221A700F3B93F83230CF
|
||||
:401B0000094B93F8242002F00302012A1EBF93F8272082F0800283F82720012283F82520704700BF0B600040DC92FF1F0B4B08221A700F3B93F84230094B93F8302002F0F9
|
||||
:401B40000302012A1EBF93F8332082F0800283F83320012283F83120704700BF0B600040DC92FF1F7047FFF741BC0000F0B5184B184E19780C27C9B201234FF0000C31B372
|
||||
:401B8000CA0720D5144A4FEA031E7244947850782040C5070DD507FB03652C79240608D5147804F0FE0414706D790C4CEDB204F80E50840706D507FB036425792D0658BF05
|
||||
:401BC00084F801C090700133DBB24908D7E7F0BD9F600040DC92FF1F70600040FE5F004000F08EBC70B50446184B88B003AA03F11006154618685968083303C5B3422A46B4
|
||||
:401C0000F7D11B782B70FCB12223237001AD03232846637000F06CFE002220461146AB5C08AC04EB131414F8144C03F00F03847008AC234413F8143C0132082AC170037125
|
||||
:401C4000417100F10400EAD108B070BD773B00002DE9F0431C4D01222E460C201F274FF0800E4FF0080C194B00FB02581401234418705F70164998F805902144B9F1000F62
|
||||
:401C800007D098F8044024064CBF887081F802C001E081F802E000FB0261CC880132E4B29C71CC88092AC4F30724DC71CC88E4B21C71C988C1F307215971D4D1054BFF2213
|
||||
:401CC0001A70BDE8F08300BFDC92FF1F70600040FC5F00400A600040064B074A1B7802EBC30253681A7C824286BF03EBC003586900207047D092FF1F9C3B00002DE9F84F64
|
||||
:401D0000424B1A78002A7ED01878414D0138C0B2FFF7E2FFA8463F4AC3681478007ADFF800C1E4B203EBC0000C2600274FF0010E834268D01A78A24263D11CF80420597891
|
||||
:401D400091425ED19A7893F8039002F07F0206FB02FA05EB0A01CF7093F802B009F0030981F804B093F803B005F80AB0B3F804A0A1F808A093F902A0BAF1000F0BDAB9F11C
|
||||
:401D8000010F0CBF4FF007094FF00D0981F8059081F801E009E0B9F1010F0CBF4FF005094FF0090981F805904F704FEA02191A4906FB0282494481F802E0B2F808A0CAF330
|
||||
:401DC000072A81F800A0B2F808A05FFA8AFA81F801A0B2F806A011495FFA8AFA494481F806A0B2F80690C9F3072981F80790B2F806905FFA89F981F80490D288C2F3072281
|
||||
:401E00004A71083394E7BDE8F88F00BFD592FF1FDC92FF1FD192FF1FFC5F004070600040C292FF1F08B5064B18780138C0B2FFF753FF20B143681B7900EBC300406908BDDA
|
||||
:401E4000D592FF1F00212DE9F84F0B464E4E0C2707FB01F401313219092933554FF000059370494CD3701381937253705371EFD118B1464B1D70464B1D70464B1A78002AC0
|
||||
:401E80007FD0187801250138C0B2FFF725FFA8464368DFF8F8E0DB790C2713F0400F3E4B4FF0000C1A7814BF42F0010202F0FE021A70027AD20007FB0541C36803EB020993
|
||||
:401EC0004B4531D093F802A00AF07F06AE4229D10E89B3F804B0B6B25E4538BFA1F808B01E7893F801B01EF80660B3451AD181F804A0DE780E7093F902A0DE78BAF1000F12
|
||||
:401F000006F0030607DA012E0CBF07260D264E7181F8018006E0012E0CBF052609264E7181F801C00833CBE70135092DC3D1C1680A328B1C0A440C200833934209D013F814
|
||||
:401F4000081C13F80A5C01F07F0100FB01418D72F2E7FFF767FF114B0121186000230C2000FB0142D3801289013113449BB203F00102134409299BB2F2D1BDE8F84FFFF732
|
||||
:401F800067BEBDE8F88F00BFDC92FF1FC292FF1F4A93FF1FD592FF1FD392FF1FD892FF1F114B1B7903F07F035A1E072A19D80F490C2202FB031291781B0141F00101917098
|
||||
:401FC0000021D170517841F002015170127912F0800F074A1A4414BF8D2389239370FFF715BC0020704700BF00600040DC92FF1FFC5F004030B4194B1A7902F07F02531EE1
|
||||
:40200000072B27D8164B0C2404FB02339978154D01F0FE0199700021D97029461201505D114400F07F0050555A7802F0FD025A701A795B78120605D5012B01D18C7006E077
|
||||
:402040000D2303E0012B0CBF082309238B7030BCFFF7DCBB002030BC704700BF00600040DC92FF1FFC5F004010B50D4B0D4C21791878C9B20138C0B2FFF72EFE43681B791B
|
||||
:402080008B4201D2012909D8074A0848535CDBB24354A3780120DBB2535410BD002010BDD592FF1F00600040C292FF1F4A93FF1F38B5874A874C13780021DBB221801806BC
|
||||
:4020C000517840F188800A2900F20081DFE811F05800FE00FE00FE00FE00FE000B00FE007900FE007D00D3787949012B09D17A4B1A787A4B03EBC2035B685B6863601223C5
|
||||
:4021000010E0CB78022B12D18878FFF7E5FD002800F0DC80436863606368DA7863689B7843EA02232380BDE83840FFF78FBCCB78032B21D16A4B00228878D5B2854203D3F6
|
||||
:40214000634A92783AB910E0187801320028F7D018780344F0E75E4A62499278097C914203D16148FFF73EFD5F4B1A78002A00F0AD801A78228018E0BDE8384000F010BF77
|
||||
:4021800013F0030313D0022B40F0A0802380504B0C211B7903F07F02544B01FB02339A78534BD2B21A7000225A706360BBE702222280504A11784E4AC9B211705370626062
|
||||
:4021C000B1E7012323804C4BEFE70123238013794A4A1344E9E701390A2977D8DFE801F037764F76067676760A7620009378444ADBB25AE0937803F0FF0153B93E4B1A7892
|
||||
:4022000091425FD019703F4B01201870FFF71AFE58E0481EC0B2FFF75FFD0028EED155E0FFF722FF002851D0294A374913791279DBB2D2B20A70354A3049D25CCB5C9A4236
|
||||
:4022400040D0304B01221A70FFF758FD3AE003F00303012B2BD009D3022B37D11C4B9B78002B33D1BDE83840FFF7C4BE184B9B78012B2BD11F4A137803F0FD0315E003F0E5
|
||||
:402280000303012B13D008D3022B1FD1104B9B78E3B9BDE83840FFF783BE0D4B9B78012B14D1144A137843F0020313700AE0084B1A795AB998781B791549DBB2CA5C22EAEF
|
||||
:4022C0000002CA54BDE83840FFF7A0BA002038BD00600040C492FF1FD092FF1F9C3B0000003C0000733C00006893FF1FDC92FF1F8192FF1FD392FF1FD592FF1FC292FF1F96
|
||||
:40230000C092FF1FD492FF1FD192FF1F4A93FF1FD792FF1F014B1870704700BF78650040014B1878704700BF6C640040014B1870704700BF78640040064A0123136002F698
|
||||
:4023400088321268E0211064034A1170A2F540721360704780E100E000E400E0014B1870704700BF7A650040014B1870704700BF7F64004073B515461E460B4C0523002210
|
||||
:40238000019200920A4601461846237000F064F932462946207800F01FF90221207800F009F9207802B070BDD080FF1F064A0423136002F688321268E0219064034A117031
|
||||
:4023C000A2F202321360704780E100E002E400E0014B04221A60704700E100E0014B04221A60704780E100E0014B1870704700BF7E640040704738B505460078012428B1CB
|
||||
:4024000000F066FD285D0134E4B2F8E738BD08B50D2000F05DFDBDE808400A2000F058BDF7B516461F460B4C00230325019300930A4601462846257000F00EF93A46314617
|
||||
:40244000207800F0C9F80221207800F0B3F8207803B0F0BDE080FF1FF7B516461F460B4C00230225019300930A4601462846257000F0F2F83A463146207800F0ADF829460B
|
||||
:40248000207800F097F8207803B0F0BDE180FF1FF7B516461F460B4C00230125019300930A4601462846257000F0D6F83A463146207800F091F80221207800F07BF8207844
|
||||
:4024C00003B0F0BDE280FF1F73B515461E460B4C0023019300930A4601461846237000F0BBF832462946207800F076F80221207800F060F8207802B070BD00BFE380FF1FB2
|
||||
:40250000024B1878C0F38010704700BF8F450040074A7F23802113705170064A013BDBB202F80839002BF9D1034A1370704700BFE480FF1FF87B00400078004017280FD877
|
||||
:40254000084B0001C25C11B142F0200201E002F0DF02C254C25C42F00102C25400207047012070471070004017280BD8064B0001C25C02F0FE02C254C25C02F0DF02C25490
|
||||
:4025800000207047012070471070004017280DD8074900010B4603441A7942F004021A71435C43F00103435400207047012070471070004017280BD8064A0001835C4900D2
|
||||
:4025C00003F0F10301F00E011943815400207047012070471070004041F6FF73994208BF4FF400519A4208BF4FF4005217289FBFC00000F1804000F5EC4081809ABFC28072
|
||||
:40260000002001207047000017289FBF034B00011954002088BF0120704700BF1970004017289FBF054B00011A5C01F007019DBF1143195400200120704700BF147000408D
|
||||
:4026400017289FBF034B0001185C00F0070088BFFF20704714700040172810B51AD8C00001F07F0100F1804441EAC21204F5EC44D2B222709DF8082003F00F0343EA021304
|
||||
:40268000DBB263709DF80C30002003F00F03A370E07010BD012010BD10B500F079FC0A4A5378182B0AD91478013B5370E30003F1804303F5F0431B78137000E0FF2400F0DE
|
||||
:4026C0006BFC204610BD00BFE480FF1F030610B5044611D400F05CFC084AE300117803F1804303F5F04319705378147001335370BDE8104000F050BC10BD00BFE480FF1F4C
|
||||
:4027000030B504060CD411F4704509D1C40004F1804404F5F0442180A270E370284630BD012030BD03065FBFC00000F1804000F5F04081805ABFC28000200120704700000C
|
||||
:4027400038B50446084DB4F5004F05D9286800F017FCA4F50044F6E7034B58686043BDE8384000F00DBC00BFEC80FF1F024B1B7A584300F005BC00BFEC80FF1F0E4B00F01A
|
||||
:4027800003001A78490102F0FC02104318701A7801F0600142F080021A701A7802F07F021A701A7802F09F020A431A701A7842F010021A70704700BF83430040014B012277
|
||||
:4027C0001A70704784430040044B00F00F021B6853F8220043F82210704700BF08ED00E0054A00F01F00126800F1100352F8230042F82310704700BF08ED00E000F01F0089
|
||||
:4028000000F16040490100F56440C9B2017070470F4B10B50F4900240F205C609C60DC601C615C61FFF7D0FF0B4A136843F0040313600A4B4FF47A72DB68B3FBF2F3084A9B
|
||||
:402840001360084B4FF400421C60C3F8E82010BD8492FF1FBD28000010E000E0EC80FF1F14E000E018E000E0024A136843F002031360704710E000E008B5FFF7F5FF034AF5
|
||||
:40288000136843F00103136008BD00BF10E000E010B5054CA3691BB9FFF7BAFF0123A361BDE81040FFF7E8BF8492FF1F024B1868C0F30040704700BF10E000E038B5FFF723
|
||||
:4028C000F5FF012808D1054D002455F8243003B198470134052CF8D138BD00BF8892FF1F024B03EB80035868596070478492FF1F134B144A1B78DBB20360127843EA0223E0
|
||||
:40290000114A0360127843EA0243104A0360127843EA026303600E4B0E4A1B78DBB24360127843EA02230C4A4360127843EA02430A4A4360127843EA02634360704700BF30
|
||||
:402940000301004904010049EC460040020100490101004900010049050100490601004910B500F015FB204A044613780A2043F002031370137C43F00203137412F80A3C43
|
||||
:4029800043F0010302F80A3C937943F00103937102F5AB52137843F003031370134B18221A7013F8012C42F0400203F8012C13F8012C02F0FC0203F8012CCE2203F8062CBB
|
||||
:4029C000A3F597530222183B1A70094A137843F008031370FFF7CAFE064B10222046BDE810401A6000F0D8BAAB4300400E5900402F5B004080E200E008B500F0C9FA0F4A73
|
||||
:402A0000137803F0FE031370A2F5AA521D3A137803F0FD031370137C03F0FD03137412F80A3C03F0FE0302F80A3C937903F0FE039371BDE8084000F0AFBA00BF0859004072
|
||||
:402A4000044A137803F03F0343EA8010C0B21070704700BF08590040082804D00A280CBF8223C22300E0422308380E4AC0B20428137098BF0C4B4FF0000298BF33F9101067
|
||||
:402A80000A4B88BF11461A8042F210734B4341F2883103F6C41393FBF1F305490B60054B1A8070470A590040883B00005293FF1F5493FF1F5893FF1F08B5102000F0A6F9C9
|
||||
:402AC00007210420FFF79AFE07490420FFF788FE064A0C20137843F006031370FFF7BCFF034B00221A8008BDB12B0000095900405093FF1F10B5054C23781BB9FFF7DCFFF1
|
||||
:402B000001232370BDE81040FFF72ABFA092FF1F044B1A7802F0FB021A701A7842F001021A7070470859004010B5084B1C7814F0010403D10028F9D0002404E02046FFF7D9
|
||||
:402B400015FE024B1B78204610BD00BF09590040034A044B1B881088181A00B2704700BF5893FF1FA25B00400E4A13881BB223B111880A2309B2594301E00B4B19680B4B98
|
||||
:402B80001B88C01A42F2107300B203FB00F2022391FBF3F30028D8BF5B42134493FBF1F000B270475293FF1F5493FF1F5093FF1F7047000010B500F0EBF9214A0446137884
|
||||
:402BC0000A2043F001031370137C43F00103137412F80A3C43F0020302F80A3C937943F00203937102F5AA521832137843F003031370144B18221A7013F8012C42F0400241
|
||||
:402C000003F8012C13F8012C02F0FC0203F8012CCE2203F8062CA3F597530222123B1A70094A137843F008031370FFF79FFD074B08222046BDE810401A6000F0ADB900BFEB
|
||||
:402C4000AB43004006590040275B004080E200E008B500F09DF90F4A137803F0FE031370A2F5AA52153A137803F0FE031370137C03F0FE03137412F80A3C03F0FD0302F8BA
|
||||
:402C80000A3C937903F0FD039371BDE8084000F083B900BF00590040044A137803F03F0343EA8010C0B21070704700BF00590040082804D00A280CBF8223C22300E04223BE
|
||||
:402CC00008380E4AC0B20428137098BF0C4B4FF0000298BF33F910100A4B88BF11461A8042F210734B4341F2883103F6C41393FBF1F305490B60054B1A8070470259004094
|
||||
:402D0000923B00005E93FF1F6493FF1F5C93FF1F08B5102000F084F807210320FFF76EFD07490320FFF75CFD064A0C20137843F006031370FFF7BCFF034B00221A8008BD88
|
||||
:402D4000092E0000015900406093FF1F10B5054C23781BB9FFF7DCFF01232370BDE81040FFF728BFA192FF1F044B1A7802F0FB021A701A7842F001021A7070470059004046
|
||||
:402D800010B5084B1C7814F0010403D10028F9D0002404E02046FFF7E9FC024B1B78204610BD00BF01590040034A044B1B881088181A00B2704700BF5C93FF1FA05B00406B
|
||||
:402DC0000E4A13881BB223B111880A2309B2594301E00B4B19680B4B1B88C01A42F2107300B203FB00F2022391FBF3F30028D8BF5B42134493FBF1F000B270475E93FF1F0D
|
||||
:402E00006493FF1F6093FF1F70470000034A00F0F800137803431370704700BF02410040034A00F0F800137803431370704700BF06410040014B1870704700BF7C64004043
|
||||
:402E4000014B1870704700BF7B64004073B515461E460B4C04230022019200920A46014618462370FFF7F8FB324629462078FFF7B3FB02212078FFF79DFB207802B070BDE9
|
||||
:402E8000FC80FF1F074A0223136002F688321268E0215064044A11706FF440710A441360704700BF80E100E001E400E0014B1870704700BF74640040014B1870704700BFE2
|
||||
:402EC00075640040014B1870704700BF7D640040FEB5494652465B460EB40746244909688A46244A12682448022100F071F8030020480068C018204900F06AF814388346CB
|
||||
:402F00000121C9430C460125002600F041F8814651460B7823400B705846013000F030F83800F04028400B78234003430B70584600F026F80136072EF2D900200130013812
|
||||
:402F4000013001200B78234003430B705846043000F016F8484600F01FF800BF00BF00BF0EBC894692469B46FEBD00BFAFF30080D480FF1FF880FF1F00C2010000000000FD
|
||||
:402F80000230800803D000BF01380046FCD17047EFF3108072B6704780F31088704700BF094A137803F00303012B0AD0022B09D113790C2103F07F02044B01FB02339B7A4A
|
||||
:402FC00000E013790020704700600040DC92FF1F002902D0B0FBF1F0704708B14FF0FF3000F008B80029F8D00246B0FBF1F000FB11217047704700BF014B1868704700BFEC
|
||||
:403000006081FF1F0E4B70B51E460E4C0025E41AA410A54204D056F8253098470135F8E700F044FE084B094C1E46E41AA4100025A54204D056F8253098470135F8E770BD98
|
||||
:40304000B83C0000B83C0000B83C0000C03C000003460244934202D003F8011BFAE7704730B5141E05469BB0184604DA8B232B604FF0FF301DE04FF40273ADF80C300CBFA2
|
||||
:40308000234604F1FF33029305934FF6FF7300910491ADF80E3002461E9B6946284600F073F8431CBCBF8B232B6014B1009B00221A701BB030BD000007B5009313460A464B
|
||||
:4030C000014603480068FFF7CBFF03B05DF804FB6081FF1F2DE9F0478E6882469E420C46914698463ED88A8912F4906F3AD02568096902236F1A656905EB450595FBF3F5B9
|
||||
:403100007B1C43449D4238BF1D4653050FD5294600F04AFB064698B13A46216900F0D2FAA38923F4906343F08003A38113E02A4600F098FB064670B92169504600F0E8FAA0
|
||||
:403140000C23CAF80030A3894FF0FF3043F04003A381BDE8F08726613E44266046466561ED1BA560464528BF464649463246206800F0B3FAA36800209B1BA36023681E44F5
|
||||
:403180002660BDE8F08700002DE9F04F9DB003938B8980461C060D4616460DD50B695BB9402100F001FB2860286118B90C23C8F80030CDE040236B610023099320238DF86F
|
||||
:4031C0002930DFF89CB130238DF82A3037463C4614F8013B1BB9B7EB060910D003E0252BF9D02746F3E74B46324629464046FFF771FF013000F0A780099B4B4409933B7803
|
||||
:40320000002B00F0A08000234FF0FF3204930793059206938DF853301A930126052221784E4800F041FA671C049B38B14B4A3C46801A06FA00F018430490EFE7D90644BFAF
|
||||
:4032400020228DF853201A0744BF2B228DF8532022782A2A03D0079A00210A200BE0039A111D12680391002A10DA524243F00200079204900BE027463B780134303B092B51
|
||||
:4032800003D800FB02320121F5E701B107923B782E2B1ED17B782A2B0AD1039B02371A1D1B680392002BB8BF4FF0FF33059310E0002319460593781C0A2407463A780130D0
|
||||
:4032C000303A092A03D804FB01210123F5E703B1059103223978224800F0E6F940B14023CBEB000003FA00F0049B013718430490397806221B487E1C8DF8281000F0D4F9CF
|
||||
:4033000088B1194B33B9039B073323F007030833039314E003AB00932A46144B04A94046AFF3008007E003AB00932A460F4B04A9404600F093F8B0F1FF3F824603D0099B27
|
||||
:403340005344099342E7AB895B0601D4099801E04FF0FF301DB0BDE8F08F00BF873C00008D3C0000913C000000000000D53000002DE9F04791461F460A698B680646934279
|
||||
:40338000B8BF1346C9F8003091F843200C46DDF8208012B10133C9F800302368990642BFD9F800300233C9F80030256815F0060510D104F1190A07E0012352463946304631
|
||||
:4033C000C04701301AD00135E368D9F800209B1A9D42F1DB94F843302268003318BF012392060FD5E118302081F843005A1C94F845102244023382F8431003E04FF0FF3091
|
||||
:40340000BDE8F08704F1430239463046C0470130F4D02268D9F80050E36802F00602042A08BF5D1B2269A3680CBF25EAE57500259342C4BF9B1AED184FF000091A344D45BF
|
||||
:4034400009D00123224639463046C0470130D5D009F10109F3E70020BDE8F0872DE9F04317460A7E85B06E2A984606460C460C9B01F1430E00F0AE8011D8632A22D009D833
|
||||
:40348000002A00F0BB80582A40F0CA8081F84520834955E0642A1ED0692A1CD0C0E0732A00F0B08009D86F2A2ED0702A40F0B8800A6842F020020A603EE0752A24D0782A87
|
||||
:4034C0003AD0ADE01A6801F14205111D1960136884F84230A8E021681A6811F0800F02D0111D196008E011F0400F02F10401196002D0B2F9003000E01368002B3CDA2D228D
|
||||
:403500005B4284F8432037E021681A6811F0800F02D0111D196007E011F0400F02F10401196001D0138800E01368227E5C496F2A14BF0A2208221BE078225A4984F8452055
|
||||
:403540002268186812F0800F00F104051D6003D1550601D5038800E00368D00744BF42F0200222601BB9226822F0200222601022002084F8430001E049490A226568002DF0
|
||||
:40358000A56008DB206820F0040020602BB9002D7DD175460CE0002B79D07546B3FBF2F002FB1033CB5C05F8013D03460028F5D1082A0BD12368DA0708D5236962689A42E0
|
||||
:4035C000DEBF302305F8013C05F1FF35C5EB0E0323612EE008681A6810F0800F496903D0101D1860136808E010F0400F02F104001860136801D0198000E019600023236173
|
||||
:40360000754616E01A68111D1960156800216268284600F049F808B1401B6060636804E004F1420584F8422001232361002384F84330CDF800803B4603AA21463046FFF70C
|
||||
:4036400097FE013002D14FF0FF3026E023692A4639463046C0470130F5D023689B0710D5002504F1190907E001234A4639463046C0470130E7D00135E368039A9B1A9D42D0
|
||||
:40368000F2DBE068039B9842B8BF184605E00B7804F1420584F842308AE705B0BDE8F083773B0000983C000010B5C9B202449042034605D01C7801308C42F8D1184610BD55
|
||||
:4036C000002010BD10B5431E0A44914204D011F8014B03F8014FF8E710BD884210B501EB020301D8421E0BE09842FBD28118D21AD34204D013F8014D01F8014DF8E710BD71
|
||||
:40370000994204D011F8014B02F8014FF8E710BD38B50546002944D051F8043C0C1F002BB8BFE41800F0D4F81E4A1368114613B96360146030E0A3420DD92268A0188342ED
|
||||
:4037400001BF18685B681218226063600C6023E0A24203D813465A68002AF9D118681918A1420BD12168014458188242196013D110685268014419605A600DE002D90C232A
|
||||
:403780002B6009E021686018824201BF106852680918216062605C602846BDE8384000F098B838BDA892FF1F70B5CD1C25F0030508350C2D38BF0C25002D064601DBA9429D
|
||||
:4037C00002D90C23336046E000F082F8234B1C681A462146A1B10B685B1B0ED40B2B03D90B60CC18CD501EE08C420BBF63684B681360636018BF0C4615E00C464968E9E70D
|
||||
:40380000174C23681BB9304600F052F820602946304600F04DF8431C18D0C41C24F00304A0420DD12560304600F053F804F10B00231D20F00700C31A0ED05A42E25070BD37
|
||||
:40384000211A304600F034F80130EBD10C233360304600F03EF8002070BD00BFA892FF1FA492FF1FF8B5074615460E4621B91146BDE8F840FFF798BF1AB9FFF749FF2846F5
|
||||
:40388000F8BD00F027F885420ED929463846FFF78BFF044650B131462A46FFF713FF31463846FFF735FF01E03046F8BD2046F8BD38B5064C0023054608462360FDF7F6FB46
|
||||
:4038C000431C02D1236803B12B6038BD8C93FF1F7047704751F8040C0028BEBF091851F8043CC0180438704700000000050209020B020D020F021102130215022800000013
|
||||
:40390000000104000100000000000000000157494E55534200003030303031000000000000000000E0000000000105000100D6000000070000002A00440065007600690041
|
||||
:403940006300650049006E0074006500720066006100630065004700550049004400730000009E0000007B00330064003200370035006300660065002D003500340033000D
|
||||
:4039800035002D0034006400640035002D0061006300630061002D003900660062003900390035006500320066003600330038007D0000007B00330064003200370035001F
|
||||
:4039C0006300660065002D0035003400330035002D0034006400640035002D0061006300630061002D003900660062003900390035006500320066003600330038007D0098
|
||||
:403A0000000000007265706C792030782530327800686F6D696E6700626567696E6E696E67207365656B2066726F6D20256420746F2025640066696E69736865642073652D
|
||||
:403A4000656B00796573006E6F00647269766520303A20257320647269766520313A2025730057616974696E6720666F72205553422E2E2E0055534220726561647900631F
|
||||
:403A80006F6D6D616E6420307825303278006661696C2025642B25642B2564203D3D2025642C206E6F74202564007061737365643D256400756E64657272756E2061667479
|
||||
:403AC0006572202564207061636B65747300636F756E743D256420693D256420643D256400636D645F777269746500703D25642063723D25642063773D256420663D2564F8
|
||||
:403B000020773D256420696E6465783D256420756E64657272756E3D256400756E64657272756E2100737563636573730073746172742065726173696E670073746F702027
|
||||
:403B400065726173696E670069646C650000510040100040510040300000000140001000140140000800400140000A004C01400002005001402000303132333435363738CF
|
||||
:403B80003941424344454600000100000004000000100001000000040000001001000000A43B000001000000733C0000000000000000000001000000BC3B00000100000084
|
||||
:403BC000453C000004000000DE3B0000000000000000000000000000DC3B0000FF00000001024000FF00000082024000FF00000003034000FF00000084034000FF000203FC
|
||||
:403C000004030904160346006C007500780045006E00670069006E0065002A0343006F0077006C00610072006B00200054006500630068006E006F006C006F006700690036
|
||||
:403C4000650073000009022E0001010080320904000004FF00000107050102400000070582024000000705030340000A0705840340000A12010002FF0001080912006E016F
|
||||
:403C800000020180014300232D302B2000686C4C00656667454647003031323334353637383961626364656600000000F8B500BFF8BC08BC9E4670475900000029110000DA
|
||||
:403CC000F8B500BFF8BC08BC9E46704735000000E03C0000C880FF1FA000000028120000000000009093FF1FFF000000675000400C00000007000000FFFFFFFF7F8000006F
|
||||
:403D00003F0000000000007D00FA0000400000000090D003FF0000000000000000000000000000000000000000000000000000000000000000000000853C0000000000006A
|
||||
:403D400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000081FF1F00000000A4
|
||||
:4001000001221A75597514E09969521A19698A4294BF587D00201875187D094908B1002204E0086982428CBF002201224A75DA689A611B7D13B1002002F046B9704700BF70
|
||||
:400140008881FF1F10B5C4B2204601F059F90128FAD110BD08B572B60F4B0F49DA680132DA60DA690132C82A08BF0022DA611A6AD8690132A72A08BF00220A621B6A002B13
|
||||
:400180000CBF02230023002814BF184643F0010002F082FE62B608BD8881FF1F38B50446C5B2284602F0B2F8062002F0CFFA44F00200C0B202F0AAF8062002F0C7FA28460D
|
||||
:4001C00002F0A4F8BDE83840062002F0A9BA10B5642402F095F828B9FFF7E0FF013CF8D1204610BD012010BD70B5C4B2054620460E4601F005F9012805D0204601F01EFA34
|
||||
:400200002846FFF79FFF204601F002F9314605460246204601F0BEF9204601F0F1F80028FAD1284670BD000038B5044D0024285D013402F03BFA402CF9D138BDAC81FF1FCB
|
||||
:4002400008B502F055FC002002F05EFC02F070FC02F07AFC80B208BD10B50446012002F06DF8642002F05CFAFFF7EAFF2080002002F064F8642002F053FAFFF7E1FF60809C
|
||||
:4002800010BD08B502F060FD002002F069FD02F07BFD02F085FD80B208BD10B50446FFF796FF322002F03CFAFFF7EBFF20800120FFF774FF322002F033FAFFF7E2FF6080D2
|
||||
:4002C00010BD0FB400B593B014AB53F8042B402102A8019302F0E0FE02A802F07CF802F086F813B05DF804EB04B0704710B5044601780648FFF7E5FF0420FFF723FF627816
|
||||
:400300002146BDE81040042001F0D2B8DC38000007B50023ADF804308DF80600032301A88DF80530FFF7E2FF03B05DF804FB000010B5074C94F8643043B1002001F0DAFFEE
|
||||
:40034000002002F06DFD002384F8643010BD00BF8881FF1F38B5104D837895F8672004469A4204D0FFF7E4FF002385F86A302368C5F865302279094B1A71A378002B14BF45
|
||||
:400380000220012002F04CFDE07802F043FD2079BDE8384002F07ABD8881FF1FED81FF1F38B50D4C94F8645065B904F16500FFF7D1FF012001F09EFF4FF47A7002F0B0F968
|
||||
:4003C00084F86A50E368E366012384F86430BDE8384002F0E3B900BF8881FF1FF8B5214C0546FFF7DDFF94F86A3003B15DB91E48FFF767FFFFF7EBFE0120002384F86A007C
|
||||
:40040000236702F0A3F92A46216F1848FFF759FF144E0027236F9D4216D001F071FF00B13767236F9D4205DD0120FFF7B7FE336F013305E005DA0020FFF7B0FE336F013B0B
|
||||
:40044000336702F0ABF9E5E7322002F069F92A2DCCBF0020012002F025FDBDE8F8400448FFF72FBF8881FF1FE9380000F03800000D3900002DE9F04F99B062B602F0F8F947
|
||||
:400480009E49042002F01CFA9D4801F045FF9D4802F0E8FC9C4801F079FF02F0C9FB02F09BFA002002F0BCFC01F094FF0221002000F05CFF954C012001F0D4F8002384F890
|
||||
:4004C0006730FFF76DFFFFF782FE84F87400FFF72FFF012384F86730FFF762FFFFF777FE84F87500FFF724FF894B94F87400894994F875202546002A14BF0A461A4600286F
|
||||
:4005000008BF19468448FFF7DCFE0321084602F025F9264602F042F994F8643043B1EA6EEB689B1A41F28832934201D9FFF700FF00F054FF18B97948FFF7C3FE04E000F079
|
||||
:4005400053FF0028F7D10BE000F048FF10B902F025F9F9E77248FFF7B4FE032001F06EF8032000F04DFF0128D4D16E48FFF7F2FE6D490320FFF738FE94F876106B48FFF7F9
|
||||
:40058000A0FE94F87630023B142B00F2D683DFE813F01500D4031E00D4032400D4035000D4037600D403D900D403C101D4030803D4032C03D4033303D4034D0303238DF851
|
||||
:4005C00020308DF821300F238DF822302AE394F87800FFF703FF564B21E340F2DC57FFF7DFFE00232375E068227D02F0FF012AB9EB681B1ABB42F7DD0B4611E083B100227E
|
||||
:40060000174696F87810F068277594F814E0BEF1000F02D1EB681B1AF7E701329142F3DA07228DF8202004228DF82120ADF82230F8E20220FFF786FD4FF000080DF1200A54
|
||||
:4006400002F0ACF84FF480790027C9EB0803DA1907F80A200137402FF9D10220FFF772FD3A465146022000F023FFB9F10109EBD108F10108B8F1400FE2D12E4B38E04FF076
|
||||
:40068000010A4FF000080DF1200B02F087F84FF0000959460120FFF7A7FD08EB090300270493049B1BF807203B44DBB29A4209D08DE80C0041463B464A461F48FFF701FEE0
|
||||
:4006C0004FF0000A0137402FEBD109F10109B9F5807FDED108F10108B8F1400FD5D151461648FFF7EEFDBAF1000F00F01B81144B1B8807A8ADF81C3095E200BF5501000004
|
||||
:40070000F900000091000000C50000008881FF1F1F3900001B390000223900003A3900004D390000ED81FF1FFE81FF1F57390000CC380000CE380000663900008239000026
|
||||
:40074000D0380000206FFFF749FE94F8780001F0F5FD94F8780001F0D9FD02F009FCB94BDFF8FC821A78002702F0FB021A701A7842F001021A701A7802F0FE021A701A7880
|
||||
:4007800002F0FE021A7002F0F7FB0220FFF7DAFC012141F6FF734FF48042084602F046FB84F8B60001F068FF08F807000137402FF8D1DFF8B0A200270AF195091FFA89F816
|
||||
:4007C0000137402F14BF3A4600221AF8010F2244062392F82420402101F082FF424646F240419AF8000001F08DFF08F14008402F1FFA88F8E4D196F8793053B196F87C30C8
|
||||
:40080000336100233375237D002BFCD000233375336100234FF0FF32236062602372236894F8B600234493F8241001F0DDFE94F8B60001F09BFE012194F8B60001F06EFEAA
|
||||
:400840002368002BFCD0002398467360D6F80CA0012701F0A3FFE368B4F87A20CAEB030393420DD367B1042195F8B60001F0C8FE94F8B60001F0D4FE0028F9D107463072CF
|
||||
:40088000237AFBB96A682B689A4202D1002FE0D118E00220FFF756FC6968402209EB8111022000F005FE6A68674B01321340002BBEBF03F1FF3363F03F03013308F1010820
|
||||
:4008C0006360C6E70220277AFFF73CFC00221146022000F0EDFD0220FFF734FCFFB2FFF7A3FC002001F012FD37B15848FFF7E9FC0220FFF70DFD06E0554B08A81B88ADF871
|
||||
:400900002030FFF7F3FC227D4146237A5148FFF7D8FC15E25048FFF7D4FCD4F87A7017F03F0701D0032009E2286FFFF757FD95F8780001F003FD95F8780001F0E7FC012054
|
||||
:4009400001F002FD02F014FB444BDFF814811A7842F004021A701A7842F001021A701A7802F0FE021A701A7802F0FE021A7002F003FB01214FF4804341F6FF72084601F0CB
|
||||
:40098000E9FC85F8B60001F077FE08F807000137402FF8D1DFF8CC90002709F195031FFA83F804930137402F14BF3A46002219F8010F2244052392F82420402101F090FEB2
|
||||
:4009C000414646F2475299F8000001F09BFE08F14008402F1FFA88F8E4D100274FF0FF33376098467360BB463B46D6F87A9037725FEA99190CBF4FF0010A4FF0000A2168C1
|
||||
:400A0000114A01310A40002ABCBF02F1FF3262F03F026068B8BF013282426FD02BB1227A002A7AD12A7D002A77D12068049A059302EB8010BAF1000F16D040223F2102F079
|
||||
:400A4000F7FA1CE0906400403F0000808C390000D2380000A6390000B939000097650040AC81FF1FAB81FF1F014601370120FFF7BBFBC7EB0903D3F1000A4AEB030A216882
|
||||
:400A8000B34A01310A40002ABEBF02F1FF3262F03F02013222606268059B01322ED12A683F2A2BD14FF00008C5F8048001F080FC85F808806B6895F8B6002B4493F82410D9
|
||||
:400AC00001F092FD95F8B60001F050FD012195F8B60001F023FD95F87E302B6185F81480237D002BFCD04FF00008012086F8148001F06AFC404601F027FC00E023B1237A54
|
||||
:400B00005BB92B7D4BB90123626842453FF477AF0BF1010BD5F8048071E701F04FFC012001F012FC002001F04FFC042194F8B60001F066FD94F8B60001F072FD8046002873
|
||||
:400B4000F8D196F8B60001F0FFFC337D327A0293012303920193CDF800A05B463A4649467C48FFF7AEFBC6F81080BAF1000F0BD0FFF75AFB002001F0C9FB237A63B1764854
|
||||
:400B8000FFF79FFB0220D9E0B945F1D073490120FFF72AFB0137F7E77148FFF792FB714B3DE094F8780001F0C9FB206FFFF716FC6D48FFF786FB94F87930236100232375F8
|
||||
:400BC000237D002BFCD0012001F0FEFB00233375237D002BFCD0002001F0F6FB002363483361FFF76EFB624B19E0002084F86A00FFF7F4FB5F4B12E094F8743023B195F870
|
||||
:400C000075200AB985F8782094F875201AB113B9012385F878305848FFF79CFB574B1B88ADF8203008A8FFF761FB89E0FFF780FB02F07CF8002002F01FF82A2701F04AFFE9
|
||||
:400C4000002001F0EDFE3A46002108A802F0F0F917238DF820308DF8217001F09FFD002001F048FB002002F0DBF8C82001F058FD0DF12200FFF7F0FA0DF13600FFF70DFB01
|
||||
:400C800001F08CFD012002F0CBF8322001F048FD0DF12600FFF7E0FA0DF13A00FFF7FDFA012001F027FB4FF4967001F039FD01F075FD0DF12E00FFF7CFFA0DF14200FFF71B
|
||||
:400CC000ECFA002001F016FB4FF4967001F028FD01F064FD022002F0A3F8322001F020FD0DEB0700FFF7B8FA0DF13E00FFF7D5FA012001F0FFFA4FF4967001F011FD01F040
|
||||
:400D00004DFD0DF13200FFF7A7FA0DF14600FFF7C4FA002001F0EEFA4FF4967001F000FD01F03CFD002002F07BF8002384F86A3001F07EFF01F050FE74E70120FFF7E8FA91
|
||||
:400D4000032000F07BFC0E48FFF7BBFAFFF7E2BB3F000080C3390000F33900004092FF1FFD390000D4380000053A0000133A0000D6380000D8380000FE81FF1FDA380000E3
|
||||
:400D8000203A00002DE9F04172B6884B61221A70A3F5F06301221A801924854A9C7092E803008033062283F8002283E80300522203F580731A707F4B7F4A1B787F4EDBB2FE
|
||||
:400DC000137040F618027E4B00251A8041F2512223F8022C33784FF4F07003F0010343EA450502F0BDF8013C05F003052ED0032DF0D1744B4FF480721A8007221A70724A20
|
||||
:400E0000002548211570917002221D705D7103F8032C0422DA716D4A6D4C13786D4E43F00103137012F8013C062743F0030302F8013C2378012243F0800323705B4B1A70F9
|
||||
:400E4000654A137843F02003137000E0FEE707FB056300219A881868013502F0E9F8072DF5D15E485E4E002550F8041F05F1105303F1480221F0FF074933C9B20B44520042
|
||||
:400E80005B0002329A4206D012F802EC12F801CC0EF807C0F5E7B0420D44E5D1514A002313609360136193614F4B504F1A68504BDFF888811A604F4B1A684F4B1A604F4A7B
|
||||
:400EC000137843F002031370137C43F0020313742378A2F5863243F040032370413A137843F010031370464A464B07CA03C31A80454A2833106843F8250C127903F8212CA9
|
||||
:400F0000424A07CA03C31A80414AE83B07CA03C31A80404A083307CA03C31A803E4A3F4BA2F5616203CBC2F8100EC2F8141E1378042043F008031370394B02F5AA521B78A7
|
||||
:400F40003D78DBB298F80060EDB203F007010C321B091170F6B2537045F003033B7046F0030388F800302F4B48221A702E4A402313702E49937013729372082382F81F32BF
|
||||
:400F800020220A7048710A72294A0A20137001F0DDFB284B88F8006044223D70264D1A7094E80F0007C52B80BDE8F081004800404C0A00480F010049A1460040254200408F
|
||||
:400FC000224200400440004006400040A2430040A0430040253A0000E8460040FCFFFF478C00004800760040540A0048F846004020760040580A004828760040035001404D
|
||||
:401000000C0A0048C0510040180A0048200A00482C0A0048380A004832510040440A0048CF0100491D51004001590040235B0040585B004076580040B0430040F9460040F2
|
||||
:4010400008B501F0C9FF03680C2B00D1FEE7FEE7084908B50B68084A1844821A802A01DC086005E001F0B8FF0C2303604FF0FF33184608BDCC80FF1F9093FF1F80B5114817
|
||||
:40108000114B0025C0B1A3F1100192C922460439161BB74204D051F8046F42F8046BF7E7114653F8046C8C1AA64202D041F8045BF9E701381033E5E701F094FFFFF7DAF9D9
|
||||
:4010C000FEE700BF01000000F43B0000124A134B10B51A60124A134C1368134843F4007313600023032B98BF54F823204FEA830188BF0E4A0133302B4250F3D10C4B1A7814
|
||||
:401100000C4B1A700C4B084A1A60FFF73BFEBDE8104001F0EDB900BF0004FA050CED00E014ED00E0000000000080FF1F41100000BC760040C080FF1F08ED00E0F8B501F042
|
||||
:4011400017FF4B4A01271378022643F001031370137C484C43F001031374474B02F5E3521F700B3203F8946C1378054603F07F031370002001F0EAFA2378404A03F0F903F2
|
||||
:4011800023701378384603F0DF03137023783B43237001F0DBFA282001F0D8FA384B30461A7802F07F021A701A7802F0BF021A7023783343237001F0C9FA2378314A43F0C6
|
||||
:4011C000040323700023137053702F4AFF2199540133092BFBD1284601F0CEFE0721172001F0FCFA2949172001F0EAFA0721182001F0F4FA2649182001F0E2FA0721152033
|
||||
:4012000001F0ECFA2349152001F0DAFA0721052001F0E4FA2049052001F0D2FA0721062001F0DCFA1D49062001F0CAFA0721084601F0D4FA1A49072001F0C2FA07210820F8
|
||||
:4012400001F0CCFA1749082001F0BAFA0021162001F0C4FA1449162001F0B2FA07210C2001F0BCFABDE8F84010490C2001F0A8BAA5430040944300409D6000401260004076
|
||||
:40128000F851004084600040B592FF1F0B1B000045190000091B00003D1A0000691A0000991A0000D11A0000111B0000851B0000214B224A10B5187000231370204A40209B
|
||||
:4012C0001370204A0F2413701F4A13701F4A13701F4A13701F4A13701F4B4FF400021A604FF080721A604FF400121A6020221A601860802018604FF480701860174804702E
|
||||
:401300004FF480001860164B1A70933B19B91A7802F0FE0202E01A7842F001021A70114B03221A70802203F8202C012001F018FE0D4B04221A7010BDD092FF1FD692FF1F39
|
||||
:40134000D492FF1FD592FF1FD192FF1FC092FF1FD392FF1F4893FF1F00E100E09E6000409C600040286000401260004070B5074C054623780E461BB9FFF7E0FE0123237031
|
||||
:4013800031462846BDE87040FFF792BF8092FF1F0A4A002313700A4A13700A4A13700A4A13700A4A13700A4A13700A4A13700A4B03221A70802203F8202C7047D692FF1F4E
|
||||
:4013C000D492FF1FD592FF1FD192FF1FC092FF1FD392FF1F4893FF1F28600040014B1878704700BFD592FF1F044B1A7802F0FF001AB118780022C0B21A707047D492FF1F52
|
||||
:40140000024A0C2303FB002040787047DC92FF1F431E072B0CD8074A064B00010344805C5B7800F00F0043EA0020023880B2704700207047FC5F00401A4A38B50C2303FBA9
|
||||
:4014400000231B79090C13F0800F00F1FF35044619BF8AB24FF480438BB24FF48042032D18D8DFE805F002070C110021084601F01BF80DE00021084600F0FAFF08E0002180
|
||||
:40148000084600F0D9FF03E00021084600F0B8FF054B1855EDB2072D03D801F0EDF8034B185538BDDC92FF1FAC92FF1FB592FF1F431E072B2DE9F0470446894615465CD857
|
||||
:4014C0002F4F0C2202FB0072D388DFF8B8A09BB2C3F500739D424FF00C0303FB007388BFD588DB7884BFC5F50075ADB2254A43EA15230601B354B244EBB28AF80130224BD4
|
||||
:401500001A5C9846FF2A01D1FFF796FF0C2303FB047200215170B9F1000F28D03DB31B4F385D01F011F811232946FE2218F8040001F0D6F806F5C04278321FFA89F118F8D2
|
||||
:40154000040001F0DFF8124D18F80410385D01F04BF80121385D00F0E1FF735D43F002037355735D03F0FD037355BDE8F08703FB04746379DBB28AF80230BDE8F08700BFE7
|
||||
:40158000DC92FF1FFC5F0040B592FF1FAC92FF1F706000402DE9F047044615468846002940D0431E072B3FD8FFF732FFA84203D22046FFF72DFF05461D4E335DFF2B03D1DE
|
||||
:4015C00041462046FFF738FFDFF868A027011AF8040000F0B9FF1223FE222946305D01F07FF807F5C0411FFA88F27831305D01F089F8DFF84490315D1AF8040000F0F4FFE9
|
||||
:4016000001211AF8040000F089FF17F8093043F0020307F8093017F8093003F0FD0307F8093002E00D4600E000252846BDE8F087B592FF1FAC92FF1F70600040431E072BA7
|
||||
:401640000AD8064A0C2303FB002300225A705A79034BD2B200011A54704700BFDC92FF1FFE5F0040431E072B9FBF024B000108221A547047FE5F004030B51A4A1A491B4D0A
|
||||
:401680000878138803449BB21380194A00231488D8B2A4B27CB1082B0CD050680078C0B2E85450680133013050601088013880B21080ECE718460B780E4C082B0E4A00D003
|
||||
:4016C00040B10E4D2B7883F080032B700F232370022301E0022323701370094B1870087030BD00BF4C93FF1F4893FF1F00600040C492FF1FC192FF1FD692FF1FD292FF1FE1
|
||||
:401700004993FF1F074B02221A70074B80221A70064B0F221A70064A00231370054A012013707047D692FF1FD292FF1FC192FF1F4893FF1F4993FF1F30B5164B16491B78E1
|
||||
:401740000A8803F00F03023BDBB21A4492B20A80124C134A0020118889B279B173B15568215C013BC9B229705168DBB20131516011880130013989B21180ECE7094A1370B3
|
||||
:40178000094A137883F080031370084B0B221A7030BD00BF296000404C93FF1F00600040C492FF1F4993FF1FD292FF1FC192FF1F064A06231370064A01201370054B802273
|
||||
:4017C0001A70054B00221A70704700BFD692FF1FC192FF1FD292FF1F4993FF1F054B9A683AB19A68044910709A680988518000229A607047C492FF1F4C93FF1F08B5124BAC
|
||||
:401800001A78D2B21A701B78DBB21A0602D50F4A137008BD0220FFF7E1FF0D4B1B7803F06003202B05D0402B06D043B900F012FC04E001F0A5FB01E000F046FD10B9034B1C
|
||||
:4018400003221A7008BD00BF28600040C192FF1F0060004008B5084A084B0120197813880B449BB21380064B00221A70FFF7B6FF044B03221A7008BD4C93FF1F4893FF1F1D
|
||||
:40188000D692FF1FC192FF1F08B50C4B1B78DBB2042B07D0062B09D0022B0DD1BDE80840FFF7D8BFBDE80840FFF746BF0320FFF795FF034B03221A7008BD00BFD692FF1FCC
|
||||
:4018C000C192FF1F08B5054B002201201A70FFF785FF034B03221A7008BD00BFD692FF1FC192FF1F08B50A4B1A7832B11A78094942F080020A7000221A70074B00220120D1
|
||||
:401900001A70FFF76BFF054B03221A7008BD00BFC092FF1F08600040D692FF1FC192FF1F074B1B78DBB2042B05D0062B05D0022B05D1FFF7A1BEFFF7C5BFFFF7D3BF70479E
|
||||
:40194000D692FF1F38B51D4C2378DBB2DD0634D518060AD503F00F03012B2ED1FFF74EFF174B1B78190609D538BD5A0602D5FFF7D7FF03E09D0620D5FFF786FF23781B066B
|
||||
:401980001BD4104B1A78104B1B7813430F4A13701278934211D10A4A0849154613782078DBB2000605D41378DBB20B700B7803F00F0328788342F1D138BD38BD2860004067
|
||||
:4019C000C192FF1FD292FF1F4993FF1F29600040054A00231380054A916819B191680B7092685380704700BF4C93FF1FC492FF1F0E4808B503889BB213B9FFF783FE13E0D1
|
||||
:401A00000B4B02221A700B4B00221A70FFF7E0FF094AD1799379028843EA012392B2934238BF0380FFF728FE012008BDC492FF1FD692FF1FD292FF1F00600040084B012220
|
||||
:401A40001A700F3B9B7C074B1A7B02F00302012A1EBFDA7B82F08002DA7301225A7370470B600040DC92FF1F094B02221A700F3B93F82230074B1A7E02F00302012A1EBF0F
|
||||
:401A8000DA7E82F08002DA7601225A76704700BF0B600040DC92FF1F0B4B04221A700F3B93F83230094B93F8242002F00302012A1EBF93F8272082F0800283F827200122E0
|
||||
:401AC00083F82520704700BF0B600040DC92FF1F0B4B08221A700F3B93F84230094B93F8302002F00302012A1EBF93F8332082F0800283F83320012283F83120704700BFF5
|
||||
:401B00000B600040DC92FF1F7047FFF741BC0000F0B5184B184E19780C27C9B201234FF0000C31B3CA0720D5144A4FEA031E7244947850782040C5070DD507FB03652C799F
|
||||
:401B4000240608D5147804F0FE0414706D790C4CEDB204F80E50840706D507FB036425792D0658BF84F801C090700133DBB24908D7E7F0BD9F600040DC92FF1F70600040D5
|
||||
:401B8000FE5F004000F0ACBC70B50446184B88B003AA03F11006154618685968083303C5B3422A46F7D11B782B70FCB12223237001AD03232846637000F08AFE00222046DB
|
||||
:401BC0001146AB5C08AC04EB131414F8144C03F00F03847008AC234413F8143C0132082AC1700371417100F10400EAD108B070BD4F3A00002DE9F0431C4D01222E460C2093
|
||||
:401C00001F274FF0800E4FF0080C194B00FB02581401234418705F70164998F805902144B9F1000F07D098F8044024064CBF887081F802C001E081F802E000FB0261CC880F
|
||||
:401C40000132E4B29C71CC88092AC4F30724DC71CC88E4B21C71C988C1F307215971D4D1054BFF221A70BDE8F08300BFDC92FF1F70600040FC5F00400A600040064B074A70
|
||||
:401C80001B7802EBC30253681A7C824286BF03EBC003586900207047D092FF1FB03A00002DE9F84F424B1A78002A7ED01878414D0138C0B2FFF7E2FFA8463F4AC368147810
|
||||
:401CC000007ADFF800C1E4B203EBC0000C2600274FF0010E834268D01A78A24263D11CF80420597891425ED19A7893F8039002F07F0206FB02FA05EB0A01CF7093F802B01E
|
||||
:401D000009F0030981F804B093F803B005F80AB0B3F804A0A1F808A093F902A0BAF1000F0BDAB9F1010F0CBF4FF007094FF00D0981F8059081F801E009E0B9F1010F0CBF20
|
||||
:401D40004FF005094FF0090981F805904F704FEA02191A4906FB0282494481F802E0B2F808A0CAF3072A81F800A0B2F808A05FFA8AFA81F801A0B2F806A011495FFA8AFAAB
|
||||
:401D8000494481F806A0B2F80690C9F3072981F80790B2F806905FFA89F981F80490D288C2F307224A71083394E7BDE8F88F00BFD592FF1FDC92FF1FD192FF1FFC5F004052
|
||||
:401DC00070600040C292FF1F08B5064B18780138C0B2FFF753FF20B143681B7900EBC300406908BDD592FF1F00212DE9F84F0B464E4E0C2707FB01F4013132190929335553
|
||||
:401E00004FF000059370494CD3701381937253705371EFD118B1464B1D70464B1D70464B1A78002A7FD0187801250138C0B2FFF725FFA8464368DFF8F8E0DB790C2713F0B5
|
||||
:401E4000400F3E4B4FF0000C1A7814BF42F0010202F0FE021A70027AD20007FB0541C36803EB02094B4531D093F802A00AF07F06AE4229D10E89B3F804B0B6B25E4538BF50
|
||||
:401E8000A1F808B01E7893F801B01EF80660B3451AD181F804A0DE780E7093F902A0DE78BAF1000F06F0030607DA012E0CBF07260D264E7181F8018006E0012E0CBF052673
|
||||
:401EC00009264E7181F801C00833CBE70135092DC3D1C1680A328B1C0A440C200833934209D013F8081C13F80A5C01F07F0100FB01418D72F2E7FFF767FF114B01211860E6
|
||||
:401F000000230C2000FB0142D3801289013113449BB203F00102134409299BB2F2D1BDE8F84FFFF767BEBDE8F88F00BFDC92FF1FC292FF1F4A93FF1FD592FF1FD392FF1FCE
|
||||
:401F4000D892FF1F114B1B7903F07F035A1E072A19D80F490C2202FB031291781B0141F0010191700021D170517841F002015170127912F0800F074A1A4414BF8D238923CF
|
||||
:401F80009370FFF715BC0020704700BF00600040DC92FF1FFC5F004030B4194B1A7902F07F02531E072B27D8164B0C2404FB02339978154D01F0FE0199700021D970294600
|
||||
:401FC0001201505D114400F07F0050555A7802F0FD025A701A795B78120605D5012B01D18C7006E00D2303E0012B0CBF082309238B7030BCFFF7DCBB002030BC704700BF9C
|
||||
:4020000000600040DC92FF1FFC5F004010B50D4B0D4C21791878C9B20138C0B2FFF72EFE43681B798B4201D2012909D8074A0848535CDBB24354A3780120DBB2535410BD56
|
||||
:40204000002010BDD592FF1F00600040C292FF1F4A93FF1F38B58A4A8A4C13780021DBB221801806517840F18D800A2900F20581DFE811F05D000301030103010301030167
|
||||
:402080000B0003017E0003018200D3787C49012B09D17D4B1A787D4B03EBC2035B685B686360122310E0CB78022B12D18878FFF7E5FD002800F0E180436863606368DA7885
|
||||
:4020C00063689B7843EA02232380BDE83840FFF78FBCCB78032B26D16D4B00228878D5B2854209D3664A91786A4AEE2908BF1346634A917881B106E0187801320028F1D025
|
||||
:4021000018780344EAE764499278097C914203D16248FFF739FD614B1A78002A00F0AD801A78228018E0BDE8384000F029BF13F0030313D0022B40F0A0802380504B0C21C4
|
||||
:402140001B7903F07F02564B01FB02339A78554BD2B21A7000225A706360B6E702222280514A11784F4AC9B2117053706260ACE7012323804D4BEFE70123238013794C4AC4
|
||||
:402180001344E9E701390A2977D8DFE801F037764F76067676760A7620009378454ADBB25AE0937803F0FF0153B9404B1A7891425FD01970404B01201870FFF715FE58E082
|
||||
:4021C000481EC0B2FFF75AFD0028EED155E0FFF71DFF002851D02A4A384913791279DBB2D2B20A70364A3249D25CCB5C9A4240D0314B01221A70FFF753FD3AE003F00303EE
|
||||
:40220000012B2BD009D3022B37D11D4B9B78002B33D1BDE83840FFF7BFBE194B9B78012B2BD1214A137803F0FD0315E003F00303012B13D008D3022B1FD1114B9B78E3B9A4
|
||||
:40224000BDE83840FFF77EBE0D4B9B78012B14D1154A137843F0020313700AE0084B1A795AB998781B791749DBB2CA5C22EA0002CA54BDE83840FFF79BBA002038BD00BFEC
|
||||
:4022800000600040C492FF1FD092FF1FB03A0000143B00009C3A0000873B00006893FF1FDC92FF1F8192FF1FD392FF1FD592FF1FC292FF1FC092FF1FD492FF1FD192FF1FF4
|
||||
:4022C0004A93FF1FD792FF1F074B1A78120609D55B78012B06D1054B054A5A6012781A80FFF786BB0020704700600040C492FF1F743A0000014B1870704700BF76650040FA
|
||||
:40230000014B1878704700BF67640040014B1870704700BF77640040064A0123136002F688321268E0211064034A1170A2F540721360704780E100E000E400E0014B187039
|
||||
:40234000704700BF74640040014B1870704700BF7565004073B515461E460B4C05230022019200920A4601461846237000F064F932462946207800F01FF90221207800F0B7
|
||||
:4023800009F9207802B070BDD080FF1F064A0423136002F688321268E0219064034A1170A2F202321360704780E100E002E400E0014B04221A60704700E100E0014B04228E
|
||||
:4023C0001A60704780E100E0014B1870704700BF74650040704738B505460078012428B100F066FD285D0134E4B2F8E738BD08B50D2000F05DFDBDE808400A2000F058BDDC
|
||||
:40240000F7B516461F460B4C00230325019300930A4601462846257000F00EF93A463146207800F0C9F80221207800F0B3F8207803B0F0BDE080FF1FF7B516461F460B4C05
|
||||
:4024400000230225019300930A4601462846257000F0F2F83A463146207800F0ADF82946207800F097F8207803B0F0BDE180FF1FF7B516461F460B4C002301250193009322
|
||||
:402480000A4601462846257000F0D6F83A463146207800F091F80221207800F07BF8207803B0F0BDE280FF1F73B515461E460B4C0023019300930A4601461846237000F026
|
||||
:4024C000BBF832462946207800F076F80221207800F060F8207802B070BD00BFE380FF1F024B1878C0F38010704700BF8F450040074A7F23802113705170064A013BDBB2F7
|
||||
:4025000002F80839002BF9D1034A1370704700BFE480FF1FF87B00400078004017280FD8084B0001C25C11B142F0200201E002F0DF02C254C25C42F00102C2540020704780
|
||||
:40254000012070471070004017280BD8064B0001C25C02F0FE02C254C25C02F0DF02C25400207047012070471070004017280DD8074900010B4603441A7942F004021A7150
|
||||
:40258000435C43F00103435400207047012070471070004017280BD8064A0001835C490003F0F10301F00E011943815400207047012070471070004041F6FF73994208BFD2
|
||||
:4025C0004FF400519A4208BF4FF4005217289FBFC00000F1804000F5EC4081809ABFC280002001207047000017289FBF034B00011954002088BF0120704700BF197000402C
|
||||
:4026000017289FBF054B00011A5C01F007019DBF1143195400200120704700BF1470004017289FBF034B0001185C00F0070088BFFF20704714700040172810B51AD8C000B7
|
||||
:4026400001F07F0100F1804441EAC21204F5EC44D2B222709DF8082003F00F0343EA0213DBB263709DF80C30002003F00F03A370E07010BD012010BD10B500F079FC0A4A00
|
||||
:402680005378182B0AD91478013B5370E30003F1804303F5F0431B78137000E0FF2400F06BFC204610BD00BFE480FF1F030610B5044611D400F05CFC084AE300117803F1FE
|
||||
:4026C000804303F5F04319705378147001335370BDE8104000F050BC10BD00BFE480FF1F30B504060CD411F4704509D1C40004F1804404F5F0442180A270E370284630BDB0
|
||||
:40270000012030BD03065FBFC00000F1804000F5F04081805ABFC280002001207047000038B50446084DB4F5004F05D9286800F017FCA4F50044F6E7034B58686043BDE875
|
||||
:40274000384000F00DBC00BFEC80FF1F024B1B7A584300F005BC00BFEC80FF1F0E4B00F003001A78490102F0FC02104318701A7801F0600142F080021A701A7802F07F024E
|
||||
:402780001A701A7802F09F020A431A701A7842F010021A70704700BF83430040014B01221A70704784430040044B00F00F021B6853F8220043F82210704700BF08ED00E008
|
||||
:4027C000054A00F01F00126800F1100352F8230042F82310704700BF08ED00E000F01F0000F16040490100F56440C9B2017070470F4B10B50F4900240F205C609C60DC60F4
|
||||
:402800001C615C61FFF7D0FF0B4A136843F0040313600A4B4FF47A72DB68B3FBF2F3084A1360084B4FF400421C60C3F8E82010BD8492FF1F9D28000010E000E0EC80FF1FC6
|
||||
:4028400014E000E018E000E0024A136843F002031360704710E000E008B5FFF7F5FF034A136843F00103136008BD00BF10E000E010B5054CA3691BB9FFF7BAFF0123A36179
|
||||
:40288000BDE81040FFF7E8BF8492FF1F024B1868C0F30040704700BF10E000E038B5FFF7F5FF012808D1054D002455F8243003B198470134052CF8D138BD00BF8892FF1FAE
|
||||
:4028C000024B03EB80035868596070478492FF1F134B144A1B78DBB20360127843EA0223114A0360127843EA0243104A0360127843EA026303600E4B0E4A1B78DBB2436031
|
||||
:40290000127843EA02230C4A4360127843EA02430A4A4360127843EA02634360704700BF0301004904010049EC46004002010049010100490001004905010049060100490D
|
||||
:4029400010B500F015FB204A044613780A2043F002031370137C43F00203137412F80A3C43F0010302F80A3C937943F00103937102F5AB52137843F003031370134B18223F
|
||||
:402980001A7013F8012C42F0400203F8012C13F8012C02F0FC0203F8012CCE2203F8062CA3F597530222183B1A70094A137843F008031370FFF7CAFE064B10222046BDE8DE
|
||||
:4029C00010401A6000F0D8BAAB4300400E5900402F5B004080E200E008B500F0C9FA0F4A137803F0FE031370A2F5AA521D3A137803F0FD031370137C03F0FD03137412F8E1
|
||||
:402A00000A3C03F0FE0302F80A3C937903F0FE039371BDE8084000F0AFBA00BF08590040044A137803F03F0343EA8010C0B21070704700BF08590040082804D00A280CBF9D
|
||||
:402A40008223C22300E0422308380E4AC0B20428137098BF0C4B4FF0000298BF33F910100A4B88BF11461A8042F210734B4341F2883103F6C41393FBF1F305490B60054B33
|
||||
:402A80001A8070470A590040603A00005293FF1F5493FF1F5893FF1F08B5102000F0A6F907210420FFF79AFE07490420FFF788FE064A0C20137843F006031370FFF7BCFFBA
|
||||
:402AC000034B00221A8008BD912B0000095900405093FF1F10B5054C23781BB9FFF7DCFF01232370BDE81040FFF72ABFA092FF1F044B1A7802F0FB021A701A7842F0010256
|
||||
:402B00001A7070470859004010B5084B1C7814F0010403D10028F9D0002404E02046FFF715FE024B1B78204610BD00BF09590040034A044B1B881088181A00B2704700BF1D
|
||||
:402B40005893FF1FA25B00400E4A13881BB223B111880A2309B2594301E00B4B19680B4B1B88C01A42F2107300B203FB00F2022391FBF3F30028D8BF5B42134493FBF1F0C1
|
||||
:402B800000B270475293FF1F5493FF1F5093FF1F7047000010B500F0EBF9214A044613780A2043F001031370137C43F00103137412F80A3C43F0020302F80A3C937943F0DB
|
||||
:402BC0000203937102F5AA521832137843F003031370144B18221A7013F8012C42F0400203F8012C13F8012C02F0FC0203F8012CCE2203F8062CA3F597530222123B1A7067
|
||||
:402C0000094A137843F008031370FFF79FFD074B08222046BDE810401A6000F0ADB900BFAB43004006590040275B004080E200E008B500F09DF90F4A137803F0FE0313708E
|
||||
:402C4000A2F5AA52153A137803F0FE031370137C03F0FE03137412F80A3C03F0FD0302F80A3C937903F0FD039371BDE8084000F083B900BF00590040044A137803F03F0361
|
||||
:402C800043EA8010C0B21070704700BF00590040082804D00A280CBF8223C22300E0422308380E4AC0B20428137098BF0C4B4FF0000298BF33F910100A4B88BF11461A80AE
|
||||
:402CC00042F210734B4341F2883103F6C41393FBF1F305490B60054B1A807047025900406A3A00005E93FF1F6493FF1F5C93FF1F08B5102000F084F807210320FFF76EFD92
|
||||
:402D000007490320FFF75CFD064A0C20137843F006031370FFF7BCFF034B00221A8008BDE92D0000015900406093FF1F10B5054C23781BB9FFF7DCFF01232370BDE81040C8
|
||||
:402D4000FFF728BFA192FF1F044B1A7802F0FB021A701A7842F001021A7070470059004010B5084B1C7814F0010403D10028F9D0002404E02046FFF7E9FC024B1B78204621
|
||||
:402D800010BD00BF01590040034A044B1B881088181A00B2704700BF5C93FF1FA05B00400E4A13881BB223B111880A2309B2594301E00B4B19680B4B1B88C01A42F2107381
|
||||
:402DC00000B203FB00F2022391FBF3F30028D8BF5B42134493FBF1F000B270475E93FF1F6493FF1F6093FF1F70470000034A00F0F800137803431370704700BF02410040A1
|
||||
:402E0000034A00F0F800137803431370704700BF06410040014B1870704700BF72640040014B1870704700BF7864004073B515461E460B4C04230022019200920A46014603
|
||||
:402E400018462370FFF7F8FB324629462078FFF7B3FB02212078FFF79DFB207802B070BDFC80FF1F074A0223136002F688321268E0215064044A11706FF440710A4413608D
|
||||
:402E8000704700BF80E100E001E400E0014B1870704700BF75640040014B1870704700BF76640040014B1870704700BF79640040FEB5494652465B460EB407462449096800
|
||||
:402EC0008A46244A12682448022100F071F8030020480068C018204900F06AF8143883460121C9430C460125002600F041F8814651460B7823400B705846013000F030F81C
|
||||
:402F00003800F04028400B78234003430B70584600F026F80136072EF2D9002001300138013001200B78234003430B705846043000F016F8484600F01FF800BF00BF00BF12
|
||||
:402F40000EBC894692469B46FEBD00BFAFF30080D480FF1FF880FF1F00C20100000000000230800803D000BF01380046FCD17047EFF3108072B6704780F31088704700BF77
|
||||
:402F8000094A137803F00303012B0AD0022B09D113790C2103F07F02044B01FB02339B7A00E013790020704700600040DC92FF1F002902D0B0FBF1F0704708B14FF0FF3097
|
||||
:402FC00000F008B80029F8D00246B0FBF1F000FB11217047704700BF014B1868704700BF6081FF1F0E4B70B51E460E4C0025E41AA410A54204D056F8253098470135F8E75C
|
||||
:4030000000F0DEFD084B094C1E46E41AA4100025A54204D056F8253098470135F8E770BDCC3B0000CC3B0000CC3B0000D43B000003460244934202D003F8011BFAE770475A
|
||||
:4030400030B5141E05469BB0184604DA8B232B604FF0FF301DE04FF40273ADF80C300CBF234604F1FF33029305934FF6FF7300910491ADF80E3002461E9B6946284600F0D4
|
||||
:4030800073F8431CBCBF8B232B6014B1009B00221A701BB030BD000007B5009313460A46014603480068FFF7CBFF03B05DF804FB6081FF1F2DE9F0478E6882469E420C46D9
|
||||
:4030C000914698463ED88A8912F4906F3AD02568096902236F1A656905EB450595FBF3F57B1C43449D4238BF1D4653050FD5294600F04AFB064698B13A46216900F0D2FA24
|
||||
:40310000A38923F4906343F08003A38113E02A4600F098FB064670B92169504600F0E8FA0C23CAF80030A3894FF0FF3043F04003A381BDE8F08726613E44266046466561E0
|
||||
:40314000ED1BA560464528BF464649463246206800F0B3FAA36800209B1BA36023681E442660BDE8F08700002DE9F04F9DB003938B8980461C060D4616460DD50B695BB958
|
||||
:40318000402100F001FB2860286118B90C23C8F80030CDE040236B610023099320238DF82930DFF89CB130238DF82A3037463C4614F8013B1BB9B7EB060910D003E0252BD0
|
||||
:4031C000F9D02746F3E74B46324629464046FFF771FF013000F0A780099B4B4409933B78002B00F0A08000234FF0FF3204930793059206938DF853301A93012605222178C6
|
||||
:403200004E4800F041FA671C049B38B14B4A3C46801A06FA00F018430490EFE7D90644BF20228DF853201A0744BF2B228DF8532022782A2A03D0079A00210A200BE0039AA2
|
||||
:40324000111D12680391002A10DA524243F00200079204900BE027463B780134303B092B03D800FB02320121F5E701B107923B782E2B1ED17B782A2B0AD1039B02371A1DAA
|
||||
:403280001B680392002BB8BF4FF0FF33059310E0002319460593781C0A2407463A780130303A092A03D804FB01210123F5E703B1059103223978224800F0E6F940B1402309
|
||||
:4032C000CBEB000003FA00F0049B013718430490397806221B487E1C8DF8281000F0D4F988B1194B33B9039B073323F007030833039314E003AB00932A46144B04A940468F
|
||||
:40330000AFF3008007E003AB00932A460F4B04A9404600F093F8B0F1FF3F824603D0099B5344099342E7AB895B0601D4099801E04FF0FF301DB0BDE8F08F00BF9B3B000071
|
||||
:40334000A13B0000A53B000000000000B53000002DE9F04791461F460A698B6806469342B8BF1346C9F8003091F843200C46DDF8208012B10133C9F800302368990642BF15
|
||||
:40338000D9F800300233C9F80030256815F0060510D104F1190A07E00123524639463046C04701301AD00135E368D9F800209B1A9D42F1DB94F843302268003318BF01230D
|
||||
:4033C00092060FD5E118302081F843005A1C94F845102244023382F8431003E04FF0FF30BDE8F08704F1430239463046C0470130F4D02268D9F80050E36802F00602042AD7
|
||||
:4034000008BF5D1B2269A3680CBF25EAE57500259342C4BF9B1AED184FF000091A344D4509D00123224639463046C0470130D5D009F10109F3E70020BDE8F0872DE9F0438A
|
||||
:4034400017460A7E85B06E2A984606460C460C9B01F1430E00F0AE8011D8632A22D009D8002A00F0BB80582A40F0CA8081F84520834955E0642A1ED0692A1CD0C0E0732A65
|
||||
:4034800000F0B08009D86F2A2ED0702A40F0B8800A6842F020020A603EE0752A24D0782A3AD0ADE01A6801F14205111D1960136884F84230A8E021681A6811F0800F02D098
|
||||
:4034C000111D196008E011F0400F02F10401196002D0B2F9003000E01368002B3CDA2D225B4284F8432037E021681A6811F0800F02D0111D196007E011F0400F02F104010E
|
||||
:40350000196001D0138800E01368227E5C496F2A14BF0A2208221BE078225A4984F845202268186812F0800F00F104051D6003D1550601D5038800E00368D00744BF42F032
|
||||
:40354000200222601BB9226822F0200222601022002084F8430001E049490A226568002DA56008DB206820F0040020602BB9002D7DD175460CE0002B79D07546B3FBF2F020
|
||||
:4035800002FB1033CB5C05F8013D03460028F5D1082A0BD12368DA0708D5236962689A42DEBF302305F8013C05F1FF35C5EB0E0323612EE008681A6810F0800F496903D0FC
|
||||
:4035C000101D1860136808E010F0400F02F104001860136801D0198000E0196000232361754616E01A68111D1960156800216268284600F049F808B1401B6060636804E0BC
|
||||
:4036000004F1420584F8422001232361002384F84330CDF800803B4603AA21463046FFF797FE013002D14FF0FF3026E023692A4639463046C0470130F5D023689B0710D563
|
||||
:40364000002504F1190907E001234A4639463046C0470130E7D00135E368039A9B1A9D42F2DBE068039B9842B8BF184605E00B7804F1420584F842308AE705B0BDE8F083AB
|
||||
:403680004F3A0000AC3B000010B5C9B202449042034605D01C7801308C42F8D1184610BD002010BD10B5431E0A44914204D011F8014B03F8014FF8E710BD884210B501EBCE
|
||||
:4036C000020301D8421E0BE09842FBD28118D21AD34204D013F8014D01F8014DF8E710BD994204D011F8014B02F8014FF8E710BD38B50546002944D051F8043C0C1F002BF2
|
||||
:40370000B8BFE41800F0D4F81E4A1368114613B96360146030E0A3420DD92268A018834201BF18685B681218226063600C6023E0A24203D813465A68002AF9D118681918DB
|
||||
:40374000A1420BD12168014458188242196013D110685268014419605A600DE002D90C232B6009E021686018824201BF106852680918216062605C602846BDE8384000F0C4
|
||||
:4037800098B838BDA892FF1F70B5CD1C25F0030508350C2D38BF0C25002D064601DBA94202D90C23336046E000F082F8234B1C681A462146A1B10B685B1B0ED40B2B03D94E
|
||||
:4037C0000B60CC18CD501EE08C420BBF63684B681360636018BF0C4615E00C464968E9E7174C23681BB9304600F052F820602946304600F04DF8431C18D0C41C24F00304D4
|
||||
:40380000A0420DD12560304600F053F804F10B00231D20F00700C31A0ED05A42E25070BD211A304600F034F80130EBD10C233360304600F03EF8002070BD00BFA892FF1F09
|
||||
:40384000A492FF1FF8B5074615460E4621B91146BDE8F840FFF798BF1AB9FFF749FF2846F8BD00F027F885420ED929463846FFF78BFF044650B131462A46FFF713FF3146E1
|
||||
:403880003846FFF735FF01E03046F8BD2046F8BD38B5064C0023054608462360FDF7D8FB431C02D1236803B12B6038BD8C93FF1F7047704751F8040C0028BEBF091851F8F0
|
||||
:4038C000043CC0180438704700000000050209020B020D020F021102130215027265706C792030782530327800686F6D696E6700626567696E6E696E67207365656B2066CB
|
||||
:40390000726F6D20256420746F2025640066696E6973686564207365656B00796573006E6F00647269766520303A20257320647269766520313A2025730057616974696E5F
|
||||
:403940006720666F72205553422E2E2E0055534220726561647900636F6D6D616E6420307825303278006661696C2025642B25642B2564203D3D2025642C206E6F7420254E
|
||||
:4039800064007061737365643D256400756E64657272756E206166746572202564207061636B65747300636F756E743D256420693D256420643D256400636D645F77726997
|
||||
:4039C000746500703D25642063723D25642063773D256420663D256420773D256420696E6465783D256420756E64657272756E3D256400756E64657272756E21007375635E
|
||||
:403A0000636573730073746172742065726173696E670073746F702065726173696E670069646C6500005100401000405100403000000001400010001401400008004001A3
|
||||
:403A400040000A004C0140000200500140200030313233343536373839414243444546000001000000040000001000010000000400000010280000000001040001000000C2
|
||||
:403A800000000000000157494E5553420000303030303100000000000000000012034D005300460054003100300030000100000001000000B83A000001000000873B0000A5
|
||||
:403AC000000000000000000001000000D03A000001000000593B000004000000F23A0000000000000000000000000000F03A0000FF00000001024000FF00000082024000C7
|
||||
:403B0000FF00000003034000FF00000084034000FF00020304030904160346006C007500780045006E00670069006E0065002A0343006F0077006C00610072006B00200034
|
||||
:403B400054006500630068006E006F006C006F0067006900650073000009022E0001010080320904000004FF00000107050102400000070582024000000705030340000AE8
|
||||
:403B80000705840340000A12010002FF0001080912006E0100020180014300232D302B2000686C4C0065666745464700303132333435363738396162636465660000000069
|
||||
:403BC000F8B500BFF8BC08BC9E46704759000000CD100000F8B500BFF8BC08BC9E46704735000000F83B0000C880FF1FA00000002812000000000000000000009093FF1FA8
|
||||
:403C0000FF000000675000400C00000007000000FFFFFFFF7F8000003F0000000000007D00FA0000400000000090D003FF0000000000000000000000000000000000000028
|
||||
:403C400000000000000000000000000000000000993B0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070
|
||||
:403C8000000000000000000000000000000000000081FF1F000000000000000000000000000000000000000000000000000000000000000000000000000000000000000065
|
||||
:403CC00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C4
|
||||
:403D00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083
|
||||
:403D40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000043
|
||||
:403D80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003
|
||||
:403DC00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C3
|
||||
:403E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000082
|
||||
@@ -4098,51 +4098,51 @@
|
||||
:40FF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041
|
||||
:40FFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
|
||||
:0200000480007A
|
||||
:400000000145004008520040015B004001640040020101400B0301403E04014041050140130701405508014056090140510A0140540B01405B0C0140540D0140470E01400D
|
||||
:40004000380F01400A1501400B1701404B18014059190140521A01404E1B01400B40014012410140144201400C430140044401400D4501400946014011470140084801406A
|
||||
:4000800011490140154C0140034D014006500140045101407E0208020941118218021901600C61067C4027212D0A8C40E62082608580908091029840AD01B040E008E224DC
|
||||
:4000C000E680EE020008021003020405052006020B080F041110120117041A021B011C041F0420062107220123082610270428102A082B042F04300731203208330F361052
|
||||
:40010000371038883A303B083E453F4156085808590A5B045C995D905F0189018B028D039601A002A102A301AC01B202B303B601BE04D608D804D904DB04DC99DD90DF0157
|
||||
:40014000000A09900A400F10100811081302164119801AA01B221C101F802142231026082A252B012F80300231443220388039023B143F90584059105F80618063046640B5
|
||||
:4001800068046B026D206E407A107B028110822088088A108E018F4090809102968098409A209D80A502B502C00CC22BC49ECA8FCC0FCE3FD61CD81CDE0AE204E60DEA04B2
|
||||
:4001C000EE0181108D449010918092609D449E049F80A110A402A701A904AC01B208B720E202E60AEA05EE080004020804010602080409010AF90B140D010E020F2810030B
|
||||
:4002000012FC134114041580164017011A041B4E1C801E042202234124042620274128042A102B412CFF2DF12F02310F32FF330F35F03B0A3E045804590B5B045C905F0188
|
||||
:40024000800481078378840485088730880489808C038DFF8E0490019101920294029502970498029C029DA09F48A002A102A304A404A53FA802A908AB10AC05AF80B13F30
|
||||
:40028000B207B33FB7C0BB80BE04D804D904DC90DF01008801020308048405020708084009220A110C040D090F0911011202132814801568170119041C202104224A230182
|
||||
:4002C00025052714288629042C022F6430083102324035013714394A3B203F60422043045C405D206D106E407C028D01914293689420952D96909785980A99039A089B0820
|
||||
:400300009C709D109E069FD5A042A108A280A31CA494A502A65DA702AB02AD10B220B380B610C0FFC2FFC4FFCAFFCCEBCE3FD630DE80E212E410E60AE840EA01EC80000C29
|
||||
:4003400002F1040C06100A040E021080120C140C164018011A021C031EFC22022608280C2A202CFF34FF3E10560858045B045D905F0180088121830284C085218601870427
|
||||
:4003800088088B108D2F8E04900291019204941A96209740980899209B019C109E209F2FA046A121A238A30EA408A808A921AB08AD0FAE80B23FB360B480B51FB640B71FD4
|
||||
:4003C000B908BE44C203C60EC804C9FFCAFFCBFFCF83D804D904DA04DB04DC99DD09DF01000801020309050A070909080A820B040D0A0F091141120813081402152A192051
|
||||
:400400001D041F9024022508268027082A082B102C402D402E10351437813CA03D0540804240462057405A015B415EA6600263026540661668026A406D90835089408B01C6
|
||||
:400440008E409142920693489422953D96B197809808994B9A109CF29D309F14A040A31CA480A54AA604A702A814AC08B780C0FFC2FFC4FFCAB0CCF0CEF0D040D6F8D8F8B5
|
||||
:40048000E280E66CE802EC1000200250061008400A3010621208146216041A031C801D01207C2201261C2A102E10306031013280341F3E043F01580B59045B045C095F01FF
|
||||
:4004C000802381C8820C85C8860189C88A108C2F8D228FCC9130922F9302942395C8960899029A409C239F48A020A1C8A202A423A604A780A880A9D4AC0FAD80AF01B01FA9
|
||||
:40050000B161B260B380B480B51FB808B902BE10BF14C062C702C810C9FFCAFFCBFFCD20CEF0D110D804D904DA04DB04DC99DD09DF01E108E240E340E480E640E7400040C6
|
||||
:40054000012102200505070409220A110C800E040F6010481144148016221710180419021B0C1C201D011E0420C0212122092501281029022B052E202F04311A32603504B8
|
||||
:4005800036443842392840044A0850085F80660267806B026E807C02810188108B028D018F40900891409348951096209780980899489A109CA29D019E029F14A351A54004
|
||||
:4005C000A604A702AB80AF40B548C07FC2FFC4FFCA0FCC1FCE0FD004D204D610DE80E008E220E680EA81012002010340070308100A080B100F10100413101408161217100D
|
||||
:400600001B1C1C1B1D401F20217C2301250227042B102D022F083001316032023418351F36043E40580B590B5B045C995F01804082308610888089018A308B028D028F0133
|
||||
:4006400090E2920894E296049A109E03A0FCA201A420A6D0AE1CAF01B2E0B301B502B61FB928BBC0BF14D608D80BD918DB04DC99DD90DF0100110501071408800A600C019B
|
||||
:400680000D100E0A0F60121013041480162218101A801B501D401E121F0C23442409250828812A202B182F02310132403314380139203B843D905C205F80640867026A40A1
|
||||
:4006C0006D40780279407B017C027F0189088E10C07AC2FDC4B0CA1FCC0FCE3FD630D830DE91E63080028E409240A402AD40B301E204E640EC01EE0A878092409D409F8071
|
||||
:40070000A402A701A810B614E202EA40EC010040021105C20724082009200A110BC00D020F4810F11202139014F11604179C18101AE11B901E0E1F0320F1220823902480D4
|
||||
:40074000261127902B902DFC2F0134F035E0360F371F3A803B20580B590B5B045C995F018001821A8411850186068C059C01A703AC05AD03B101B20CB302B410B501B603BE
|
||||
:40078000BE10BF11C006C6ECC80CC9FFCAFFCBFFD004D601D804D904DA04DB04DC99DD09DF01E2C00080010803800410050109800C420E080F201140166019681B801C02B3
|
||||
:4007C0001E081F6020042106220223842510264029482C422F6435013640371439083A403B403D203E083F4045104604492050105180680869056A106B236F027040713001
|
||||
:40080000728173087C127F04842091529280934894A4952596119784980299039A289B149C309D109E069FE1A042A10CA288A314A40CA522A655A722A920B4C8B640B7042C
|
||||
:40084000C05DC2F1C431CAFACCF0CE72D204DE80E202E608EE10000101120324040706080760088009800A100C0F0D700EF00F01104011421280131014801620187019069A
|
||||
:400880001A801C011D0420082104220424012708280829042A022E0F2F10318032FF3370350F39203E043F01580459045B045C905F018210838487848A108B848D168E10FE
|
||||
:4008C0008F41901C920193E49402960497849A1C9B189E03A002A101A208A306A510A610A722AA10AB84ADE7AF08B5F8B61FB707BB80D80BD90BDC99DF01008001050208F7
|
||||
:400900000410058109080A810B040C020E0A0F2010081202130A166819081E02200821142211232425802610290A2A802B042C022E222F20329235013614395A3C123D0820
|
||||
:400940003E083F40458046024801498058105B206A407B307C028240860190109157928193409520980299039AE09B0A9C109E02A04BA10CA28EA314A404A611AB40AF2038
|
||||
:40098000B001C0DFC2FFC47FCAFFCCEDCEFFDE80E402EA80EE021B011F0232203302350836803B408908C630CCF0CE1030013180344037043A013F80822088028B1097407A
|
||||
:4009C0009D08A108A620AE80AF01CCF0CE60E6805108560883408508932097409A089C419D089F04A002A108A580A740AA09D460E220E610EA20EE808108844185809320A9
|
||||
:400A000097409C41A002A580AB04E2C0E650EA8014407002C404DC015840601084028C108D20A40AA808B040D401D802E008E402EA011B01811087019A109C40A120A4082A
|
||||
:400A4000AE10C6080A040B200E200F01861487108E0297019A109D10A120A408AB01B040C20FE408E8012620932097409902A002A108B502C82052015310550870027502C3
|
||||
:400A80008E0193209902A002A108AA20AF40D4E0DC80DE20EC80EE40051008080C080F041F105120561059206202840887049A109D10A120A202A408C001C20DC601D407CD
|
||||
:400AC000D80285209D20AF1001010B010D010F0111011D0100FF01AB02021105BF0000A09F001F000000000000000000100000004000000000000000C0000000FF0000B8F6
|
||||
:400B00004700470000010000800000028200820000000000000707000700000027001801270018010004000000050000000000000000000000000000000000000000000002
|
||||
:400000000145004009520040015B00400165004047000140380101404E0201404703014046040140440501404C060140490701402C08014031090140040B0140030D014075
|
||||
:400040006C14014057150140591601404B17014011190140071B01400B400140104101400C4201400F43014002440140054501400A4601400B4701400C480140104901404C
|
||||
:40008000174C01400C4D014006500140045101407E02080409021082110218021904601561137C402721240A02E40303040E0520064107C00A840B900E840F901001120693
|
||||
:4000C00013901684179019011A841B481C081DFC1E221F0221C122182324268427902B9C2CE72E10300733E0351F36F83A023B084204460E480449FF4AFF4BFF4F83580B46
|
||||
:40010000590B5A045B045C995D095F01868088028A8190E7921094019686980F9A409C0F9E20A2E0A618A804AA81AE80B207B4F8D80BDC09DF010022022003010524084089
|
||||
:4001400009080A080B400C420D200E2010021108130215801610172119011A011C241E201F0C210422082308284029042B88312032643301382039883A013B804240528017
|
||||
:400180005A215B4A600461016218634278027C028280C06FC2FFC4FDCA07CC0FCE0FD001D60FD80FDE8103140404050806110710081F0A800C010E1E0FE4101F124015102D
|
||||
:4001C00016E0178218021A111B141C1F1E20211023212408261127142B142D1F2F4032F0330F360F37F03A083B80580B590B5B045C995F018203830884618608873088204C
|
||||
:4002000089108A508B828DC78E108F2892109304961C97C49A109B04A061A110A204A341A440A630A704AB04AC7CAE02AF04B01FB30FB460B5F4BB08D80BD90BDB04DC99FF
|
||||
:40024000DF01012A02200301040805400708081009080B8C0C420E200F04104211081504180819221A0C1B011C221D4C1E211F4820042218242025442731285029402B8839
|
||||
:400280002C022E042F883204331134103508380439813A103D8C3E016230680269806A806D4078027C029308942096E897809C029D249F61A403A50CA620A781AA01AB0889
|
||||
:4002C000C0EFC2FEC42DCAFFCC67CEDFDE81E208021004400620080C0C010E0210081101140818051A081C04200828202AC02CE02F0130603280341E3501360138203E40ED
|
||||
:400300005608580459045B045C995D905F0181608209842487108A128B108F10903F93039407950197089B1C9D40A036A209A310A710A82DA901AA12AB04AC40AD7CAF0220
|
||||
:40034000B11FB238B440B540B607B720BE10D608D80BD90BDB04DC99DD90DF01000201280302040A070409980B800C020E20104212081550170119281A401B401E201FA0A5
|
||||
:4003800022102662274828022C022E052F043302364237283C203D803F0558805D80600267016B026D106F017C0287208B848F4091409205930496409B209C029F48A0124A
|
||||
:4003C000A140A208A620A780AD01AE08C07FC23FC4DBCAF8CCF1CEF0D618D818DE80E208E408EA040104020F0440068008700A800C800E200F0110011106130114081602E9
|
||||
:40040000170218011C0F1EF0200124072608288029052A102B022C082E04310736FF3E403F01580459045B045F018001811C820283E18402852087C0880489828B218C0248
|
||||
:400440008D088F10900491FF940495089710980599029C049D04A002A1FCA402A520A740A802AC03AE04AF02B007B3FCB503BB20BE01D804D904DB04DC90DF010081012440
|
||||
:4004800004450520084009080A080B810C080D010E020F041008120113861544172219011C0220042114222C23282740280229012B202D1030083180321033023705396892
|
||||
:4004C0003A013D82588068066C016D806F048004810184048F0191109220940A9780980299209B019C409F04A401A598A702A880A980AF02C0FFC2FFC4FFCA2BCCCFCE9F8E
|
||||
:40050000D608E24CE402E605EA04EC02EE0C06010B0410041304160119021C022101240829042C013001310232043304340236083701380239083E553F45560858045904A9
|
||||
:400540005B045D905F0183018A029501A401AC02B401B501B602B880B920BE50BF10D804D904DB04DF01030804080D800F50100212101410154019101A021E2A1F022210BD
|
||||
:40058000250226882C802F083308372138023F10584059105DA45E01645266106A406C076D406F09800282C085808608890293409980AF40C022C2B0C4A5CAA0CCA2CE2157
|
||||
:4005C000D6FCD8F0EA04EE0C9980E208E448EA049980B180E208018002200608070108280B100C020D210E2C1028110F1434152117081828192F1C101E021F2F202821210D
|
||||
:40060000230224022740282829212B042C202D212E012F0E321F336035803620371F39083E443F1040524720482049FF4AFF4BFF4D204EF05110580459045A045B045C9038
|
||||
:400640005D095F01610862406340648066406740800F810183028503861087FC88208A018B048C208DFF8E0290039302942395809608970499049A409B209D049E2F9FF9AF
|
||||
:40068000A023A104A20CA308A423A504A604A740A82FA904AB10AF02B060B3FFB460B61FB822BF04D804D904DB04DC09DF01012202200301040205040608070209880A04D5
|
||||
:4006C0000B800C080D800E48118012081305144015051610171019881C401D401E041F602118228023112410284129082A102D202E402F6030083240331234013680372A63
|
||||
:40070000381039423A083C063D803F1041104980510159025A0269806C016D806F0285018D409004914592C2930494429604979199249A089B3B9D40A009A180A22CA548B8
|
||||
:40074000A722AC02B704C0FFC2FFC47FCAFFCCFFCEFFD004D208E402E808EE1200FF01880403054606FC07B8080C09880A100C0C0EF10F0112081510160417A0180C198849
|
||||
:400780001A401C011D421E021F04218822022480259A260C2720280C29882A202E022F0431C132FF333F35C137C139A23E043F04580459045B045C905F01800282058521EF
|
||||
:4007C000870288028C0291279403950896049B389D049F01A118A340A706AC02AF01B006B107B310B401B560B708BE10BF40C006C5ECC803C9FFCAFFCBFFD004D601D8046C
|
||||
:40080000D904DA04DB04DC99DD09DF01E2C00020010203020406056007100A200C010D800E040F1013801542172819131D042003218022D5240425102605278128102901DB
|
||||
:400840002A802D202E402F603180321433023680372838043C043D803F11481049104B0264016701684869476A406C02728873068410860194419546978799209B2C9F827A
|
||||
:40088000A228A448A598A601A722AB40B002B481C0FBC2F4C4F1CAFBCC7FCEF2D204E220E604EA4082108A018E048F029222960197109D209F20A214A302B080B104B6017C
|
||||
:4008C000E220EA10EC808F209F20AF10B211B520E412EE021B011F083240330836843B408140C630CCF0CE10E62030803204358037083A023D408480914096809740A6046A
|
||||
:40090000AE80AF01CCF0CE60E210508057208580968897409D809E02A604AB08D460E210EA20832284808E02968097409E02A480A620A720AA24AE04E230E620EC80EE30D9
|
||||
:400940001501C4045D828740B101D605EE011B04850287108D8097809D82A480A880C608E4020B880C800F108A109798A480A740AB44AF04C20FE404262080018A01974061
|
||||
:40098000A280A302A620AA40B680C820E620EE8052805302551070017E0190029202A110A280A302AF40B510D4E0DC80DE20EE40052008040E020F801F1053805610588014
|
||||
:4009C00063028E208F809A109D20A740B120C001C20DC601D407D602E002E402EA04762084809A209C80AF10B004B301B601DE04E801EA08EE01010109010B010D011101C4
|
||||
:400A00001B0100FF01AB020211050000BF0000A09F001F000000000000000000100000004000000000000000C0000000FF0000B847004700000100008000000282008200DC
|
||||
:400A400000000000000707000700000027001801270018010004000000050000000000000000000000000000000000000000000000000000000000000000000000000000D8
|
||||
:400A80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000036
|
||||
:400AC00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000F6
|
||||
:400B000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000B5
|
||||
:400B40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000075
|
||||
:400B80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035
|
||||
:400BC00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000F5
|
||||
@@ -4615,12 +4615,12 @@
|
||||
:0200000490105A
|
||||
:04000000BC90ACAF55
|
||||
:0200000490303A
|
||||
:0200000090D09E
|
||||
:02000000FEBF41
|
||||
:0200000490402A
|
||||
:4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0
|
||||
:400040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080
|
||||
:400080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040
|
||||
:4000C0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
:0200000490501A
|
||||
:0C00000000012E16106900002E30A139FE
|
||||
:0C00000000012E16106900002E300F28A1
|
||||
:00000001FF
|
||||
@@ -816,7 +816,7 @@
|
||||
<Group key="v1">
|
||||
<Data key="cy_boot" value="cy_boot_v6_10" />
|
||||
<Data key="Em_EEPROM_Dynamic" value="Em_EEPROM_Dynamic_v2_20" />
|
||||
<Data key="LIN_Dynamic" value="LIN_Dynamic_v6_0" />
|
||||
<Data key="LIN_Dynamic" value="LIN_Dynamic_v5_0" />
|
||||
</Group>
|
||||
</Group>
|
||||
<Data key="DataVersionKey" value="2" />
|
||||
|
||||
@@ -26,6 +26,13 @@
|
||||
<PropertyDeltas />
|
||||
</CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b>
|
||||
<CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtFileSerialize" version="3" xml_contents_version="1">
|
||||
<CyGuid_31768f72-0253-412b-af77-e7dba74d1330 type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtItemSerialize" version="2" name="patcher.vbs" persistent="patcher.vbs">
|
||||
<Hidden v="False" />
|
||||
</CyGuid_31768f72-0253-412b-af77-e7dba74d1330>
|
||||
<build_action v="OTHER;;;;" />
|
||||
<PropertyDeltas />
|
||||
</CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b>
|
||||
<CyGuid_8b8ab257-35d3-4473-b57b-36315200b38b type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtFileSerialize" version="3" xml_contents_version="1">
|
||||
<CyGuid_31768f72-0253-412b-af77-e7dba74d1330 type_name="CyDesigner.Common.ProjMgmt.Model.CyPrjMgmtItemSerialize" version="2" name="protocol.h" persistent="..\protocol.h">
|
||||
<Hidden v="False" />
|
||||
</CyGuid_31768f72-0253-412b-af77-e7dba74d1330>
|
||||
@@ -3294,7 +3301,7 @@
|
||||
<name_val_pair name="c9323d49-d323-40b8-9b59-cc008d68a989@Release@CortexM3@Linker@Optimization@SHARED Optimization Level" v="" />
|
||||
<name_val_pair name="c9323d49-d323-40b8-9b59-cc008d68a989@Release@CortexM3@Linker@Optimization@SHARED Link Time Optimization" v="" />
|
||||
<name_val_pair name="c9323d49-d323-40b8-9b59-cc008d68a989@Release@CortexM3@Linker@Optimization@SHARED Fat LTO objects" v="" />
|
||||
<name_val_pair name="c9323d49-d323-40b8-9b59-cc008d68a989@Release@CortexM3@User Commands@General@Pre Build Commands" v="" />
|
||||
<name_val_pair name="c9323d49-d323-40b8-9b59-cc008d68a989@Release@CortexM3@User Commands@General@Pre Build Commands" v="cscript patcher.vbs" />
|
||||
<name_val_pair name="c9323d49-d323-40b8-9b59-cc008d68a989@Release@CortexM3@User Commands@General@Post Build Commands" v="" />
|
||||
</name>
|
||||
</platform>
|
||||
|
||||
@@ -23,49 +23,36 @@ module Sampler (
|
||||
|
||||
reg [5:0] counter;
|
||||
|
||||
reg index_q;
|
||||
reg rdata_q;
|
||||
|
||||
reg index_edge;
|
||||
reg rdata_edge;
|
||||
|
||||
reg req_toggle;
|
||||
|
||||
reg rdata_toggle;
|
||||
reg old_rdata_toggle;
|
||||
|
||||
reg index_toggle;
|
||||
reg old_index_toggle;
|
||||
|
||||
always @(posedge rdata)
|
||||
begin
|
||||
rdata_toggle <= ~rdata_toggle;
|
||||
end
|
||||
|
||||
always @(posedge index)
|
||||
begin
|
||||
index_toggle <= ~index_toggle;
|
||||
end
|
||||
|
||||
always @(posedge sampleclock)
|
||||
begin
|
||||
if (reset)
|
||||
begin
|
||||
old_rdata_toggle <= 0;
|
||||
old_index_toggle <= 0;
|
||||
|
||||
index_edge <= 0;
|
||||
rdata_edge <= 0;
|
||||
index_q <= 0;
|
||||
rdata_q <= 0;
|
||||
counter <= 0;
|
||||
req_toggle <= 0;
|
||||
end
|
||||
else
|
||||
begin
|
||||
/* If data_toggle or index_toggle have changed state, this means that they've
|
||||
* gone high since the last sampleclock. */
|
||||
/* Both index and rdata are active high -- positive-going edges
|
||||
* indicate the start of an index pulse and read pulse, respectively.
|
||||
*/
|
||||
|
||||
index_edge <= index_toggle != old_index_toggle;
|
||||
old_index_toggle <= index_toggle;
|
||||
index_edge <= index && !index_q;
|
||||
index_q <= index;
|
||||
|
||||
rdata_edge <= rdata_toggle != old_rdata_toggle;
|
||||
old_rdata_toggle <= rdata_toggle;
|
||||
rdata_edge <= rdata && !rdata_q;
|
||||
rdata_q <= rdata;
|
||||
|
||||
if (rdata_edge || index_edge || (counter == 6'h3f)) begin
|
||||
opcode <= { rdata_edge, index_edge, counter };
|
||||
|
||||
Binary file not shown.
@@ -147,7 +147,7 @@ static void set_drive_flags(struct set_drive_frame* flags)
|
||||
|
||||
current_drive_flags = *flags;
|
||||
DRIVESELECT_REG_Write(flags->drive ? 2 : 1); /* select drive 1 or 0 */
|
||||
DENSITY_REG_Write(!flags->high_density); /* double density bit */
|
||||
DENSITY_REG_Write(flags->high_density); /* density bit */
|
||||
INDEX_REG_Write(flags->index_mode);
|
||||
}
|
||||
|
||||
@@ -937,75 +937,3 @@ int main(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const uint8_t USBFS_MSOS_CONFIGURATION_DESCR[USBFS_MSOS_CONF_DESCR_LENGTH] = {
|
||||
/* Length of the descriptor 4 bytes */ 0x28u, 0x00u, 0x00u, 0x00u,
|
||||
/* Version of the descriptor 2 bytes */ 0x00u, 0x01u,
|
||||
/* wIndex - Fixed:INDEX_CONFIG_DESCRIPTOR */ 0x04u, 0x00u,
|
||||
/* bCount - Count of device functions. */ 0x01u,
|
||||
/* Reserved : 7 bytes */ 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
|
||||
/* bFirstInterfaceNumber */ 0x00u,
|
||||
/* Reserved */ 0x01u,
|
||||
/* compatibleId - "WINUSB\0\0" */ 'W', 'I', 'N', 'U', 'S', 'B', 0, 0,
|
||||
/* subcompatibleID - "00001\0\0" */ '0', '0', '0', '0', '1',
|
||||
0x00u, 0x00u, 0x00u,
|
||||
/* Reserved : 6 bytes */ 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u
|
||||
};
|
||||
|
||||
const uint8_t USBFS_MSOS_EXTENDED_PROPERTIES_DESCR[224] = {
|
||||
/* Length; 4 bytes */ 224, 0, 0, 0,
|
||||
/* Version; 2 bytes */ 0x00, 0x01, /* 1.0 */
|
||||
/* wIndex */ 0x05, 0x00,
|
||||
/* Number of sections */ 0x01, 0x00,
|
||||
/* Property section size */ 214, 0, 0, 0,
|
||||
/* Property data type */ 0x07, 0x00, 0x00, 0x00, /* 7 = REG_MULTI_SZ Unicode */
|
||||
/* Property name length */ 42, 0,
|
||||
/* Property name */ 'D', 0, 'e', 0, 'v', 0, 'i', 0, 'c', 0, 'e', 0,
|
||||
'I', 0, 'n', 0, 't', 0, 'e', 0, 'r', 0, 'f', 0,
|
||||
'a', 0, 'c', 0, 'e', 0, 'G', 0, 'U', 0, 'I', 0,
|
||||
'D', 0, 's', 0, 0, 0,
|
||||
/* Property data length */ 158, 0, 0, 0,
|
||||
/* GUID #1 data */ '{', 0, '3', 0, 'd', 0, '2', 0, '7', 0, '5', 0,
|
||||
'c', 0, 'f', 0, 'e', 0, '-', 0, '5', 0, '4', 0,
|
||||
'3', 0, '5', 0, '-', 0, '4', 0, 'd', 0, 'd', 0,
|
||||
'5', 0, '-', 0, 'a', 0, 'c', 0, 'c', 0, 'a', 0,
|
||||
'-', 0, '9', 0, 'f', 0, 'b', 0, '9', 0, '9', 0,
|
||||
'5', 0, 'e', 0, '2', 0, 'f', 0, '6', 0, '3', 0,
|
||||
'8', 0, '}', 0, '\0', 0,
|
||||
/* GUID #2 data */ '{', 0, '3', 0, 'd', 0, '2', 0, '7', 0, '5', 0,
|
||||
'c', 0, 'f', 0, 'e', 0, '-', 0, '5', 0, '4', 0,
|
||||
'3', 0, '5', 0, '-', 0, '4', 0, 'd', 0, 'd', 0,
|
||||
'5', 0, '-', 0, 'a', 0, 'c', 0, 'c', 0, 'a', 0,
|
||||
'-', 0, '9', 0, 'f', 0, 'b', 0, '9', 0, '9', 0,
|
||||
'5', 0, 'e', 0, '2', 0, 'f', 0, '6', 0, '3', 0,
|
||||
'8', 0, '}', 0, '\0', 0, '\0', 0
|
||||
};
|
||||
|
||||
uint8 USBFS_HandleVendorRqst(void)
|
||||
{
|
||||
if (!(USBFS_bmRequestTypeReg & USBFS_RQST_DIR_D2H))
|
||||
return false;
|
||||
|
||||
switch (USBFS_bRequestReg)
|
||||
{
|
||||
case USBFS_GET_EXTENDED_CONFIG_DESCRIPTOR:
|
||||
switch (USBFS_wIndexLoReg)
|
||||
{
|
||||
case 4:
|
||||
USBFS_currentTD.pData = (volatile uint8 *) &USBFS_MSOS_CONFIGURATION_DESCR[0u];
|
||||
USBFS_currentTD.count = USBFS_MSOS_CONFIGURATION_DESCR[0u];
|
||||
return USBFS_InitControlRead();
|
||||
|
||||
case 5:
|
||||
USBFS_currentTD.pData = (volatile uint8 *) &USBFS_MSOS_EXTENDED_PROPERTIES_DESCR[0u];
|
||||
USBFS_currentTD.count = USBFS_MSOS_EXTENDED_PROPERTIES_DESCR[0u];
|
||||
return USBFS_InitControlRead();
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
18
FluxEngine.cydsn/patcher.vbs
Normal file
18
FluxEngine.cydsn/patcher.vbs
Normal file
@@ -0,0 +1,18 @@
|
||||
const READ = 1
|
||||
const WRITE = 2
|
||||
|
||||
filename = "Generated_Source\PSoC5\USBFS_descr.c"
|
||||
set fso = CreateObject("Scripting.FileSystemObject")
|
||||
|
||||
set file = fso.OpenTextFile(filename, READ)
|
||||
text = file.ReadAll
|
||||
file.Close
|
||||
|
||||
set r = New RegExp
|
||||
r.MultiLine = True
|
||||
r.Pattern = "/\* +compatibleID.*\n.*"
|
||||
text = r.replace(text, "'W', 'I', 'N', 'U', 'S', 'B', 0, 0,")
|
||||
|
||||
set file = fso.CreateTextFile(filename, True)
|
||||
file.Write text
|
||||
file.Close
|
||||
43
Makefile
43
Makefile
@@ -1,26 +1,17 @@
|
||||
PACKAGES = zlib sqlite3 protobuf
|
||||
PACKAGES = zlib sqlite3 libusb-1.0 protobuf gtk+-3.0
|
||||
|
||||
export CFLAGS = \
|
||||
-ffunction-sections -fdata-sections
|
||||
export CFLAGS = -ffunction-sections -fdata-sections
|
||||
export CXXFLAGS = $(CFLAGS) \
|
||||
-x c++ --std=gnu++2a \
|
||||
--std=gnu++2a \
|
||||
-Wno-deprecated-enum-enum-conversion \
|
||||
-Wno-deprecated-enum-float-conversion
|
||||
export LDFLAGS = -pthread
|
||||
|
||||
export COPTFLAGS = -Os
|
||||
export LDOPTFLAGS = -Os
|
||||
export LDOPTFLAGS = -Os -ldl
|
||||
|
||||
export CDBGFLAGS = -O0 -g
|
||||
export LDDBGFLAGS = -O0 -g
|
||||
|
||||
ifeq ($(OS), Windows_NT)
|
||||
else
|
||||
ifeq ($(shell uname),Darwin)
|
||||
else
|
||||
PACKAGES += libudev
|
||||
endif
|
||||
endif
|
||||
export LDDBGFLAGS = -O0 -g -ldl
|
||||
|
||||
ifeq ($(OS), Windows_NT)
|
||||
export PROTOC = /mingw32/bin/protoc
|
||||
@@ -29,13 +20,9 @@ export CXX = /mingw32/bin/g++
|
||||
export AR = /mingw32/bin/ar rc
|
||||
export RANLIB = /mingw32/bin/ranlib
|
||||
export STRIP = /mingw32/bin/strip
|
||||
export CFLAGS += -I/mingw32/include
|
||||
export CXXFLAGS += $(shell wx-config --cxxflags --static=yes)
|
||||
export GUILDFLAGS += -lmingw32
|
||||
export LIBS += -L/mingw32/lib -static -lsqlite3 \
|
||||
$(shell wx-config --libs --static=yes core base) -lz \
|
||||
-lcomctl32 -loleaut32 -lspoolss -loleacc -lwinspool \
|
||||
-lsetupapi -lwinusb -lole32 -lprotobuf -luuid
|
||||
export CFLAGS += -I/mingw32/include/libusb-1.0 -I/mingw32/include
|
||||
export LDFLAGS +=
|
||||
export LIBS += -L/mingw32/lib -static -lz -lsqlite3 -lusb-1.0 -lprotobuf
|
||||
export EXTENSION = .exe
|
||||
else
|
||||
|
||||
@@ -44,10 +31,6 @@ ifneq ($(packages-exist),yes)
|
||||
$(warning These pkg-config packages are installed: $(shell pkg-config --list-all | sort | awk '{print $$1}'))
|
||||
$(error You must have these pkg-config packages installed: $(PACKAGES))
|
||||
endif
|
||||
wx-exist = $(shell wx-config --cflags > /dev/null && echo yes)
|
||||
ifneq ($(wx-exist),yes)
|
||||
$(error You must have these wx-config installed)
|
||||
endif
|
||||
|
||||
export PROTOC = protoc
|
||||
export CC = gcc
|
||||
@@ -55,20 +38,14 @@ export CXX = g++
|
||||
export AR = ar rc
|
||||
export RANLIB = ranlib
|
||||
export STRIP = strip
|
||||
export CFLAGS += $(shell pkg-config --cflags $(PACKAGES)) $(shell wx-config --cxxflags)
|
||||
export CFLAGS += $(shell pkg-config --cflags $(PACKAGES))
|
||||
export LDFLAGS +=
|
||||
export LIBS += $(shell pkg-config --libs $(PACKAGES))
|
||||
export GUILIBS += $(shell wx-config --libs core base)
|
||||
export EXTENSION =
|
||||
|
||||
ifeq ($(shell uname),Darwin)
|
||||
AR = ar rcS
|
||||
RANLIB += -c -no_warning_for_no_symbols
|
||||
export CC = clang
|
||||
export CXX = clang++
|
||||
export COBJC = clang
|
||||
export LDFLAGS += -framework IOKit -framework CoreFoundation
|
||||
export CFLAGS += -Wno-deprecated-declarations
|
||||
endif
|
||||
|
||||
endif
|
||||
@@ -91,5 +68,3 @@ clean:
|
||||
@mkdir -p $(OBJDIR)
|
||||
@sh $< > $@
|
||||
|
||||
compdb:
|
||||
@ninja -f .obj/build.ninja -t compdb > compile_commands.json
|
||||
|
||||
22
README.md
22
README.md
@@ -2,7 +2,7 @@ FluxEngine
|
||||
==========
|
||||
|
||||
(If you're reading this on GitHub, the formatting's a bit messed up. [Try the
|
||||
version on cowlark.com instead.](http://cowlark.com/fluxengine/))
|
||||
version on cowlark.com instead.](http://cowlark.com/fluxengine/)
|
||||
|
||||
**Breaking news!** As of 2021-05-21, the command line environment has changed
|
||||
_substantially_ (to make it more consistent and flexible, and allow some new
|
||||
@@ -93,19 +93,16 @@ people who've had it work).
|
||||
| Format | Read? | Write? | Notes |
|
||||
|:------------------------------------------|:-----:|:------:|-------|
|
||||
| [IBM PC compatible](doc/disk-ibm.md) | 🦄 | 🦄 | and compatibles (like the Atari ST) |
|
||||
| [Atari ST](doc/disk-atarist.md) | 🦄 | 🦄 | technically the same as IBM, almost |
|
||||
| [Acorn ADFS](doc/disk-acornadfs.md) | 🦄 | 🦖* | single- and double- sided |
|
||||
| [Acorn DFS](doc/disk-acorndfs.md) | 🦄 | 🦖* | |
|
||||
| [Ampro Little Board](doc/disk-ampro.md) | 🦖 | 🦖* | |
|
||||
| [Apple II DOS 3.3](doc/disk-apple2.md) | 🦄 | 🦖 | doesn't do logical sector remapping |
|
||||
| [Apple II DOS 3.3](doc/disk-apple2.md) | 🦄 | | doesn't do logical sector remapping |
|
||||
| [Amiga](doc/disk-amiga.md) | 🦄 | 🦄 | |
|
||||
| [Commodore 64 1541/1581](doc/disk-c64.md) | 🦄 | 🦄 | and probably the other formats |
|
||||
| [Brother 120kB](doc/disk-brother.md) | 🦄 | 🦄 | |
|
||||
| [Brother 120kB](doc/disk-brother.md) | 🦄 | 🦖 | |
|
||||
| [Brother 240kB](doc/disk-brother.md) | 🦄 | 🦄 | |
|
||||
| [Brother FB-100](doc/disk-fb100.md) | 🦖 | | Tandy Model 100, Husky Hunter, knitting machines |
|
||||
| [Macintosh 400kB/800kB](doc/disk-macintosh.md) | 🦄 | 🦄 | |
|
||||
| [NEC PC-98](doc/disk-ibm.md) | 🦄 | 🦄 | trimode drive not required |
|
||||
| [Sharp X68000](doc/disk-ibm.md) | 🦄 | 🦄 | |
|
||||
| [Macintosh 800kB](doc/disk-macintosh.md) | 🦄 | 🦄 | and probably the 400kB too |
|
||||
| [TRS-80](doc/disk-trs80.md) | 🦖 | 🦖* | a minor variation of the IBM scheme |
|
||||
{: .datatable }
|
||||
|
||||
@@ -128,9 +125,9 @@ at least, check the CRC so what data's there is probably good.
|
||||
| [DVK MX](doc/disk-mx.md) | 🦖 | | Soviet PDP-11 clone |
|
||||
| [VDS Eco1](doc/disk-eco1.md) | 🦖 | | 8" mixed format |
|
||||
| [Micropolis](doc/disk-micropolis.md) | 🦄 | | Micropolis 100tpi drives |
|
||||
| [Northstar](doc/disk-northstar.md) | 🦖 | 🦖 | 5.25" hard sectors |
|
||||
| [Northstar(doc/disk-northstar.md) | 🦖 | 🦖 | 5.25" hard sectors |
|
||||
| [TI DS990 FD1000](doc/disk-tids990.md) | 🦄 | 🦄 | 8" |
|
||||
| [Victor 9000](doc/disk-victor9k.md) | 🦖 | | 5.25" GCR encoded |
|
||||
| [Victor 9000](doc/disk-victor9k.md) | 🦖 | | 8" |
|
||||
| [Zilog MCZ](doc/disk-zilogmcz.md) | 🦖 | | 8" _and_ hard sectors |
|
||||
{: .datatable }
|
||||
|
||||
@@ -149,7 +146,7 @@ at least, check the CRC so what data's there is probably good.
|
||||
There hasn't been a lot of demand for this yet; if you have a pressing
|
||||
need to write weird disks, [please
|
||||
ask](https://github.com/davidgiven/fluxengine/issues/new). I haven't
|
||||
implemented write support for PC disks because they're boring and I'm lazy,
|
||||
implement write support for PC disks because they're boring and I'm lazy,
|
||||
and also because they vary so much that figuring out how to specify them
|
||||
is hard.
|
||||
|
||||
@@ -233,6 +230,7 @@ As an exception, `dep/snowhouse` contains the snowhouse assertion library,
|
||||
taken from https://github.com/banditcpp/snowhouse. It is Boost Standard License
|
||||
1.0 licensed. Please see the contents of the directory for the full text.
|
||||
|
||||
As an exception, `dep/libusbp` contains the libusbp library, taken from
|
||||
https://github.com/pololu/libusbp. It is MIT licensed. Please see the contents
|
||||
As an exception, `dep/libui` contains the libui GUI library, taken from
|
||||
https://github.com/andlabs/libui. It is MIT licensed. Please see the contents
|
||||
of the directory for the full text.
|
||||
|
||||
|
||||
@@ -30,14 +30,17 @@ public:
|
||||
AbstractDecoder(config)
|
||||
{}
|
||||
|
||||
nanoseconds_t advanceToNextRecord() override
|
||||
RecordType advanceToNextRecord()
|
||||
{
|
||||
return seekToPattern(SECTOR_PATTERN);
|
||||
_sector->clock = _fmr->seekToPattern(SECTOR_PATTERN);
|
||||
if (_fmr->eof() || !_sector->clock)
|
||||
return UNKNOWN_RECORD;
|
||||
return SECTOR_RECORD;
|
||||
}
|
||||
|
||||
void decodeSectorRecord() override
|
||||
void decodeSectorRecord()
|
||||
{
|
||||
/* Skip ID mark (we know it's a AESLANIER_RECORD_SEPARATOR). */
|
||||
/* Skip ID mark. */
|
||||
|
||||
readRawBits(16);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#define AMIGA_TRACKS_PER_DISK 80
|
||||
#define AMIGA_SECTORS_PER_TRACK 11
|
||||
#define AMIGA_RECORD_SIZE 0x21c
|
||||
#define AMIGA_RECORD_SIZE 0x21f
|
||||
|
||||
extern std::unique_ptr<AbstractDecoder> createAmigaDecoder(const DecoderProto& config);
|
||||
extern std::unique_ptr<AbstractEncoder> createAmigaEncoder(const EncoderProto& config);
|
||||
|
||||
@@ -29,23 +29,23 @@ public:
|
||||
_config(config.amiga())
|
||||
{}
|
||||
|
||||
nanoseconds_t advanceToNextRecord() override
|
||||
RecordType advanceToNextRecord() override
|
||||
{
|
||||
return seekToPattern(SECTOR_PATTERN);
|
||||
_sector->clock = _fmr->seekToPattern(SECTOR_PATTERN);
|
||||
if (_fmr->eof() || !_sector->clock)
|
||||
return UNKNOWN_RECORD;
|
||||
return SECTOR_RECORD;
|
||||
}
|
||||
|
||||
void decodeSectorRecord() override
|
||||
{
|
||||
if (readRaw48() != AMIGA_SECTOR_RECORD)
|
||||
return;
|
||||
|
||||
const auto& rawbits = readRawBits(AMIGA_RECORD_SIZE*16);
|
||||
if (rawbits.size() < (AMIGA_RECORD_SIZE*16))
|
||||
return;
|
||||
const auto& rawbytes = toBytes(rawbits).slice(0, AMIGA_RECORD_SIZE*2);
|
||||
const auto& bytes = decodeFmMfm(rawbits).slice(0, AMIGA_RECORD_SIZE);
|
||||
|
||||
const uint8_t* ptr = bytes.begin();
|
||||
const uint8_t* ptr = bytes.begin() + 3;
|
||||
|
||||
Bytes header = amigaDeinterleave(ptr, 4);
|
||||
Bytes recoveryinfo = amigaDeinterleave(ptr, 16);
|
||||
@@ -55,12 +55,12 @@ public:
|
||||
_sector->logicalSector = header[2];
|
||||
|
||||
uint32_t wantedheaderchecksum = amigaDeinterleave(ptr, 4).reader().read_be32();
|
||||
uint32_t gotheaderchecksum = amigaChecksum(rawbytes.slice(0, 40));
|
||||
uint32_t gotheaderchecksum = amigaChecksum(rawbytes.slice(6, 40));
|
||||
if (gotheaderchecksum != wantedheaderchecksum)
|
||||
return;
|
||||
|
||||
uint32_t wanteddatachecksum = amigaDeinterleave(ptr, 4).reader().read_be32();
|
||||
uint32_t gotdatachecksum = amigaChecksum(rawbytes.slice(56, 1024));
|
||||
uint32_t gotdatachecksum = amigaChecksum(rawbytes.slice(62, 1024));
|
||||
|
||||
Bytes data;
|
||||
data.writer().append(amigaDeinterleave(ptr, 512)).append(recoveryinfo);
|
||||
@@ -76,7 +76,6 @@ public:
|
||||
|
||||
private:
|
||||
const AmigaDecoderProto& _config;
|
||||
nanoseconds_t _clock;
|
||||
};
|
||||
|
||||
std::unique_ptr<AbstractDecoder> createAmigaDecoder(const DecoderProto& config)
|
||||
|
||||
@@ -51,7 +51,7 @@ static void write_bits(std::vector<bool>& bits, unsigned& cursor, const Bytes& b
|
||||
}
|
||||
}
|
||||
|
||||
static void write_sector(std::vector<bool>& bits, unsigned& cursor, const std::shared_ptr<const Sector>& sector)
|
||||
static void write_sector(std::vector<bool>& bits, unsigned& cursor, const std::shared_ptr<Sector>& sector)
|
||||
{
|
||||
if ((sector->data.size() != 512) && (sector->data.size() != 528))
|
||||
Error() << "unsupported sector size --- you must pick 512 or 528";
|
||||
@@ -74,7 +74,6 @@ static void write_sector(std::vector<bool>& bits, unsigned& cursor, const std::s
|
||||
write_interleaved_bytes(b);
|
||||
};
|
||||
|
||||
write_bits(bits, cursor, 0xaaaa, 2*8);
|
||||
write_bits(bits, cursor, AMIGA_SECTOR_RECORD, 6*8);
|
||||
|
||||
checksum = 0;
|
||||
@@ -105,9 +104,9 @@ public:
|
||||
_config(config.amiga()) {}
|
||||
|
||||
public:
|
||||
std::vector<std::shared_ptr<const Sector>> collectSectors(int physicalTrack, int physicalSide, const Image& image) override
|
||||
std::vector<std::shared_ptr<Sector>> collectSectors(int physicalTrack, int physicalSide, const Image& image) override
|
||||
{
|
||||
std::vector<std::shared_ptr<const Sector>> sectors;
|
||||
std::vector<std::shared_ptr<Sector>> sectors;
|
||||
|
||||
if ((physicalTrack >= 0) && (physicalTrack < AMIGA_TRACKS_PER_DISK))
|
||||
{
|
||||
@@ -123,7 +122,7 @@ public:
|
||||
}
|
||||
|
||||
std::unique_ptr<Fluxmap> encode(int physicalTrack, int physicalSide,
|
||||
const std::vector<std::shared_ptr<const Sector>>& sectors, const Image& image) override
|
||||
const std::vector<std::shared_ptr<Sector>>& sectors, const Image& image) override
|
||||
{
|
||||
if ((physicalTrack < 0) || (physicalTrack >= AMIGA_TRACKS_PER_DISK))
|
||||
return std::unique_ptr<Fluxmap>();
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
#ifndef APPLE2_H
|
||||
#define APPLE2_H
|
||||
|
||||
#include <memory.h>
|
||||
#include "decoders/decoders.h"
|
||||
#include "encoders/encoders.h"
|
||||
|
||||
#define APPLE2_SECTOR_RECORD 0xd5aa96
|
||||
#define APPLE2_DATA_RECORD 0xd5aaad
|
||||
|
||||
@@ -12,7 +8,6 @@
|
||||
#define APPLE2_ENCODED_SECTOR_LENGTH 342
|
||||
|
||||
extern std::unique_ptr<AbstractDecoder> createApple2Decoder(const DecoderProto& config);
|
||||
extern std::unique_ptr<AbstractEncoder> createApple2Encoder(const EncoderProto& config);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2,4 +2,3 @@ syntax = "proto2";
|
||||
|
||||
message Apple2DecoderProto {}
|
||||
|
||||
message Apple2EncoderProto {}
|
||||
|
||||
@@ -71,15 +71,21 @@ public:
|
||||
AbstractDecoder(config)
|
||||
{}
|
||||
|
||||
nanoseconds_t advanceToNextRecord() override
|
||||
RecordType advanceToNextRecord()
|
||||
{
|
||||
return seekToPattern(ANY_RECORD_PATTERN);
|
||||
const FluxMatcher* matcher = nullptr;
|
||||
_sector->clock = _fmr->seekToPattern(ANY_RECORD_PATTERN, matcher);
|
||||
if (matcher == &SECTOR_RECORD_PATTERN)
|
||||
return RecordType::SECTOR_RECORD;
|
||||
if (matcher == &DATA_RECORD_PATTERN)
|
||||
return RecordType::DATA_RECORD;
|
||||
return RecordType::UNKNOWN_RECORD;
|
||||
}
|
||||
|
||||
void decodeSectorRecord() override
|
||||
void decodeSectorRecord()
|
||||
{
|
||||
if (readRaw24() != APPLE2_SECTOR_RECORD)
|
||||
return;
|
||||
/* Skip ID (as we know it's a APPLE2_SECTOR_RECORD). */
|
||||
readRawBits(24);
|
||||
|
||||
/* Read header. */
|
||||
|
||||
@@ -90,57 +96,23 @@ public:
|
||||
_sector->logicalTrack = combine(br.read_be16());
|
||||
_sector->logicalSector = combine(br.read_be16());
|
||||
uint8_t checksum = combine(br.read_be16());
|
||||
|
||||
// If the checksum is correct, upgrade the sector from MISSING
|
||||
// to DATA_MISSING in anticipation of its data record
|
||||
if (checksum == (volume ^ _sector->logicalTrack ^ _sector->logicalSector))
|
||||
_sector->status = Sector::DATA_MISSING; /* unintuitive but correct */
|
||||
}
|
||||
|
||||
void decodeDataRecord() override
|
||||
void decodeDataRecord()
|
||||
{
|
||||
/* Check ID. */
|
||||
|
||||
if (readRaw24() != APPLE2_DATA_RECORD)
|
||||
Bytes bytes = toBytes(readRawBits(3*8)).slice(0, 3);
|
||||
if (bytes.reader().read_be24() != APPLE2_DATA_RECORD)
|
||||
return;
|
||||
|
||||
// Sometimes there's a 1-bit gap between APPLE2_DATA_RECORD and
|
||||
// the data itself. This has been seen on real world disks
|
||||
// such as the Apple II Operating System Kit from Apple2Online.
|
||||
// However, I haven't seen it described in any of the various
|
||||
// references.
|
||||
//
|
||||
// This extra '0' bit would not affect the real disk interface,
|
||||
// as it was a '1' reaching the top bit of a shift register
|
||||
// that triggered a byte to be available, but it affects the
|
||||
// way the data is read here.
|
||||
//
|
||||
// While the floppies tested only seemed to need this applied
|
||||
// to the first byte of the data record, applying it
|
||||
// consistently to all of them doesn't seem to hurt, and
|
||||
// simplifies the code.
|
||||
|
||||
/* Read and decode data. */
|
||||
|
||||
auto readApple8 = [&]() {
|
||||
auto result = 0;
|
||||
while((result & 0x80) == 0) {
|
||||
auto b = readRawBits(1);
|
||||
if(b.empty()) break;
|
||||
result = (result << 1) | b[0];
|
||||
}
|
||||
return result;
|
||||
};
|
||||
unsigned recordLength = APPLE2_ENCODED_SECTOR_LENGTH + 2;
|
||||
bytes = toBytes(readRawBits(recordLength*8)).slice(0, recordLength);
|
||||
|
||||
constexpr unsigned recordLength = APPLE2_ENCODED_SECTOR_LENGTH+2;
|
||||
uint8_t bytes[recordLength];
|
||||
for(auto &byte : bytes) {
|
||||
byte = readApple8();
|
||||
}
|
||||
|
||||
// Upgrade the sector from MISSING to BAD_CHECKSUM.
|
||||
// If decode_crazy_data succeeds, it upgrades the sector to
|
||||
// OK.
|
||||
_sector->status = Sector::BAD_CHECKSUM;
|
||||
_sector->data = decode_crazy_data(&bytes[0], _sector->status);
|
||||
}
|
||||
|
||||
@@ -1,185 +0,0 @@
|
||||
#include "globals.h"
|
||||
#include "arch/apple2/apple2.h"
|
||||
#include "decoders/decoders.h"
|
||||
#include "encoders/encoders.h"
|
||||
#include "sector.h"
|
||||
#include "writer.h"
|
||||
#include "image.h"
|
||||
#include "fmt/format.h"
|
||||
#include "lib/encoders/encoders.pb.h"
|
||||
#include <ctype.h>
|
||||
#include "bytes.h"
|
||||
|
||||
static int encode_data_gcr(uint8_t data) {
|
||||
switch(data)
|
||||
{
|
||||
#define GCR_ENTRY(gcr, data) \
|
||||
case data: return gcr;
|
||||
#include "data_gcr.h"
|
||||
#undef GCR_ENTRY
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
class Apple2Encoder : public AbstractEncoder
|
||||
{
|
||||
public:
|
||||
Apple2Encoder(const EncoderProto& config):
|
||||
AbstractEncoder(config)
|
||||
{}
|
||||
|
||||
public:
|
||||
std::vector<std::shared_ptr<const Sector>> collectSectors(int physicalTrack, int physicalSide, const Image& image) override
|
||||
{
|
||||
std::vector<std::shared_ptr<const Sector>> sectors;
|
||||
constexpr auto numSectors = 16;
|
||||
if (physicalSide == 0)
|
||||
{
|
||||
int logicalTrack = physicalTrack / 2;
|
||||
unsigned numSectors = 16;
|
||||
for (int sectorId=0; sectorId<numSectors; sectorId++)
|
||||
{
|
||||
const auto& sector = image.get(logicalTrack, 0, sectorId);
|
||||
if (sector)
|
||||
sectors.push_back(sector);
|
||||
}
|
||||
}
|
||||
|
||||
return sectors;
|
||||
}
|
||||
|
||||
std::unique_ptr<Fluxmap> encode(int physicalTrack, int physicalSide,
|
||||
const std::vector<std::shared_ptr<const Sector>>& sectors, const Image& image) override
|
||||
{
|
||||
if (physicalSide != 0)
|
||||
return std::unique_ptr<Fluxmap>();
|
||||
|
||||
int logicalTrack = physicalTrack / 2;
|
||||
double clockRateUs = 4.;
|
||||
|
||||
// apple2 drives spin at 300rpm. 300/minute in us = 200000.
|
||||
int bitsPerRevolution = 200000.0 / clockRateUs;
|
||||
|
||||
std::vector<bool> bits(bitsPerRevolution);
|
||||
unsigned cursor = 0;
|
||||
|
||||
for (const auto& sector : sectors) {
|
||||
if(sector) {
|
||||
writeSector(bits, cursor, *sector);
|
||||
}
|
||||
}
|
||||
|
||||
if (cursor >= bits.size())
|
||||
Error() << fmt::format("track data overrun by {} bits", cursor - bits.size());
|
||||
fillBitmapTo(bits, cursor, bits.size(), { true, false });
|
||||
|
||||
std::unique_ptr<Fluxmap> fluxmap(new Fluxmap);
|
||||
fluxmap->appendBits(bits, clockRateUs*1e3);
|
||||
return fluxmap;
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t volume_id = 254;
|
||||
|
||||
/* This is extremely inspired by the MESS implementation, written by Nathan Woods
|
||||
* and R. Belmont: https://github.com/mamedev/mame/blob/7914a6083a3b3a8c243ae6c3b8cb50b023f21e0e/src/lib/formats/ap2_dsk.cpp
|
||||
* as well as Understanding the Apple II (1983) Chapter 9
|
||||
* https://archive.org/details/Understanding_the_Apple_II_1983_Quality_Software/page/n230/mode/1up?view=theater
|
||||
*/
|
||||
|
||||
void writeSector(std::vector<bool>& bits, unsigned& cursor, const Sector& sector) const
|
||||
{
|
||||
if ((sector.status == Sector::OK) or (sector.status == Sector::BAD_CHECKSUM))
|
||||
{
|
||||
auto write_bit = [&](bool val) {
|
||||
if(cursor <= bits.size()) { bits[cursor] = val; }
|
||||
cursor++;
|
||||
};
|
||||
|
||||
auto write_bits = [&](uint32_t bits, int width) {
|
||||
for(int i=width; i--;) {
|
||||
write_bit(bits & (1u << i));
|
||||
}
|
||||
};
|
||||
|
||||
auto write_gcr44 = [&](uint8_t value) {
|
||||
write_bits((value << 7) | value | 0xaaaa, 16);
|
||||
};
|
||||
|
||||
auto write_gcr6 = [&](uint8_t value) {
|
||||
write_bits(encode_data_gcr(value), 8);
|
||||
};
|
||||
|
||||
// The special "FF40" sequence is used to synchronize the receiving
|
||||
// shift register. It's written as "1111 1111 00"; FF indicates the
|
||||
// 8 consecutive 1-bits, while "40" indicates the total number of
|
||||
// microseconds.
|
||||
auto write_ff40 = [&](int n=1) {
|
||||
for(;n--;) {
|
||||
write_bits(0xff << 2, 10);
|
||||
}
|
||||
};
|
||||
|
||||
// There is data to encode to disk.
|
||||
if ((sector.data.size() != APPLE2_SECTOR_LENGTH))
|
||||
Error() << fmt::format("unsupported sector size {} --- you must pick 256", sector.data.size());
|
||||
|
||||
// Write address syncing leader : A sequence of "FF40"s; 5 of them
|
||||
// are said to suffice to synchronize the decoder.
|
||||
// "FF40" indicates that the actual data written is "1111
|
||||
// 1111 00" i.e., 8 1s and a total of 40 microseconds
|
||||
//
|
||||
// In standard formatting, the first logical sector apparently gets
|
||||
// extra padding.
|
||||
write_ff40(sector.logicalSector == 0 ? 32 : 8);
|
||||
|
||||
// Write address field: APPLE2_SECTOR_RECORD + sector identifier + DE AA EB
|
||||
write_bits(APPLE2_SECTOR_RECORD, 24);
|
||||
write_gcr44(volume_id);
|
||||
write_gcr44(sector.logicalTrack);
|
||||
write_gcr44(sector.logicalSector);
|
||||
write_gcr44(volume_id ^ sector.logicalTrack ^ sector.logicalSector);
|
||||
write_bits(0xDEAAEB, 24);
|
||||
|
||||
// Write data syncing leader: FF40 + APPLE2_DATA_RECORD + sector data + sum + DE AA EB (+ mystery bits cut off of the scan?)
|
||||
write_ff40(8);
|
||||
write_bits(APPLE2_DATA_RECORD, 24);
|
||||
|
||||
// Convert the sector data to GCR, append the checksum, and write it out
|
||||
constexpr auto TWOBIT_COUNT = 0x56; // Size of the 'twobit' area at the start of the GCR data
|
||||
uint8_t checksum = 0;
|
||||
for(int i=0; i<APPLE2_ENCODED_SECTOR_LENGTH; i++) {
|
||||
int value;
|
||||
if(i >= TWOBIT_COUNT) {
|
||||
value = sector.data[i - TWOBIT_COUNT] >> 2;
|
||||
} else {
|
||||
uint8_t tmp = sector.data[i];
|
||||
value = ((tmp & 1) << 1) | ((tmp & 2) >> 1);
|
||||
|
||||
tmp = sector.data[i + TWOBIT_COUNT];
|
||||
value |= ((tmp & 1) << 3) | ((tmp & 2) << 1);
|
||||
|
||||
if(i + 2*TWOBIT_COUNT < APPLE2_SECTOR_LENGTH) {
|
||||
tmp = sector.data[i + 2*TWOBIT_COUNT];
|
||||
value |= ((tmp & 1) << 5) | ((tmp & 2) << 3);
|
||||
}
|
||||
}
|
||||
checksum ^= value;
|
||||
// assert(checksum & ~0x3f == 0);
|
||||
write_gcr6(checksum);
|
||||
checksum = value;
|
||||
}
|
||||
if(sector.status == Sector::BAD_CHECKSUM) checksum ^= 0x3f;
|
||||
write_gcr6(checksum);
|
||||
write_bits(0xDEAAEB, 24);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<AbstractEncoder> createApple2Encoder(const EncoderProto& config)
|
||||
{
|
||||
return std::unique_ptr<AbstractEncoder>(new Apple2Encoder(config));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "globals.h"
|
||||
#include "sql.h"
|
||||
#include "fluxmap.h"
|
||||
#include "decoders/fluxmapreader.h"
|
||||
#include "decoders/decoders.h"
|
||||
@@ -59,16 +60,20 @@ public:
|
||||
AbstractDecoder(config)
|
||||
{}
|
||||
|
||||
nanoseconds_t advanceToNextRecord() override
|
||||
RecordType advanceToNextRecord()
|
||||
{
|
||||
return seekToPattern(ANY_RECORD_PATTERN);
|
||||
const FluxMatcher* matcher = nullptr;
|
||||
_sector->clock = _fmr->seekToPattern(ANY_RECORD_PATTERN, matcher);
|
||||
if (matcher == &SECTOR_RECORD_PATTERN)
|
||||
return RecordType::SECTOR_RECORD;
|
||||
if (matcher == &DATA_RECORD_PATTERN)
|
||||
return RecordType::DATA_RECORD;
|
||||
return RecordType::UNKNOWN_RECORD;
|
||||
}
|
||||
|
||||
void decodeSectorRecord() override
|
||||
void decodeSectorRecord()
|
||||
{
|
||||
if (readRaw32() != BROTHER_SECTOR_RECORD)
|
||||
return;
|
||||
|
||||
readRawBits(32);
|
||||
const auto& rawbits = readRawBits(32);
|
||||
const auto& bytes = toBytes(rawbits).slice(0, 4);
|
||||
|
||||
@@ -86,10 +91,9 @@ public:
|
||||
_sector->status = Sector::DATA_MISSING;
|
||||
}
|
||||
|
||||
void decodeDataRecord() override
|
||||
void decodeDataRecord()
|
||||
{
|
||||
if (readRaw32() != BROTHER_DATA_RECORD)
|
||||
return;
|
||||
readRawBits(32);
|
||||
|
||||
const auto& rawbits = readRawBits(BROTHER_DATA_RECORD_ENCODED_SIZE*8);
|
||||
const auto& rawbytes = toBytes(rawbits).slice(0, BROTHER_DATA_RECORD_ENCODED_SIZE);
|
||||
|
||||
@@ -109,10 +109,11 @@ public:
|
||||
{}
|
||||
|
||||
public:
|
||||
std::vector<std::shared_ptr<const Sector>> collectSectors(int physicalTrack, int physicalSide, const Image& image) override
|
||||
std::vector<std::shared_ptr<Sector>> collectSectors(int physicalTrack, int physicalSide, const Image& image) override
|
||||
{
|
||||
std::vector<std::shared_ptr<const Sector>> sectors;
|
||||
std::vector<std::shared_ptr<Sector>> sectors;
|
||||
|
||||
int logicalTrack;
|
||||
if (physicalSide != 0)
|
||||
return sectors;
|
||||
physicalTrack -= _config.bias();
|
||||
@@ -122,17 +123,19 @@ public:
|
||||
if ((physicalTrack < 0) || (physicalTrack >= (BROTHER_TRACKS_PER_120KB_DISK*2))
|
||||
|| (physicalTrack & 1))
|
||||
return sectors;
|
||||
logicalTrack = physicalTrack/2;
|
||||
break;
|
||||
|
||||
case BROTHER240:
|
||||
if ((physicalTrack < 0) || (physicalTrack >= BROTHER_TRACKS_PER_240KB_DISK))
|
||||
return sectors;
|
||||
logicalTrack = physicalTrack;
|
||||
break;
|
||||
}
|
||||
|
||||
for (int sectorId=0; sectorId<BROTHER_SECTORS_PER_TRACK; sectorId++)
|
||||
{
|
||||
const auto& sector = image.get(physicalTrack, 0, sectorId);
|
||||
const auto& sector = image.get(logicalTrack, 0, sectorId);
|
||||
if (sector)
|
||||
sectors.push_back(sector);
|
||||
}
|
||||
@@ -141,8 +144,9 @@ public:
|
||||
}
|
||||
|
||||
std::unique_ptr<Fluxmap> encode(int physicalTrack, int physicalSide,
|
||||
const std::vector<std::shared_ptr<const Sector>>& sectors, const Image& image) override
|
||||
const std::vector<std::shared_ptr<Sector>>& sectors, const Image& image) override
|
||||
{
|
||||
int logicalTrack;
|
||||
if (physicalSide != 0)
|
||||
return std::unique_ptr<Fluxmap>();
|
||||
physicalTrack -= _config.bias();
|
||||
@@ -152,11 +156,13 @@ public:
|
||||
if ((physicalTrack < 0) || (physicalTrack >= (BROTHER_TRACKS_PER_120KB_DISK*2))
|
||||
|| (physicalTrack & 1))
|
||||
return std::unique_ptr<Fluxmap>();
|
||||
logicalTrack = physicalTrack/2;
|
||||
break;
|
||||
|
||||
case BROTHER240:
|
||||
if ((physicalTrack < 0) || (physicalTrack >= BROTHER_TRACKS_PER_240KB_DISK))
|
||||
return std::unique_ptr<Fluxmap>();
|
||||
logicalTrack = physicalTrack;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -173,10 +179,10 @@ public:
|
||||
double dataMs = headerMs + _config.post_header_spacing_ms();
|
||||
unsigned dataCursor = dataMs*1e3 / _config.clock_rate_us();
|
||||
|
||||
const auto& sectorData = image.get(physicalTrack, 0, sectorId);
|
||||
const auto& sectorData = image.get(logicalTrack, 0, sectorId);
|
||||
|
||||
fillBitmapTo(bits, cursor, headerCursor, { true, false });
|
||||
write_sector_header(bits, cursor, sectorData->logicalTrack, sectorId);
|
||||
write_sector_header(bits, cursor, logicalTrack, sectorId);
|
||||
fillBitmapTo(bits, cursor, dataCursor, { true, false });
|
||||
write_sector_data(bits, cursor, sectorData->data);
|
||||
}
|
||||
|
||||
@@ -58,15 +58,20 @@ public:
|
||||
AbstractDecoder(config)
|
||||
{}
|
||||
|
||||
nanoseconds_t advanceToNextRecord() override
|
||||
RecordType advanceToNextRecord()
|
||||
{
|
||||
return seekToPattern(ANY_RECORD_PATTERN);
|
||||
const FluxMatcher* matcher = nullptr;
|
||||
_sector->clock = _fmr->seekToPattern(ANY_RECORD_PATTERN, matcher);
|
||||
if (matcher == &SECTOR_RECORD_PATTERN)
|
||||
return RecordType::SECTOR_RECORD;
|
||||
if (matcher == &DATA_RECORD_PATTERN)
|
||||
return RecordType::DATA_RECORD;
|
||||
return RecordType::UNKNOWN_RECORD;
|
||||
}
|
||||
|
||||
void decodeSectorRecord() override
|
||||
void decodeSectorRecord()
|
||||
{
|
||||
if (readRaw20() != C64_SECTOR_RECORD)
|
||||
return;
|
||||
readRawBits(20);
|
||||
|
||||
const auto& bits = readRawBits(5*10);
|
||||
const auto& bytes = decode(bits).slice(0, 5);
|
||||
@@ -79,10 +84,9 @@ public:
|
||||
_sector->status = Sector::DATA_MISSING; /* unintuitive but correct */
|
||||
}
|
||||
|
||||
void decodeDataRecord() override
|
||||
void decodeDataRecord()
|
||||
{
|
||||
if (readRaw20() != C64_DATA_RECORD)
|
||||
return;
|
||||
readRawBits(20);
|
||||
|
||||
const auto& bits = readRawBits(259*10);
|
||||
const auto& bytes = decode(bits).slice(0, 259);
|
||||
|
||||
@@ -211,9 +211,9 @@ public:
|
||||
{}
|
||||
|
||||
public:
|
||||
std::vector<std::shared_ptr<const Sector>> collectSectors(int physicalTrack, int physicalSide, const Image& image) override
|
||||
std::vector<std::shared_ptr<Sector>> collectSectors(int physicalTrack, int physicalSide, const Image& image) override
|
||||
{
|
||||
std::vector<std::shared_ptr<const Sector>> sectors;
|
||||
std::vector<std::shared_ptr<Sector>> sectors;
|
||||
|
||||
if (physicalSide == 0)
|
||||
{
|
||||
@@ -231,7 +231,7 @@ public:
|
||||
}
|
||||
|
||||
std::unique_ptr<Fluxmap> encode(int physicalTrack, int physicalSide,
|
||||
const std::vector<std::shared_ptr<const Sector>>& sectors, const Image& image) override
|
||||
const std::vector<std::shared_ptr<Sector>>& sectors, const Image& image) override
|
||||
{
|
||||
/* The format ID Character # 1 and # 2 are in the .d64 image only present
|
||||
* in track 18 sector zero which contains the BAM info in byte 162 and 163.
|
||||
@@ -278,7 +278,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
void writeSector(std::vector<bool>& bits, unsigned& cursor, std::shared_ptr<const Sector> sector) const
|
||||
void writeSector(std::vector<bool>& bits, unsigned& cursor, const std::shared_ptr<Sector>& sector) const
|
||||
{
|
||||
/* Source: http://www.unusedino.de/ec64/technical/formats/g64.html
|
||||
* 1. Header sync FF FF FF FF FF (40 'on' bits, not GCR)
|
||||
|
||||
@@ -58,17 +58,22 @@ public:
|
||||
AbstractDecoder(config)
|
||||
{}
|
||||
|
||||
nanoseconds_t advanceToNextRecord() override
|
||||
RecordType advanceToNextRecord()
|
||||
{
|
||||
return seekToPattern(ANY_RECORD_PATTERN);
|
||||
const FluxMatcher* matcher = nullptr;
|
||||
_sector->clock = _fmr->seekToPattern(ANY_RECORD_PATTERN, matcher);
|
||||
if (matcher == &SECTOR_RECORD_PATTERN)
|
||||
return RecordType::SECTOR_RECORD;
|
||||
if (matcher == &DATA_RECORD_PATTERN)
|
||||
return RecordType::DATA_RECORD;
|
||||
return RecordType::UNKNOWN_RECORD;
|
||||
}
|
||||
|
||||
void decodeSectorRecord() override
|
||||
void decodeSectorRecord()
|
||||
{
|
||||
/* Skip sync bits and ID byte. */
|
||||
|
||||
if (readRaw24() != F85_SECTOR_RECORD)
|
||||
return;
|
||||
readRawBits(24);
|
||||
|
||||
/* Read header. */
|
||||
|
||||
@@ -84,12 +89,11 @@ public:
|
||||
_sector->status = Sector::DATA_MISSING; /* unintuitive but correct */
|
||||
}
|
||||
|
||||
void decodeDataRecord() override
|
||||
void decodeDataRecord()
|
||||
{
|
||||
/* Skip sync bits ID byte. */
|
||||
|
||||
if (readRaw24() != F85_DATA_RECORD)
|
||||
return;
|
||||
readRawBits(24);
|
||||
|
||||
const auto& bytes = decode(readRawBits((F85_SECTOR_LENGTH+3)*10))
|
||||
.slice(0, F85_SECTOR_LENGTH+3);
|
||||
|
||||
@@ -104,12 +104,16 @@ public:
|
||||
AbstractDecoder(config)
|
||||
{}
|
||||
|
||||
nanoseconds_t advanceToNextRecord() override
|
||||
RecordType advanceToNextRecord()
|
||||
{
|
||||
return seekToPattern(SECTOR_ID_PATTERN);
|
||||
const FluxMatcher* matcher = nullptr;
|
||||
_sector->clock = _fmr->seekToPattern(SECTOR_ID_PATTERN, matcher);
|
||||
if (matcher == &SECTOR_ID_PATTERN)
|
||||
return RecordType::SECTOR_RECORD;
|
||||
return RecordType::UNKNOWN_RECORD;
|
||||
}
|
||||
|
||||
void decodeSectorRecord() override
|
||||
void decodeSectorRecord()
|
||||
{
|
||||
auto rawbits = readRawBits(FB100_RECORD_SIZE*16);
|
||||
|
||||
|
||||
@@ -98,149 +98,88 @@ public:
|
||||
_config(config.ibm())
|
||||
{}
|
||||
|
||||
nanoseconds_t advanceToNextRecord() override
|
||||
RecordType advanceToNextRecord() override
|
||||
{
|
||||
return seekToPattern(ANY_RECORD_PATTERN);
|
||||
const FluxMatcher* matcher = nullptr;
|
||||
_sector->clock = _fmr->seekToPattern(ANY_RECORD_PATTERN, matcher);
|
||||
|
||||
/* If this is the MFM prefix byte, the the decoder is going to expect three
|
||||
* extra bytes on the front of the header. */
|
||||
_currentHeaderLength = (matcher == &MFM_PATTERN) ? 3 : 0;
|
||||
|
||||
Fluxmap::Position here = tell();
|
||||
resetFluxDecoder();
|
||||
if (_currentHeaderLength > 0)
|
||||
readRawBits(_currentHeaderLength*16);
|
||||
auto idbits = readRawBits(16);
|
||||
const Bytes idbytes = decodeFmMfm(idbits);
|
||||
uint8_t id = idbytes.slice(0, 1)[0];
|
||||
seek(here);
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case IBM_IDAM:
|
||||
return RecordType::SECTOR_RECORD;
|
||||
|
||||
case IBM_DAM1:
|
||||
case IBM_DAM2:
|
||||
case IBM_TRS80DAM1:
|
||||
case IBM_TRS80DAM2:
|
||||
return RecordType::DATA_RECORD;
|
||||
}
|
||||
return RecordType::UNKNOWN_RECORD;
|
||||
}
|
||||
|
||||
void decodeSectorRecord() override
|
||||
{
|
||||
/* This is really annoying because the IBM record scheme has a
|
||||
* variable-sized header _and_ the checksum covers this header too. So
|
||||
* we have to read and decode a byte at a time until we know where the
|
||||
* record itself starts, saving the bytes for the checksumming later.
|
||||
*/
|
||||
|
||||
Bytes bytes;
|
||||
ByteWriter bw(bytes);
|
||||
|
||||
auto readByte = [&]() {
|
||||
auto bits = readRawBits(16);
|
||||
auto bytes = decodeFmMfm(bits).slice(0, 1);
|
||||
uint8_t byte = bytes[0];
|
||||
bw.write_8(byte);
|
||||
return byte;
|
||||
};
|
||||
|
||||
uint8_t id = readByte();
|
||||
if (id == 0xa1)
|
||||
{
|
||||
readByte();
|
||||
readByte();
|
||||
id = readByte();
|
||||
}
|
||||
if (id != IBM_IDAM)
|
||||
return;
|
||||
unsigned recordSize = _currentHeaderLength + IBM_IDAM_LEN;
|
||||
auto bits = readRawBits(recordSize*16);
|
||||
auto bytes = decodeFmMfm(bits).slice(0, recordSize);
|
||||
|
||||
ByteReader br(bytes);
|
||||
br.seek(bw.pos);
|
||||
|
||||
auto bits = readRawBits(IBM_IDAM_LEN*16);
|
||||
bw += decodeFmMfm(bits).slice(0, IBM_IDAM_LEN);
|
||||
|
||||
IbmDecoderProto::TrackdataProto trackdata;
|
||||
getTrackFormat(trackdata, _sector->physicalCylinder, _sector->physicalHead);
|
||||
|
||||
br.seek(_currentHeaderLength);
|
||||
br.read_8(); /* skip ID byte */
|
||||
_sector->logicalTrack = br.read_8();
|
||||
_sector->logicalSide = br.read_8();
|
||||
_sector->logicalSector = br.read_8();
|
||||
_currentSectorSize = 1 << (br.read_8() + 7);
|
||||
uint16_t gotCrc = crc16(CCITT_POLY, bytes.slice(0, br.pos));
|
||||
uint16_t wantCrc = br.read_be16();
|
||||
uint16_t gotCrc = crc16(CCITT_POLY, bytes.slice(0, _currentHeaderLength + 5));
|
||||
if (wantCrc == gotCrc)
|
||||
_sector->status = Sector::DATA_MISSING; /* correct but unintuitive */
|
||||
|
||||
if (trackdata.swap_sides())
|
||||
if (_config.swap_sides())
|
||||
_sector->logicalSide ^= 1;
|
||||
if (trackdata.ignore_side_byte())
|
||||
if (_config.ignore_side_byte())
|
||||
_sector->logicalSide = _sector->physicalHead;
|
||||
if (trackdata.ignore_track_byte())
|
||||
if (_config.ignore_track_byte())
|
||||
_sector->logicalTrack = _sector->physicalCylinder;
|
||||
|
||||
for (int sector : trackdata.ignore_sector())
|
||||
if (_sector->logicalSector == sector)
|
||||
{
|
||||
_sector->status = Sector::MISSING;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void decodeDataRecord() override
|
||||
{
|
||||
/* This is the same deal as the sector record. */
|
||||
|
||||
Bytes bytes;
|
||||
ByteWriter bw(bytes);
|
||||
|
||||
auto readByte = [&]() {
|
||||
auto bits = readRawBits(16);
|
||||
auto bytes = decodeFmMfm(bits).slice(0, 1);
|
||||
uint8_t byte = bytes[0];
|
||||
bw.write_8(byte);
|
||||
return byte;
|
||||
};
|
||||
|
||||
uint8_t id = readByte();
|
||||
if (id == 0xa1)
|
||||
{
|
||||
readByte();
|
||||
readByte();
|
||||
id = readByte();
|
||||
}
|
||||
if ((id != IBM_DAM1) && (id != IBM_DAM2)
|
||||
&& (id != IBM_TRS80DAM1) && (id != IBM_TRS80DAM2))
|
||||
return;
|
||||
unsigned recordLength = _currentHeaderLength + _currentSectorSize + 3;
|
||||
auto bits = readRawBits(recordLength*16);
|
||||
auto bytes = decodeFmMfm(bits).slice(0, recordLength);
|
||||
|
||||
ByteReader br(bytes);
|
||||
br.seek(bw.pos);
|
||||
|
||||
auto bits = readRawBits((_currentSectorSize + 2) * 16);
|
||||
bw += decodeFmMfm(bits).slice(0, _currentSectorSize+2);
|
||||
br.seek(_currentHeaderLength);
|
||||
br.read_8(); /* skip ID byte */
|
||||
|
||||
_sector->data = br.read(_currentSectorSize);
|
||||
uint16_t gotCrc = crc16(CCITT_POLY, bytes.slice(0, br.pos));
|
||||
uint16_t wantCrc = br.read_be16();
|
||||
uint16_t gotCrc = crc16(CCITT_POLY, bytes.slice(0, recordLength-2));
|
||||
_sector->status = (wantCrc == gotCrc) ? Sector::OK : Sector::BAD_CHECKSUM;
|
||||
}
|
||||
|
||||
std::set<unsigned> requiredSectors(unsigned cylinder, unsigned head) const override
|
||||
{
|
||||
IbmDecoderProto::TrackdataProto trackdata;
|
||||
getTrackFormat(trackdata, cylinder, head);
|
||||
|
||||
std::set<unsigned> s;
|
||||
if (trackdata.has_sectors())
|
||||
{
|
||||
for (int sectorId : trackdata.sectors().sector())
|
||||
s.insert(sectorId);
|
||||
}
|
||||
else if (trackdata.has_sector_range())
|
||||
{
|
||||
int sectorId = trackdata.sector_range().min_sector();
|
||||
while (sectorId <= trackdata.sector_range().max_sector())
|
||||
{
|
||||
s.insert(sectorId);
|
||||
sectorId++;
|
||||
}
|
||||
}
|
||||
for (int sectorId : _config.sectors().sector())
|
||||
s.insert(sectorId);
|
||||
return s;
|
||||
}
|
||||
|
||||
private:
|
||||
void getTrackFormat(IbmDecoderProto::TrackdataProto& trackdata, unsigned cylinder, unsigned head) const
|
||||
{
|
||||
trackdata.Clear();
|
||||
for (const auto& f : _config.trackdata())
|
||||
{
|
||||
if (f.has_cylinder() && (f.cylinder() != cylinder))
|
||||
continue;
|
||||
if (f.has_head() && (f.head() != head))
|
||||
continue;
|
||||
|
||||
trackdata.MergeFrom(f);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
const IbmDecoderProto& _config;
|
||||
unsigned _currentSectorSize;
|
||||
|
||||
@@ -101,36 +101,15 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
static std::set<unsigned> getSectorIds(const IbmEncoderProto::TrackdataProto& trackdata)
|
||||
{
|
||||
std::set<unsigned> s;
|
||||
if (trackdata.has_sectors())
|
||||
{
|
||||
for (int sectorId : trackdata.sectors().sector())
|
||||
s.insert(sectorId);
|
||||
}
|
||||
else if (trackdata.has_sector_range())
|
||||
{
|
||||
int sectorId = trackdata.sector_range().min_sector();
|
||||
while (sectorId <= trackdata.sector_range().max_sector())
|
||||
{
|
||||
s.insert(sectorId);
|
||||
sectorId++;
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
public:
|
||||
std::vector<std::shared_ptr<const Sector>> collectSectors(int physicalTrack, int physicalSide, const Image& image) override
|
||||
std::vector<std::shared_ptr<Sector>> collectSectors(int physicalTrack, int physicalSide, const Image& image) override
|
||||
{
|
||||
std::vector<std::shared_ptr<const Sector>> sectors;
|
||||
std::vector<std::shared_ptr<Sector>> sectors;
|
||||
IbmEncoderProto::TrackdataProto trackdata;
|
||||
getTrackFormat(trackdata, physicalTrack, physicalSide);
|
||||
|
||||
int logicalSide = physicalSide ^ trackdata.swap_sides();
|
||||
for (int sectorId : getSectorIds(trackdata))
|
||||
for (int sectorId : trackdata.sectors().sector())
|
||||
{
|
||||
const auto& sector = image.get(physicalTrack, logicalSide, sectorId);
|
||||
if (sector)
|
||||
@@ -141,7 +120,7 @@ public:
|
||||
}
|
||||
|
||||
std::unique_ptr<Fluxmap> encode(int physicalTrack, int physicalSide,
|
||||
const std::vector<std::shared_ptr<const Sector>>& sectors, const Image& image) override
|
||||
const std::vector<std::shared_ptr<Sector>>& sectors, const Image& image) override
|
||||
{
|
||||
IbmEncoderProto::TrackdataProto trackdata;
|
||||
getTrackFormat(trackdata, physicalTrack, physicalSide);
|
||||
@@ -154,17 +133,11 @@ public:
|
||||
encodeMfm(_bits, _cursor, bytes, _lastBit);
|
||||
};
|
||||
|
||||
auto writeFillerRawBytes = [&](int count, uint16_t byte)
|
||||
{
|
||||
for (int i=0; i<count; i++)
|
||||
writeRawBits(byte, 16);
|
||||
};
|
||||
|
||||
auto writeFillerBytes = [&](int count, uint8_t byte)
|
||||
{
|
||||
Bytes b { byte };
|
||||
Bytes bytes = { byte };
|
||||
for (int i=0; i<count; i++)
|
||||
writeBytes(b);
|
||||
writeBytes(bytes);
|
||||
};
|
||||
|
||||
double clockRateUs = 1e3 / trackdata.clock_rate_khz();
|
||||
@@ -187,9 +160,9 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t gapFill = trackdata.gap_fill_byte();
|
||||
uint8_t gapFill = trackdata.use_fm() ? 0x00 : 0x4e;
|
||||
|
||||
writeFillerRawBytes(trackdata.gap0(), gapFill);
|
||||
writeFillerBytes(trackdata.gap0(), gapFill);
|
||||
if (trackdata.emit_iam())
|
||||
{
|
||||
writeFillerBytes(trackdata.use_fm() ? 6 : 12, 0x00);
|
||||
@@ -199,7 +172,7 @@ public:
|
||||
writeRawBits(MFM_IAM_SEPARATOR, 16);
|
||||
}
|
||||
writeRawBits(trackdata.use_fm() ? FM_IAM_RECORD : MFM_IAM_RECORD, 16);
|
||||
writeFillerRawBytes(trackdata.gap1(), gapFill);
|
||||
writeFillerBytes(trackdata.gap1(), gapFill);
|
||||
}
|
||||
|
||||
int logicalSide = physicalSide ^ trackdata.swap_sides();
|
||||
@@ -207,7 +180,7 @@ public:
|
||||
for (int sectorId : trackdata.sectors().sector())
|
||||
{
|
||||
if (!first)
|
||||
writeFillerRawBytes(trackdata.gap3(), gapFill);
|
||||
writeFillerBytes(trackdata.gap3(), gapFill);
|
||||
first = false;
|
||||
|
||||
const auto& sectorData = image.get(physicalTrack, logicalSide, sectorId);
|
||||
@@ -254,7 +227,7 @@ public:
|
||||
writeBytes(header.slice(conventionalHeaderStart));
|
||||
}
|
||||
|
||||
writeFillerRawBytes(trackdata.gap2(), gapFill);
|
||||
writeFillerBytes(trackdata.gap2(), gapFill);
|
||||
|
||||
{
|
||||
Bytes data;
|
||||
@@ -291,7 +264,7 @@ public:
|
||||
if (_cursor >= _bits.size())
|
||||
Error() << "track data overrun";
|
||||
while (_cursor < _bits.size())
|
||||
writeFillerRawBytes(1, gapFill);
|
||||
writeFillerBytes(1, gapFill);
|
||||
|
||||
std::unique_ptr<Fluxmap> fluxmap(new Fluxmap);
|
||||
fluxmap->appendBits(_bits, clockRateUs*1e3);
|
||||
|
||||
@@ -2,45 +2,24 @@ syntax = "proto2";
|
||||
|
||||
import "lib/common.proto";
|
||||
|
||||
// Next: 7
|
||||
message IbmDecoderProto {
|
||||
// Next: 11
|
||||
message TrackdataProto {
|
||||
message SectorsProto {
|
||||
repeated int32 sector = 1 [(help) = "require these sectors to exist for a good read"];
|
||||
}
|
||||
message SectorRangeProto {
|
||||
optional int32 min_sector = 1 [(help) = "require these sectors to exist for a good read"];
|
||||
optional int32 max_sector = 2 [(help) = "require these sectors to exist for a good read"];
|
||||
}
|
||||
|
||||
optional int32 cylinder = 7 [(help) = "if set, the format applies only to this track"];
|
||||
optional int32 head = 8 [(help) = "if set, the format applies only to this head"];
|
||||
|
||||
optional bool ignore_side_byte = 2 [default = false, (help) = "ignore side byte in sector header"];
|
||||
optional bool ignore_track_byte = 6 [default = false, (help) = "ignore track byte in sector header"];
|
||||
optional bool swap_sides = 4 [default = false, (help) = "put logical side 1 on physical side 0"];
|
||||
|
||||
repeated int32 ignore_sector = 10 [(help) = "sectors with these IDs will not be read"];
|
||||
|
||||
oneof required_sectors {
|
||||
SectorsProto sectors = 5 [(help) = "require these sectors to exist for a good read"];
|
||||
SectorRangeProto sector_range = 9 [(help) = "require these sectors to exist for a good read"];
|
||||
}
|
||||
message SectorsProto {
|
||||
repeated int32 sector = 1 [(help) = "require these sectors to exist for a good read"];
|
||||
}
|
||||
|
||||
repeated TrackdataProto trackdata = 1;
|
||||
optional bool ignore_side_byte = 2 [default = false, (help) = "ignore side byte in sector header"];
|
||||
optional bool ignore_track_byte = 6 [default = false, (help) = "ignore track byte in sector header"];
|
||||
optional bool swap_sides = 4 [default = false, (help) = "put logical side 1 on physical side 0"];
|
||||
optional SectorsProto sectors = 5 [(help) = "require these sectors to exist for a good read"];
|
||||
}
|
||||
|
||||
message IbmEncoderProto {
|
||||
// Next: 20
|
||||
// Next: 18
|
||||
message TrackdataProto {
|
||||
message SectorsProto {
|
||||
repeated int32 sector = 1 [(help) = "write these sectors (in order) on each track"];
|
||||
}
|
||||
message SectorRangeProto {
|
||||
optional int32 min_sector = 1 [(help) = "write these sectors (in order) on each track"];
|
||||
optional int32 max_sector = 2 [(help) = "write these sectors (in order) on each track"];
|
||||
}
|
||||
|
||||
optional int32 cylinder = 15 [(help) = "if set, the format applies only to this track"];
|
||||
optional int32 head = 16 [(help) = "if set, the format applies only to this head"];
|
||||
@@ -57,12 +36,7 @@ message IbmEncoderProto {
|
||||
optional int32 gap2 = 11 [default=22, (help) = "size of gap 3 (the pre-data gap)"];
|
||||
optional int32 gap3 = 12 [default=80, (help) = "size of gap 4 (the post-data or format gap)"];
|
||||
optional bool swap_sides = 14 [default=false, (help) = "swap side bytes when writing"];
|
||||
optional int32 gap_fill_byte = 18 [default=0x9254, (help) = "16-bit raw bit pattern of gap fill byte"];
|
||||
|
||||
oneof required_sectors {
|
||||
SectorsProto sectors = 17 [(help) = "require these sectors to exist for a good read"];
|
||||
SectorRangeProto sector_range = 19 [(help) = "require these sectors to exist for a good read"];
|
||||
}
|
||||
optional SectorsProto sectors = 17 [(help) = "write these sectors (in order) on each track"];
|
||||
}
|
||||
|
||||
repeated TrackdataProto trackdata = 1;
|
||||
|
||||
@@ -129,15 +129,21 @@ public:
|
||||
AbstractDecoder(config)
|
||||
{}
|
||||
|
||||
nanoseconds_t advanceToNextRecord() override
|
||||
RecordType advanceToNextRecord()
|
||||
{
|
||||
return seekToPattern(ANY_RECORD_PATTERN);
|
||||
const FluxMatcher* matcher = nullptr;
|
||||
_sector->clock = _fmr->seekToPattern(ANY_RECORD_PATTERN, matcher);
|
||||
if (matcher == &SECTOR_RECORD_PATTERN)
|
||||
return SECTOR_RECORD;
|
||||
if (matcher == &DATA_RECORD_PATTERN)
|
||||
return DATA_RECORD;
|
||||
return UNKNOWN_RECORD;
|
||||
}
|
||||
|
||||
void decodeSectorRecord() override
|
||||
void decodeSectorRecord()
|
||||
{
|
||||
if (readRaw24() != MAC_SECTOR_RECORD)
|
||||
return;
|
||||
/* Skip ID (as we know it's a MAC_SECTOR_RECORD). */
|
||||
readRawBits(24);
|
||||
|
||||
/* Read header. */
|
||||
|
||||
@@ -163,9 +169,10 @@ public:
|
||||
_sector->status = Sector::DATA_MISSING; /* unintuitive but correct */
|
||||
}
|
||||
|
||||
void decodeDataRecord() override
|
||||
void decodeDataRecord()
|
||||
{
|
||||
if (readRaw24() != MAC_DATA_RECORD)
|
||||
auto id = toBytes(readRawBits(24)).reader().read_be24();
|
||||
if (id != MAC_DATA_RECORD)
|
||||
return;
|
||||
|
||||
/* Read data. */
|
||||
@@ -183,7 +190,7 @@ public:
|
||||
_sector->data.writer().append(userData.slice(12, 512)).append(userData.slice(0, 12));
|
||||
}
|
||||
|
||||
std::set<unsigned> requiredSectors(unsigned cylinder, unsigned head) const override
|
||||
std::set<unsigned> requiredSectors(unsigned cylinder, unsigned head) const
|
||||
{
|
||||
int count;
|
||||
if (cylinder < 16)
|
||||
|
||||
@@ -164,7 +164,7 @@ static uint8_t encode_side(uint8_t track, uint8_t side)
|
||||
return (side ? 0x20 : 0x00) | ((track>0x3f) ? 0x01 : 0x00);
|
||||
}
|
||||
|
||||
static void write_sector(std::vector<bool>& bits, unsigned& cursor, const std::shared_ptr<const Sector>& sector)
|
||||
static void write_sector(std::vector<bool>& bits, unsigned& cursor, const std::shared_ptr<Sector>& sector)
|
||||
{
|
||||
if ((sector->data.size() != 512) && (sector->data.size() != 524))
|
||||
Error() << "unsupported sector size --- you must pick 512 or 524";
|
||||
@@ -208,9 +208,9 @@ public:
|
||||
{}
|
||||
|
||||
public:
|
||||
std::vector<std::shared_ptr<const Sector>> collectSectors(int physicalTrack, int physicalSide, const Image& image) override
|
||||
std::vector<std::shared_ptr<Sector>> collectSectors(int physicalTrack, int physicalSide, const Image& image) override
|
||||
{
|
||||
std::vector<std::shared_ptr<const Sector>> sectors;
|
||||
std::vector<std::shared_ptr<Sector>> sectors;
|
||||
|
||||
if ((physicalTrack >= 0) && (physicalTrack < MAC_TRACKS_PER_DISK))
|
||||
{
|
||||
@@ -227,7 +227,7 @@ public:
|
||||
}
|
||||
|
||||
std::unique_ptr<Fluxmap> encode(int physicalTrack, int physicalSide,
|
||||
const std::vector<std::shared_ptr<const Sector>>& sectors, const Image& image) override
|
||||
const std::vector<std::shared_ptr<Sector>>& sectors, const Image& image) override
|
||||
{
|
||||
if ((physicalTrack < 0) || (physicalTrack >= MAC_TRACKS_PER_DISK))
|
||||
return std::unique_ptr<Fluxmap>();
|
||||
|
||||
@@ -6,20 +6,11 @@
|
||||
#include "micropolis.h"
|
||||
#include "bytes.h"
|
||||
#include "fmt/format.h"
|
||||
#include "lib/decoders/decoders.pb.h"
|
||||
|
||||
/* The sector has a preamble of MFM 0x00s and uses 0xFF as a sync pattern.
|
||||
*
|
||||
* 00 00 00 F F
|
||||
* 0000 0000 0000 0000 0000 0000 0101 0101 0101 0101
|
||||
* A A A A A A 5 5 5 5
|
||||
*/
|
||||
static const FluxPattern SECTOR_SYNC_PATTERN(64, 0xAAAAAAAAAAAA5555LL);
|
||||
/* The sector has a preamble of MFM 0x00s and uses 0xFF as a sync pattern. */
|
||||
static const FluxPattern SECTOR_SYNC_PATTERN(32, 0xaaaa5555);
|
||||
|
||||
/* Pattern to skip past current SYNC. */
|
||||
static const FluxPattern SECTOR_ADVANCE_PATTERN(64, 0xAAAAAAAAAAAAAAAALL);
|
||||
|
||||
/* Standard Micropolis checksum. Adds all bytes, with carry. */
|
||||
/* Adds all bytes, with carry. */
|
||||
uint8_t micropolisChecksum(const Bytes& bytes) {
|
||||
ByteReader br(bytes);
|
||||
uint16_t sum = 0;
|
||||
@@ -33,155 +24,48 @@ uint8_t micropolisChecksum(const Bytes& bytes) {
|
||||
return sum & 0xFF;
|
||||
}
|
||||
|
||||
/* Vector MZOS does not use the standard Micropolis checksum.
|
||||
* The checksum is initially 0.
|
||||
* For each data byte in the 256-byte payload, rotate left,
|
||||
* carrying bit 7 to bit 0. XOR with the current checksum.
|
||||
*
|
||||
* Unlike the Micropolis checksum, this does not cover the 12-byte
|
||||
* header (track, sector, 10 OS-specific bytes.)
|
||||
*/
|
||||
uint8_t mzosChecksum(const Bytes& bytes) {
|
||||
ByteReader br(bytes);
|
||||
uint8_t checksum = 0;
|
||||
uint8_t databyte;
|
||||
|
||||
while (!br.eof()) {
|
||||
databyte = br.read_8();
|
||||
checksum ^= ((databyte << 1) | (databyte >> 7));
|
||||
}
|
||||
|
||||
return checksum;
|
||||
}
|
||||
|
||||
class MicropolisDecoder : public AbstractDecoder
|
||||
{
|
||||
public:
|
||||
MicropolisDecoder(const DecoderProto& config):
|
||||
AbstractDecoder(config),
|
||||
_config(config.micropolis())
|
||||
AbstractDecoder(config)
|
||||
{}
|
||||
|
||||
RecordType advanceToNextRecord()
|
||||
{
|
||||
_checksumType = _config.checksum_type();
|
||||
_fmr->seekToIndexMark();
|
||||
const FluxMatcher* matcher = nullptr;
|
||||
_sector->clock = _fmr->seekToPattern(SECTOR_SYNC_PATTERN, matcher);
|
||||
if (matcher == &SECTOR_SYNC_PATTERN) {
|
||||
readRawBits(16);
|
||||
return SECTOR_RECORD;
|
||||
}
|
||||
return UNKNOWN_RECORD;
|
||||
}
|
||||
|
||||
nanoseconds_t advanceToNextRecord() override
|
||||
void decodeSectorRecord()
|
||||
{
|
||||
nanoseconds_t now = tell().ns();
|
||||
|
||||
/* For all but the first sector, seek to the next sector pulse.
|
||||
* The first sector does not contain the sector pulse in the fluxmap.
|
||||
*/
|
||||
if (now != 0) {
|
||||
seekToIndexMark();
|
||||
now = tell().ns();
|
||||
}
|
||||
|
||||
/* Discard a possible partial sector at the end of the track.
|
||||
* This partial sector could be mistaken for a conflicted sector, if
|
||||
* whatever data read happens to match the checksum of 0, which is
|
||||
* rare, but has been observed on some disks.
|
||||
*/
|
||||
if (now > (getFluxmapDuration() - 12.5e6)) {
|
||||
seekToIndexMark();
|
||||
return 0;
|
||||
}
|
||||
|
||||
nanoseconds_t clock = seekToPattern(SECTOR_SYNC_PATTERN);
|
||||
|
||||
auto syncDelta = tell().ns() - now;
|
||||
/* Due to the weak nature of the Micropolis SYNC patern,
|
||||
* it's possible to detect a false SYNC during the gap
|
||||
* between the sector pulse and the write gate. If the SYNC
|
||||
* is detected less than 100uS after the sector pulse, search
|
||||
* for another valid SYNC.
|
||||
*
|
||||
* Reference: Vector Micropolis Disk Controller Board Technical
|
||||
* Information Manual, pp. 1-16.
|
||||
*/
|
||||
if ((syncDelta > 0) && (syncDelta < 100e3)) {
|
||||
seekToPattern(SECTOR_ADVANCE_PATTERN);
|
||||
clock = seekToPattern(SECTOR_SYNC_PATTERN);
|
||||
}
|
||||
|
||||
_sector->headerStartTime = tell().ns();
|
||||
|
||||
/* seekToPattern() can skip past the index hole, if this happens
|
||||
* too close to the end of the Fluxmap, discard the sector.
|
||||
*/
|
||||
if (_sector->headerStartTime > (getFluxmapDuration() - 12.5e6)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return clock;
|
||||
}
|
||||
|
||||
void decodeSectorRecord() override
|
||||
{
|
||||
readRawBits(48);
|
||||
auto rawbits = readRawBits(MICROPOLIS_ENCODED_SECTOR_SIZE*16);
|
||||
auto bytes = decodeFmMfm(rawbits).slice(0, MICROPOLIS_ENCODED_SECTOR_SIZE);
|
||||
ByteReader br(bytes);
|
||||
|
||||
int syncByte = br.read_8(); /* sync */
|
||||
if (syncByte != 0xFF)
|
||||
return;
|
||||
|
||||
br.read_8(); /* sync */
|
||||
_sector->logicalTrack = br.read_8();
|
||||
_sector->logicalSide = _sector->physicalHead;
|
||||
_sector->logicalSector = br.read_8();
|
||||
if (_sector->logicalSector > 15)
|
||||
return;
|
||||
if (_sector->logicalTrack > 76)
|
||||
return;
|
||||
if (_sector->logicalTrack != _sector->physicalCylinder)
|
||||
if (_sector->logicalTrack > 77)
|
||||
return;
|
||||
|
||||
br.read(10); /* OS data or padding */
|
||||
auto data = br.read(MICROPOLIS_PAYLOAD_SIZE);
|
||||
_sector->data = br.read(256);
|
||||
uint8_t wantChecksum = br.read_8();
|
||||
|
||||
/* If not specified, automatically determine the checksum type.
|
||||
* Once the checksum type is determined, it will be used for the
|
||||
* entire disk.
|
||||
*/
|
||||
if (_checksumType == 0) {
|
||||
/* Calculate both standard Micropolis (MDOS, CP/M, OASIS) and MZOS checksums */
|
||||
if (wantChecksum == micropolisChecksum(bytes.slice(1, 2+266))) {
|
||||
_checksumType = 1;
|
||||
} else if (wantChecksum == mzosChecksum(bytes.slice(MICROPOLIS_HEADER_SIZE, MICROPOLIS_PAYLOAD_SIZE))) {
|
||||
_checksumType = 2;
|
||||
std::cout << "Note: MZOS checksum detected." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t gotChecksum;
|
||||
|
||||
if (_checksumType == 2) {
|
||||
gotChecksum = mzosChecksum(bytes.slice(MICROPOLIS_HEADER_SIZE, MICROPOLIS_PAYLOAD_SIZE));
|
||||
} else {
|
||||
gotChecksum = micropolisChecksum(bytes.slice(1, 2+266));
|
||||
}
|
||||
|
||||
uint8_t gotChecksum = micropolisChecksum(bytes.slice(1, 2+266));
|
||||
br.read(5); /* 4 byte ECC and ECC-present flag */
|
||||
|
||||
if (_config.sector_output_size() == MICROPOLIS_PAYLOAD_SIZE)
|
||||
_sector->data = data;
|
||||
else if (_config.sector_output_size() == MICROPOLIS_ENCODED_SECTOR_SIZE)
|
||||
_sector->data = bytes;
|
||||
else
|
||||
Error() << "Sector output size may only be 256 or 275";
|
||||
_sector->status = (wantChecksum == gotChecksum) ? Sector::OK : Sector::BAD_CHECKSUM;
|
||||
}
|
||||
|
||||
std::set<unsigned> requiredSectors(unsigned cylinder, unsigned head) const override
|
||||
{
|
||||
static std::set<unsigned> sectors = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
|
||||
return sectors;
|
||||
}
|
||||
|
||||
private:
|
||||
const MicropolisDecoderProto& _config;
|
||||
int _checksumType; /* -1 = auto, 1 = Micropolis, 2=MZOS */
|
||||
};
|
||||
|
||||
std::unique_ptr<AbstractDecoder> createMicropolisDecoder(const DecoderProto& config)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "image.h"
|
||||
#include "lib/encoders/encoders.pb.h"
|
||||
|
||||
static void write_sector(std::vector<bool>& bits, unsigned& cursor, const std::shared_ptr<const Sector>& sector)
|
||||
static void write_sector(std::vector<bool>& bits, unsigned& cursor, const std::shared_ptr<Sector>& sector)
|
||||
{
|
||||
if ((sector->data.size() != 256) && (sector->data.size() != MICROPOLIS_ENCODED_SECTOR_SIZE))
|
||||
Error() << "unsupported sector size --- you must pick 256 or 275";
|
||||
@@ -19,15 +19,7 @@ static void write_sector(std::vector<bool>& bits, unsigned& cursor, const std::s
|
||||
fullSector->push_back(0);
|
||||
Bytes sectorData;
|
||||
if (sector->data.size() == MICROPOLIS_ENCODED_SECTOR_SIZE)
|
||||
{
|
||||
if (sector->data[0] != 0xFF)
|
||||
Error() << "275 byte sector doesn't start with sync byte 0xFF. Corrupted sector";
|
||||
uint8_t wantChecksum = sector->data[1+2+266];
|
||||
uint8_t gotChecksum = micropolisChecksum(sector->data.slice(1, 2+266));
|
||||
if (wantChecksum != gotChecksum)
|
||||
std::cerr << "Warning: checksum incorrect. Sector: " << sector->logicalSector << std::endl;
|
||||
sectorData = sector->data;
|
||||
}
|
||||
else
|
||||
{
|
||||
ByteWriter writer(sectorData);
|
||||
@@ -70,9 +62,9 @@ public:
|
||||
_config(config.micropolis())
|
||||
{}
|
||||
|
||||
std::vector<std::shared_ptr<const Sector>> collectSectors(int physicalTrack, int physicalSide, const Image& image) override
|
||||
std::vector<std::shared_ptr<Sector>> collectSectors(int physicalTrack, int physicalSide, const Image& image) override
|
||||
{
|
||||
std::vector<std::shared_ptr<const Sector>> sectors;
|
||||
std::vector<std::shared_ptr<Sector>> sectors;
|
||||
|
||||
if ((physicalTrack >= 0) && (physicalTrack < 77))
|
||||
{
|
||||
@@ -88,7 +80,7 @@ public:
|
||||
}
|
||||
|
||||
std::unique_ptr<Fluxmap> encode(int physicalTrack, int physicalSide,
|
||||
const std::vector<std::shared_ptr<const Sector>>& sectors, const Image& image) override
|
||||
const std::vector<std::shared_ptr<Sector>>& sectors, const Image& image) override
|
||||
{
|
||||
int bitsPerRevolution = 100000;
|
||||
double clockRateUs = 2.00;
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#ifndef MICROPOLIS_H
|
||||
#define MICROPOLIS_H
|
||||
|
||||
#define MICROPOLIS_PAYLOAD_SIZE (256)
|
||||
#define MICROPOLIS_HEADER_SIZE (1+2+10)
|
||||
#define MICROPOLIS_ENCODED_SECTOR_SIZE (MICROPOLIS_HEADER_SIZE + MICROPOLIS_PAYLOAD_SIZE + 6)
|
||||
#define MICROPOLIS_ENCODED_SECTOR_SIZE (1+2+266+6)
|
||||
|
||||
class AbstractDecoder;
|
||||
class AbstractEncoder;
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
syntax = "proto2";
|
||||
|
||||
import "lib/common.proto";
|
||||
|
||||
message MicropolisDecoderProto {
|
||||
optional int32 sector_output_size = 1 [default = 256,
|
||||
(help) = "How much of the raw sector should be saved. Must be 256 or 275"];
|
||||
optional int32 checksum_type = 2 [default = 0,
|
||||
(help) = "Checksum type to use: 0 = automatically detect, 1 = Micropolis, 2 = MZOS"];
|
||||
}
|
||||
|
||||
message MicropolisDecoderProto {}
|
||||
message MicropolisEncoderProto {}
|
||||
|
||||
|
||||
@@ -16,10 +16,8 @@ const int SECTOR_SIZE = 256;
|
||||
*/
|
||||
|
||||
/* FM beginning of track marker:
|
||||
* 0 0 f 3 decoded nibbles
|
||||
* 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1
|
||||
* 1010 1010 1010 1010 1111 1111 1010 1111
|
||||
* a a a a f f a f encoded nibbles
|
||||
* a a a a f f a f
|
||||
*/
|
||||
const FluxPattern ID_PATTERN(32, 0xaaaaffaf);
|
||||
|
||||
@@ -30,52 +28,61 @@ public:
|
||||
AbstractDecoder(config)
|
||||
{}
|
||||
|
||||
void beginTrack() override
|
||||
void beginTrack()
|
||||
{
|
||||
_clock = _sector->clock = seekToPattern(ID_PATTERN);
|
||||
_currentSector = 0;
|
||||
_currentSector = -1;
|
||||
_clock = 0;
|
||||
}
|
||||
|
||||
nanoseconds_t advanceToNextRecord() override
|
||||
RecordType advanceToNextRecord()
|
||||
{
|
||||
if (_currentSector == 11)
|
||||
if (_currentSector == -1)
|
||||
{
|
||||
/* First sector in the track: look for the sync marker. */
|
||||
const FluxMatcher* matcher = nullptr;
|
||||
_sector->clock = _clock = _fmr->seekToPattern(ID_PATTERN, matcher);
|
||||
readRawBits(32); /* skip the ID mark */
|
||||
_logicalTrack = decodeFmMfm(readRawBits(32)).slice(0, 32).reader().read_be16();
|
||||
}
|
||||
else if (_currentSector == 10)
|
||||
{
|
||||
/* That was the last sector on the disk. */
|
||||
return 0;
|
||||
return UNKNOWN_RECORD;
|
||||
}
|
||||
else
|
||||
return _clock;
|
||||
{
|
||||
/* Otherwise we assume the clock from the first sector is still valid.
|
||||
* The decoder framwork will automatically stop when we hit the end of
|
||||
* the track. */
|
||||
_sector->clock = _clock;
|
||||
}
|
||||
|
||||
_currentSector++;
|
||||
return SECTOR_RECORD;
|
||||
}
|
||||
|
||||
void decodeSectorRecord() override
|
||||
void decodeSectorRecord()
|
||||
{
|
||||
/* Skip the ID pattern and track word, which is only present on the
|
||||
* first sector. We don't trust the track word because some driver
|
||||
* don't write it correctly. */
|
||||
|
||||
if (_currentSector == 0)
|
||||
readRawBits(64);
|
||||
|
||||
auto bits = readRawBits((SECTOR_SIZE+2)*16);
|
||||
auto bytes = decodeFmMfm(bits).slice(0, SECTOR_SIZE+2);
|
||||
auto bytes = decodeFmMfm(bits).slice(0, SECTOR_SIZE+2).swab();
|
||||
|
||||
uint16_t gotChecksum = 0;
|
||||
ByteReader br(bytes);
|
||||
for (int i=0; i<(SECTOR_SIZE/2); i++)
|
||||
gotChecksum += br.read_be16();
|
||||
uint16_t wantChecksum = br.read_be16();
|
||||
gotChecksum += br.read_le16();
|
||||
uint16_t wantChecksum = br.read_le16();
|
||||
|
||||
_sector->logicalTrack = _sector->physicalCylinder;
|
||||
_sector->logicalTrack = _logicalTrack;
|
||||
_sector->logicalSide = _sector->physicalHead;
|
||||
_sector->logicalSector = _currentSector;
|
||||
_sector->data = bytes.slice(0, SECTOR_SIZE).swab();
|
||||
_sector->data = bytes.slice(0, SECTOR_SIZE);
|
||||
_sector->status = (gotChecksum == wantChecksum) ? Sector::OK : Sector::BAD_CHECKSUM;
|
||||
_currentSector++;
|
||||
}
|
||||
|
||||
private:
|
||||
nanoseconds_t _clock;
|
||||
int _currentSector;
|
||||
int _logicalTrack;
|
||||
};
|
||||
|
||||
std::unique_ptr<AbstractDecoder> createMxDecoder(const DecoderProto& config)
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
#include "lib/decoders/decoders.pb.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
#define MFM_ID 0xaaaaaaaaaaaa5545LL
|
||||
#define FM_ID 0xaaaaaaaaaaaaffefLL
|
||||
/*
|
||||
* MFM sectors have 32 bytes of 00's followed by two sync characters,
|
||||
* specified in the North Star MDS manual as 0xFBFB.
|
||||
@@ -35,14 +33,14 @@
|
||||
* 0000 0000 0000 0000 0000 0000 0101 0101 0100 0101
|
||||
* A A A A A A 5 5 4 5
|
||||
*/
|
||||
static const FluxPattern MFM_PATTERN(64, MFM_ID);
|
||||
static const FluxPattern MFM_PATTERN(64, 0xAAAAAAAAAAAA5545LL);
|
||||
|
||||
/* FM sectors have 16 bytes of 00's followed by 0xFB.
|
||||
* 00 FB
|
||||
* 0000 0000 1111 1111 1110 1111
|
||||
* A A F F E F
|
||||
*/
|
||||
static const FluxPattern FM_PATTERN(64, FM_ID);
|
||||
static const FluxPattern FM_PATTERN(64, 0xAAAAAAAAAAAAFFEFLL);
|
||||
|
||||
const FluxMatchers ANY_SECTOR_PATTERN(
|
||||
{
|
||||
@@ -76,29 +74,40 @@ public:
|
||||
{}
|
||||
|
||||
/* Search for FM or MFM sector record */
|
||||
nanoseconds_t advanceToNextRecord() override
|
||||
RecordType advanceToNextRecord() override
|
||||
{
|
||||
nanoseconds_t now = tell().ns();
|
||||
nanoseconds_t now = _fmr->tell().ns();
|
||||
|
||||
/* For all but the first sector, seek to the next sector pulse.
|
||||
* The first sector does not contain the sector pulse in the fluxmap.
|
||||
*/
|
||||
if (now != 0) {
|
||||
seekToIndexMark();
|
||||
now = tell().ns();
|
||||
_fmr->seekToIndexMark();
|
||||
now = _fmr->tell().ns();
|
||||
}
|
||||
|
||||
/* Discard a possible partial sector at the end of the track.
|
||||
* This partial sector could be mistaken for a conflicted sector, if
|
||||
* whatever data read happens to match the checksum of 0, which is
|
||||
* rare, but has been observed on some disks.
|
||||
*/
|
||||
if (now > (_fmr->getDuration() - 21e6)) {
|
||||
_fmr->seekToIndexMark();
|
||||
return(UNKNOWN_RECORD);
|
||||
}
|
||||
|
||||
int msSinceIndex = std::round(now / 1e6);
|
||||
|
||||
const FluxMatcher* matcher = nullptr;
|
||||
|
||||
/* Note that the seekToPattern ignores the sector pulses, so if
|
||||
* a sector is not found for some reason, the seek will advance
|
||||
* past one or more sector pulses. For this reason, calculate
|
||||
* _hardSectorId after the sector header is found.
|
||||
*/
|
||||
nanoseconds_t clock = seekToPattern(ANY_SECTOR_PATTERN);
|
||||
_sector->headerStartTime = tell().ns();
|
||||
_sector->clock = _fmr->seekToPattern(ANY_SECTOR_PATTERN, matcher);
|
||||
|
||||
int sectorFoundTimeRaw = std::round(_sector->headerStartTime / 1e6);
|
||||
int sectorFoundTimeRaw = std::round((_fmr->tell().ns()) / 1e6);
|
||||
int sectorFoundTime;
|
||||
|
||||
/* Round time to the nearest 20ms */
|
||||
@@ -112,24 +121,30 @@ public:
|
||||
/* Calculate the sector ID based on time since the index */
|
||||
_hardSectorId = (sectorFoundTime / 20) % 10;
|
||||
|
||||
return clock;
|
||||
// std::cout << fmt::format(
|
||||
// "Sector ID {}: hole at {}ms, sector start at {}ms",
|
||||
// _hardSectorId, msSinceIndex, sectorFoundTimeRaw) << std::endl;
|
||||
|
||||
if (matcher == &MFM_PATTERN) {
|
||||
_sectorType = SECTOR_TYPE_MFM;
|
||||
readRawBits(48);
|
||||
return SECTOR_RECORD;
|
||||
}
|
||||
|
||||
if (matcher == &FM_PATTERN) {
|
||||
_sectorType = SECTOR_TYPE_FM;
|
||||
readRawBits(48);
|
||||
return SECTOR_RECORD;
|
||||
}
|
||||
|
||||
return UNKNOWN_RECORD;
|
||||
}
|
||||
|
||||
void decodeSectorRecord() override
|
||||
{
|
||||
nanoseconds_t before = tell().ns();
|
||||
uint64_t id = toBytes(readRawBits(64)).reader().read_be64();
|
||||
nanoseconds_t after = tell().ns();
|
||||
|
||||
/* Discard any sectors which span the end of a revolution. This can sometimes
|
||||
* cause spurious bad sectors which can trigger conflicts. */
|
||||
|
||||
if (int(before / 200e9) != int(after / 200e9))
|
||||
return;
|
||||
|
||||
unsigned recordSize, payloadSize, headerSize;
|
||||
|
||||
if (id == MFM_ID) {
|
||||
if (_sectorType == SECTOR_TYPE_MFM) {
|
||||
recordSize = NORTHSTAR_ENCODED_SECTOR_SIZE_DD;
|
||||
payloadSize = NORTHSTAR_PAYLOAD_SIZE_DD;
|
||||
headerSize = NORTHSTAR_HEADER_SIZE_DD;
|
||||
@@ -143,18 +158,22 @@ public:
|
||||
auto rawbits = readRawBits(recordSize * 16);
|
||||
auto bytes = decodeFmMfm(rawbits).slice(0, recordSize);
|
||||
ByteReader br(bytes);
|
||||
uint8_t sync_char;
|
||||
|
||||
_sector->logicalSide = _sector->physicalHead;
|
||||
_sector->logicalSector = _hardSectorId;
|
||||
_sector->logicalTrack = _sector->physicalCylinder;
|
||||
|
||||
if (headerSize == NORTHSTAR_HEADER_SIZE_DD) {
|
||||
br.read_8(); /* MFM second Sync char, usually 0xFB */
|
||||
sync_char = br.read_8(); /* Sync char: 0xFB */
|
||||
if (_sectorType == SECTOR_TYPE_MFM) {
|
||||
sync_char = br.read_8();/* MFM second Sync char, usually 0xFB */
|
||||
}
|
||||
|
||||
_sector->data = br.read(payloadSize);
|
||||
|
||||
uint8_t wantChecksum = br.read_8();
|
||||
uint8_t gotChecksum = northstarChecksum(bytes.slice(headerSize - 1, payloadSize));
|
||||
uint8_t gotChecksum = northstarChecksum(bytes.slice(headerSize, payloadSize));
|
||||
|
||||
_sector->status = (wantChecksum == gotChecksum) ? Sector::OK : Sector::BAD_CHECKSUM;
|
||||
}
|
||||
|
||||
@@ -166,6 +185,7 @@ public:
|
||||
|
||||
private:
|
||||
const NorthstarDecoderProto& _config;
|
||||
uint8_t _sectorType = SECTOR_TYPE_MFM;
|
||||
uint8_t _hardSectorId;
|
||||
};
|
||||
|
||||
|
||||
@@ -12,165 +12,155 @@
|
||||
#define GAP_FILL_SIZE_DD 62
|
||||
#define PRE_HEADER_GAP_FILL_SIZE_DD 16
|
||||
|
||||
#define GAP1_FILL_BYTE (0x4F)
|
||||
#define GAP2_FILL_BYTE (0x4F)
|
||||
#define GAP1_FILL_BYTE (0x4F)
|
||||
#define GAP2_FILL_BYTE (0x4F)
|
||||
|
||||
#define TOTAL_SECTOR_BYTES ()
|
||||
|
||||
static void write_sector(std::vector<bool>& bits,
|
||||
unsigned& cursor,
|
||||
const std::shared_ptr<const Sector>& sector)
|
||||
static void write_sector(std::vector<bool>& bits, unsigned& cursor, const std::shared_ptr<Sector>& sector)
|
||||
{
|
||||
int preambleSize = 0;
|
||||
int encodedSectorSize = 0;
|
||||
int preHeaderGapFillSize = 0;
|
||||
int preambleSize = 0;
|
||||
int encodedSectorSize = 0;
|
||||
int gapFillSize = 0;
|
||||
int preHeaderGapFillSize = 0;
|
||||
|
||||
bool doubleDensity;
|
||||
bool doubleDensity;
|
||||
|
||||
switch (sector->data.size())
|
||||
{
|
||||
case NORTHSTAR_PAYLOAD_SIZE_SD:
|
||||
preambleSize = NORTHSTAR_PREAMBLE_SIZE_SD;
|
||||
encodedSectorSize = PRE_HEADER_GAP_FILL_SIZE_SD +
|
||||
NORTHSTAR_ENCODED_SECTOR_SIZE_SD;
|
||||
preHeaderGapFillSize = PRE_HEADER_GAP_FILL_SIZE_SD;
|
||||
doubleDensity = false;
|
||||
break;
|
||||
switch (sector->data.size()) {
|
||||
case NORTHSTAR_PAYLOAD_SIZE_SD:
|
||||
preambleSize = NORTHSTAR_PREAMBLE_SIZE_SD;
|
||||
encodedSectorSize = PRE_HEADER_GAP_FILL_SIZE_SD + NORTHSTAR_ENCODED_SECTOR_SIZE_SD + GAP_FILL_SIZE_SD;
|
||||
gapFillSize = GAP_FILL_SIZE_SD;
|
||||
preHeaderGapFillSize = PRE_HEADER_GAP_FILL_SIZE_SD;
|
||||
doubleDensity = false;
|
||||
break;
|
||||
case NORTHSTAR_PAYLOAD_SIZE_DD:
|
||||
preambleSize = NORTHSTAR_PREAMBLE_SIZE_DD;
|
||||
encodedSectorSize = PRE_HEADER_GAP_FILL_SIZE_DD + NORTHSTAR_ENCODED_SECTOR_SIZE_DD + GAP_FILL_SIZE_DD;
|
||||
gapFillSize = GAP_FILL_SIZE_DD;
|
||||
preHeaderGapFillSize = PRE_HEADER_GAP_FILL_SIZE_DD;
|
||||
doubleDensity = true;
|
||||
break;
|
||||
default:
|
||||
Error() << "unsupported sector size --- you must pick 256 or 512";
|
||||
break;
|
||||
}
|
||||
|
||||
case NORTHSTAR_PAYLOAD_SIZE_DD:
|
||||
preambleSize = NORTHSTAR_PREAMBLE_SIZE_DD;
|
||||
encodedSectorSize = PRE_HEADER_GAP_FILL_SIZE_DD +
|
||||
NORTHSTAR_ENCODED_SECTOR_SIZE_DD;
|
||||
preHeaderGapFillSize = PRE_HEADER_GAP_FILL_SIZE_DD;
|
||||
doubleDensity = true;
|
||||
break;
|
||||
int fullSectorSize = preambleSize + encodedSectorSize;
|
||||
auto fullSector = std::make_shared<std::vector<uint8_t>>();
|
||||
fullSector->reserve(fullSectorSize);
|
||||
|
||||
default:
|
||||
Error() << "unsupported sector size --- you must pick 256 or 512";
|
||||
break;
|
||||
}
|
||||
/* sector gap after index pulse */
|
||||
for (int i = 0; i < preHeaderGapFillSize; i++)
|
||||
fullSector->push_back(GAP1_FILL_BYTE);
|
||||
|
||||
int fullSectorSize = preambleSize + encodedSectorSize;
|
||||
auto fullSector = std::make_shared<std::vector<uint8_t>>();
|
||||
fullSector->reserve(fullSectorSize);
|
||||
/* sector preamble */
|
||||
for (int i = 0; i < preambleSize; i++)
|
||||
fullSector->push_back(0);
|
||||
|
||||
/* sector gap after index pulse */
|
||||
for (int i = 0; i < preHeaderGapFillSize; i++)
|
||||
fullSector->push_back(GAP1_FILL_BYTE);
|
||||
Bytes sectorData;
|
||||
if (sector->data.size() == encodedSectorSize)
|
||||
sectorData = sector->data;
|
||||
else {
|
||||
ByteWriter writer(sectorData);
|
||||
writer.write_8(0xFB); /* sync character */
|
||||
if (doubleDensity == true) {
|
||||
writer.write_8(0xFB); /* Double-density has two sync characters */
|
||||
}
|
||||
writer += sector->data;
|
||||
if (doubleDensity == true) {
|
||||
writer.write_8(northstarChecksum(sectorData.slice(2)));
|
||||
} else {
|
||||
writer.write_8(northstarChecksum(sectorData.slice(1)));
|
||||
}
|
||||
}
|
||||
for (uint8_t b : sectorData)
|
||||
fullSector->push_back(b);
|
||||
|
||||
/* sector preamble */
|
||||
for (int i = 0; i < preambleSize; i++)
|
||||
fullSector->push_back(0);
|
||||
if (sector->logicalSector != 9) {
|
||||
/* sector postamble */
|
||||
for (int i = 0; i < gapFillSize; i++)
|
||||
fullSector->push_back(GAP2_FILL_BYTE);
|
||||
|
||||
Bytes sectorData;
|
||||
if (sector->data.size() == encodedSectorSize)
|
||||
sectorData = sector->data;
|
||||
else
|
||||
{
|
||||
ByteWriter writer(sectorData);
|
||||
writer.write_8(0xFB); /* sync character */
|
||||
if (doubleDensity == true)
|
||||
writer.write_8(0xFB); /* Double-density has two sync characters */
|
||||
if (fullSector->size() != fullSectorSize)
|
||||
Error() << "sector mismatched length (" << sector->data.size() << ") expected: " << fullSector->size() << " got " << fullSectorSize;
|
||||
} else {
|
||||
/* sector postamble */
|
||||
for (int i = 0; i < gapFillSize; i++)
|
||||
fullSector->push_back(GAP2_FILL_BYTE);
|
||||
}
|
||||
|
||||
writer += sector->data;
|
||||
if (doubleDensity == true)
|
||||
writer.write_8(northstarChecksum(sectorData.slice(2)));
|
||||
else
|
||||
writer.write_8(northstarChecksum(sectorData.slice(1)));
|
||||
}
|
||||
for (uint8_t b : sectorData)
|
||||
fullSector->push_back(b);
|
||||
bool lastBit = false;
|
||||
|
||||
if (fullSector->size() != fullSectorSize)
|
||||
Error() << "sector mismatched length (" << sector->data.size()
|
||||
<< ") expected: " << fullSector->size() << " got "
|
||||
<< fullSectorSize;
|
||||
|
||||
/* A few bytes of sector postamble just so the blank skip area doesn't start
|
||||
* immediately after the data. */
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
fullSector->push_back(GAP2_FILL_BYTE);
|
||||
|
||||
bool lastBit = false;
|
||||
|
||||
if (doubleDensity == true)
|
||||
encodeMfm(bits, cursor, fullSector, lastBit);
|
||||
else
|
||||
encodeFm(bits, cursor, fullSector);
|
||||
if (doubleDensity == true) {
|
||||
encodeMfm(bits, cursor, fullSector, lastBit);
|
||||
}
|
||||
else {
|
||||
encodeFm(bits, cursor, fullSector);
|
||||
}
|
||||
}
|
||||
|
||||
class NorthstarEncoder : public AbstractEncoder
|
||||
{
|
||||
public:
|
||||
NorthstarEncoder(const EncoderProto& config):
|
||||
AbstractEncoder(config),
|
||||
_config(config.northstar())
|
||||
{
|
||||
}
|
||||
NorthstarEncoder(const EncoderProto& config):
|
||||
AbstractEncoder(config),
|
||||
_config(config.northstar())
|
||||
{}
|
||||
|
||||
std::vector<std::shared_ptr<const Sector>> collectSectors(
|
||||
int physicalTrack, int physicalSide, const Image& image) override
|
||||
{
|
||||
std::vector<std::shared_ptr<const Sector>> sectors;
|
||||
std::vector<std::shared_ptr<Sector>> collectSectors(int physicalTrack, int physicalSide, const Image& image) override
|
||||
{
|
||||
std::vector<std::shared_ptr<Sector>> sectors;
|
||||
|
||||
if ((physicalTrack >= 0) && (physicalTrack < 35))
|
||||
{
|
||||
for (int sectorId = 0; sectorId < 10; sectorId++)
|
||||
{
|
||||
const auto& sector =
|
||||
image.get(physicalTrack, physicalSide, sectorId);
|
||||
if (sector)
|
||||
sectors.push_back(sector);
|
||||
}
|
||||
}
|
||||
if ((physicalTrack >= 0) && (physicalTrack < 35))
|
||||
{
|
||||
for (int sectorId = 0; sectorId < 10; sectorId++)
|
||||
{
|
||||
const auto& sector = image.get(physicalTrack, physicalSide, sectorId);
|
||||
if (sector)
|
||||
sectors.push_back(sector);
|
||||
}
|
||||
}
|
||||
|
||||
return sectors;
|
||||
}
|
||||
return sectors;
|
||||
}
|
||||
|
||||
std::unique_ptr<Fluxmap> encode(int physicalTrack,
|
||||
int physicalSide,
|
||||
const std::vector<std::shared_ptr<const Sector>>& sectors,
|
||||
const Image& image) override
|
||||
{
|
||||
int bitsPerRevolution = 100000;
|
||||
double clockRateUs = 4.00;
|
||||
std::unique_ptr<Fluxmap> encode(int physicalTrack, int physicalSide,
|
||||
const std::vector<std::shared_ptr<Sector>>& sectors, const Image& image) override
|
||||
{
|
||||
int bitsPerRevolution = 100000;
|
||||
double clockRateUs = 4.00;
|
||||
|
||||
if ((physicalTrack < 0) || (physicalTrack >= 35) || sectors.empty())
|
||||
return std::unique_ptr<Fluxmap>();
|
||||
if ((physicalTrack < 0) || (physicalTrack >= 35) || sectors.empty())
|
||||
return std::unique_ptr<Fluxmap>();
|
||||
|
||||
const auto& sector = *sectors.begin();
|
||||
if (sector->data.size() == NORTHSTAR_PAYLOAD_SIZE_SD)
|
||||
bitsPerRevolution /= 2; // FM
|
||||
else
|
||||
clockRateUs /= 2.00;
|
||||
const auto& sector = *sectors.begin();
|
||||
if (sector->data.size() == NORTHSTAR_PAYLOAD_SIZE_SD) {
|
||||
bitsPerRevolution /= 2; // FM
|
||||
} else {
|
||||
clockRateUs /= 2.00;
|
||||
}
|
||||
|
||||
auto fluxmap = std::make_unique<Fluxmap>();
|
||||
bool first = true;
|
||||
for (const auto& sectorData : sectors)
|
||||
{
|
||||
if (!first)
|
||||
fluxmap->appendIndex();
|
||||
first = false;
|
||||
std::vector<bool> bits(bitsPerRevolution);
|
||||
unsigned cursor = 0;
|
||||
|
||||
std::vector<bool> bits(bitsPerRevolution);
|
||||
unsigned cursor = 0;
|
||||
write_sector(bits, cursor, sectorData);
|
||||
fluxmap->appendBits(bits, clockRateUs * 1e3);
|
||||
}
|
||||
for (const auto& sectorData : sectors)
|
||||
write_sector(bits, cursor, sectorData);
|
||||
|
||||
// if (fluxmap->duration() > 200e6)
|
||||
// Error() << "track data overrun";
|
||||
if (cursor > bits.size())
|
||||
Error() << "track data overrun";
|
||||
|
||||
return fluxmap;
|
||||
}
|
||||
std::unique_ptr<Fluxmap> fluxmap(new Fluxmap);
|
||||
fluxmap->appendBits(bits, clockRateUs * 1e3);
|
||||
return fluxmap;
|
||||
}
|
||||
|
||||
private:
|
||||
const NorthstarEncoderProto& _config;
|
||||
const NorthstarEncoderProto& _config;
|
||||
};
|
||||
|
||||
std::unique_ptr<AbstractEncoder> createNorthstarEncoder(
|
||||
const EncoderProto& config)
|
||||
std::unique_ptr<AbstractEncoder> createNorthstarEncoder(const EncoderProto& config)
|
||||
{
|
||||
return std::unique_ptr<AbstractEncoder>(new NorthstarEncoder(config));
|
||||
return std::unique_ptr<AbstractEncoder>(new NorthstarEncoder(config));
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
#define NORTHSTAR_ENCODED_SECTOR_SIZE_SD (NORTHSTAR_HEADER_SIZE_SD + NORTHSTAR_PAYLOAD_SIZE_SD + NORTHSTAR_CHECKSUM_SIZE)
|
||||
#define NORTHSTAR_ENCODED_SECTOR_SIZE_DD (NORTHSTAR_HEADER_SIZE_DD + NORTHSTAR_PAYLOAD_SIZE_DD + NORTHSTAR_CHECKSUM_SIZE)
|
||||
|
||||
#define SECTOR_TYPE_MFM (0)
|
||||
#define SECTOR_TYPE_FM (1)
|
||||
|
||||
class AbstractDecoder;
|
||||
class AbstractEncoder;
|
||||
class EncoderProto;
|
||||
|
||||
@@ -23,19 +23,17 @@
|
||||
* When shifted out of phase, the special 0xa1 byte becomes an illegal
|
||||
* encoding (you can't do 10 00). So this can't be spoofed by user data.
|
||||
*/
|
||||
const uint16_t SECTOR_ID = 0x550a;
|
||||
const FluxPattern SECTOR_RECORD_PATTERN(32, 0x11112244);
|
||||
|
||||
/*
|
||||
* Data record:
|
||||
* data: 0 1 0 1 0 1 0 1 .0 0 0 0 1 0 1 1 = 0x550b
|
||||
* data: 0 1 0 1 0 1 0 1 .0 0 0 0 1 0 1 1 = 0x550c
|
||||
* mfm: 00 01 00 01 00 01 00 01.00 10 10 10 01 00 01 01 = 0x11112a45
|
||||
* special: 00 01 00 01 00 01 00 01.00 10 00 10 01 00 01 01 = 0x11112245
|
||||
* ^^
|
||||
* When shifted out of phase, the special 0xa1 byte becomes an illegal
|
||||
* encoding (you can't do 10 00). So this can't be spoofed by user data.
|
||||
*/
|
||||
const uint16_t DATA_ID = 0x550b;
|
||||
const FluxPattern DATA_RECORD_PATTERN(32, 0x11112245);
|
||||
|
||||
const FluxMatchers ANY_RECORD_PATTERN({ &SECTOR_RECORD_PATTERN, &DATA_RECORD_PATTERN });
|
||||
@@ -47,22 +45,26 @@ public:
|
||||
AbstractDecoder(config)
|
||||
{}
|
||||
|
||||
nanoseconds_t advanceToNextRecord() override
|
||||
RecordType advanceToNextRecord()
|
||||
{
|
||||
return seekToPattern(ANY_RECORD_PATTERN);
|
||||
const FluxMatcher* matcher = nullptr;
|
||||
_sector->clock = _fmr->seekToPattern(ANY_RECORD_PATTERN, matcher);
|
||||
if (matcher == &SECTOR_RECORD_PATTERN)
|
||||
return RecordType::SECTOR_RECORD;
|
||||
if (matcher == &DATA_RECORD_PATTERN)
|
||||
return RecordType::DATA_RECORD;
|
||||
return RecordType::UNKNOWN_RECORD;
|
||||
}
|
||||
|
||||
void decodeSectorRecord() override
|
||||
void decodeSectorRecord()
|
||||
{
|
||||
auto bits = readRawBits(TIDS990_SECTOR_RECORD_SIZE*16);
|
||||
auto bytes = decodeFmMfm(bits).slice(0, TIDS990_SECTOR_RECORD_SIZE);
|
||||
|
||||
ByteReader br(bytes);
|
||||
if (br.read_be16() != SECTOR_ID)
|
||||
return;
|
||||
|
||||
uint16_t gotChecksum = crc16(CCITT_POLY, bytes.slice(1, TIDS990_SECTOR_RECORD_SIZE-3));
|
||||
|
||||
br.seek(2);
|
||||
_sector->logicalSide = br.read_8() >> 3;
|
||||
_sector->logicalTrack = br.read_8();
|
||||
br.read_8(); /* number of sectors per track */
|
||||
@@ -74,17 +76,15 @@ public:
|
||||
_sector->status = Sector::DATA_MISSING; /* correct but unintuitive */
|
||||
}
|
||||
|
||||
void decodeDataRecord() override
|
||||
void decodeDataRecord()
|
||||
{
|
||||
auto bits = readRawBits(TIDS990_DATA_RECORD_SIZE*16);
|
||||
auto bytes = decodeFmMfm(bits).slice(0, TIDS990_DATA_RECORD_SIZE);
|
||||
|
||||
ByteReader br(bytes);
|
||||
if (br.read_be16() != DATA_ID)
|
||||
return;
|
||||
|
||||
uint16_t gotChecksum = crc16(CCITT_POLY, bytes.slice(1, TIDS990_DATA_RECORD_SIZE-3));
|
||||
|
||||
br.seek(2);
|
||||
_sector->data = br.read(TIDS990_PAYLOAD_SIZE);
|
||||
uint16_t wantChecksum = br.read_be16();
|
||||
_sector->status = (wantChecksum == gotChecksum) ? Sector::OK : Sector::BAD_CHECKSUM;
|
||||
|
||||
@@ -59,9 +59,9 @@ private:
|
||||
}
|
||||
|
||||
public:
|
||||
std::vector<std::shared_ptr<const Sector>> collectSectors(int physicalTrack, int physicalSide, const Image& image) override
|
||||
std::vector<std::shared_ptr<Sector>> collectSectors(int physicalTrack, int physicalSide, const Image& image) override
|
||||
{
|
||||
std::vector<std::shared_ptr<const Sector>> sectors;
|
||||
std::vector<std::shared_ptr<Sector>> sectors;
|
||||
|
||||
for (char sectorChar : _config.sector_skew())
|
||||
{
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
}
|
||||
|
||||
std::unique_ptr<Fluxmap> encode(int physicalTrack, int physicalSide,
|
||||
const std::vector<std::shared_ptr<const Sector>>& sectors, const Image& image) override
|
||||
const std::vector<std::shared_ptr<Sector>>& sectors, const Image& image) override
|
||||
{
|
||||
double clockRateUs = 1e3 / _config.clock_rate_khz() / 2.0;
|
||||
int bitsPerRevolution = (_config.track_length_ms() * 1000.0) / clockRateUs;
|
||||
|
||||
@@ -59,29 +59,33 @@ public:
|
||||
AbstractDecoder(config)
|
||||
{}
|
||||
|
||||
nanoseconds_t advanceToNextRecord() override
|
||||
RecordType advanceToNextRecord()
|
||||
{
|
||||
return seekToPattern(ANY_RECORD_PATTERN);
|
||||
const FluxMatcher* matcher = nullptr;
|
||||
_sector->clock = _fmr->seekToPattern(ANY_RECORD_PATTERN, matcher);
|
||||
if (matcher == &SECTOR_RECORD_PATTERN)
|
||||
return SECTOR_RECORD;
|
||||
if (matcher == &DATA_RECORD_PATTERN)
|
||||
return DATA_RECORD;
|
||||
return UNKNOWN_RECORD;
|
||||
}
|
||||
|
||||
void decodeSectorRecord() override
|
||||
void decodeSectorRecord()
|
||||
{
|
||||
/* Check the ID. */
|
||||
|
||||
if (readRaw32() != VICTOR9K_SECTOR_RECORD)
|
||||
return;
|
||||
/* Skip the sync marker bit. */
|
||||
readRawBits(22);
|
||||
|
||||
/* Read header. */
|
||||
|
||||
auto bytes = decode(readRawBits(3*10)).slice(0, 3);
|
||||
auto bytes = decode(readRawBits(4*10)).slice(0, 4);
|
||||
|
||||
uint8_t rawTrack = bytes[0];
|
||||
_sector->logicalSector = bytes[1];
|
||||
uint8_t gotChecksum = bytes[2];
|
||||
uint8_t rawTrack = bytes[1];
|
||||
_sector->logicalSector = bytes[2];
|
||||
uint8_t gotChecksum = bytes[3];
|
||||
|
||||
_sector->logicalTrack = rawTrack & 0x7f;
|
||||
_sector->logicalSide = rawTrack >> 7;
|
||||
uint8_t wantChecksum = bytes[0] + bytes[1];
|
||||
uint8_t wantChecksum = bytes[1] + bytes[2];
|
||||
if ((_sector->logicalSector > 20) || (_sector->logicalTrack > 85) || (_sector->logicalSide > 1))
|
||||
return;
|
||||
|
||||
@@ -89,19 +93,22 @@ public:
|
||||
_sector->status = Sector::DATA_MISSING; /* unintuitive but correct */
|
||||
}
|
||||
|
||||
void decodeDataRecord() override
|
||||
void decodeDataRecord()
|
||||
{
|
||||
/* Check the ID. */
|
||||
|
||||
if (readRaw32() != VICTOR9K_DATA_RECORD)
|
||||
return;
|
||||
/* Skip the sync marker bit. */
|
||||
readRawBits(22);
|
||||
|
||||
/* Read data. */
|
||||
|
||||
auto bytes = decode(readRawBits((VICTOR9K_SECTOR_LENGTH+4)*10))
|
||||
.slice(0, VICTOR9K_SECTOR_LENGTH+4);
|
||||
auto bytes = decode(readRawBits((VICTOR9K_SECTOR_LENGTH+5)*10))
|
||||
.slice(0, VICTOR9K_SECTOR_LENGTH+5);
|
||||
ByteReader br(bytes);
|
||||
|
||||
/* Check that this is actually a data record. */
|
||||
|
||||
if (br.read_8() != 8)
|
||||
return;
|
||||
|
||||
_sector->data = br.read(VICTOR9K_SECTOR_LENGTH);
|
||||
uint16_t gotChecksum = sumBytes(_sector->data);
|
||||
uint16_t wantChecksum = br.read_le16();
|
||||
|
||||
@@ -78,22 +78,13 @@ static int encode_data_gcr(uint8_t data)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void write_byte(std::vector<bool>& bits, unsigned& cursor, uint8_t b)
|
||||
{
|
||||
write_bits(bits, cursor, encode_data_gcr(b>>4), 5);
|
||||
write_bits(bits, cursor, encode_data_gcr(b), 5);
|
||||
}
|
||||
|
||||
static void write_bytes(std::vector<bool>& bits, unsigned& cursor, const Bytes& bytes)
|
||||
{
|
||||
for (uint8_t b : bytes)
|
||||
write_byte(bits, cursor, b);
|
||||
}
|
||||
|
||||
static void write_gap(std::vector<bool>& bits, unsigned& cursor, int length)
|
||||
{
|
||||
for (int i = 0; i < length/10; i++)
|
||||
write_byte(bits, cursor, '0');
|
||||
{
|
||||
write_bits(bits, cursor, encode_data_gcr(b>>4), 5);
|
||||
write_bits(bits, cursor, encode_data_gcr(b), 5);
|
||||
}
|
||||
}
|
||||
|
||||
static void write_sector(std::vector<bool>& bits, unsigned& cursor,
|
||||
@@ -111,8 +102,8 @@ static void write_sector(std::vector<bool>& bits, unsigned& cursor,
|
||||
(uint8_t)(encodedTrack + encodedSector),
|
||||
});
|
||||
|
||||
write_gap(bits, cursor, trackdata.post_header_gap_bits());
|
||||
|
||||
write_zero_bits(bits, cursor, trackdata.post_header_gap_bits());
|
||||
write_one_bits(bits, cursor, trackdata.pre_data_sync_bits());
|
||||
write_bits(bits, cursor, VICTOR9K_DATA_RECORD, 10);
|
||||
|
||||
@@ -121,7 +112,8 @@ static void write_sector(std::vector<bool>& bits, unsigned& cursor,
|
||||
Bytes checksum(2);
|
||||
checksum.writer().write_le16(sumBytes(sector.data));
|
||||
write_bytes(bits, cursor, checksum);
|
||||
write_gap(bits, cursor, trackdata.post_data_gap_bits());
|
||||
|
||||
write_zero_bits(bits, cursor, trackdata.post_data_gap_bits());
|
||||
}
|
||||
|
||||
class Victor9kEncoder : public AbstractEncoder
|
||||
@@ -151,9 +143,9 @@ private:
|
||||
}
|
||||
|
||||
public:
|
||||
std::vector<std::shared_ptr<const Sector>> collectSectors(int physicalTrack, int physicalSide, const Image& image) override
|
||||
std::vector<std::shared_ptr<Sector>> collectSectors(int physicalTrack, int physicalSide, const Image& image) override
|
||||
{
|
||||
std::vector<std::shared_ptr<const Sector>> sectors;
|
||||
std::vector<std::shared_ptr<Sector>> sectors;
|
||||
|
||||
Victor9kEncoderProto::TrackdataProto trackdata;
|
||||
getTrackFormat(trackdata, physicalTrack, physicalSide);
|
||||
@@ -170,7 +162,7 @@ public:
|
||||
}
|
||||
|
||||
std::unique_ptr<Fluxmap> encode(int physicalTrack, int physicalSide,
|
||||
const std::vector<std::shared_ptr<const Sector>>& sectors, const Image& image) override
|
||||
const std::vector<std::shared_ptr<Sector>>& sectors, const Image& image) override
|
||||
{
|
||||
Victor9kEncoderProto::TrackdataProto trackdata;
|
||||
getTrackFormat(trackdata, physicalTrack, physicalSide);
|
||||
|
||||
@@ -8,13 +8,11 @@ class DecoderProto;
|
||||
|
||||
/* ... 1101 0101 0111
|
||||
* ^^ ^^^^ ^^^^ ten bit IO byte */
|
||||
#define VICTOR9K_SECTOR_RECORD 0xfffffd57
|
||||
#define VICTOR9K_HEADER_ID 0x7
|
||||
#define VICTOR9K_SECTOR_RECORD 0xfffffd57
|
||||
|
||||
/* ... 1101 0100 1001
|
||||
* ^^ ^^^^ ^^^^ ten bit IO byte */
|
||||
#define VICTOR9K_DATA_RECORD 0xfffffd49
|
||||
#define VICTOR9K_DATA_ID 0x8
|
||||
|
||||
#define VICTOR9K_SECTOR_LENGTH 512
|
||||
|
||||
|
||||
@@ -20,13 +20,17 @@ public:
|
||||
AbstractDecoder(config)
|
||||
{}
|
||||
|
||||
nanoseconds_t advanceToNextRecord() override
|
||||
RecordType advanceToNextRecord()
|
||||
{
|
||||
seekToIndexMark();
|
||||
return seekToPattern(SECTOR_START_PATTERN);
|
||||
const FluxMatcher* matcher = nullptr;
|
||||
_fmr->seekToIndexMark();
|
||||
_sector->clock = _fmr->seekToPattern(SECTOR_START_PATTERN, matcher);
|
||||
if (matcher == &SECTOR_START_PATTERN)
|
||||
return SECTOR_RECORD;
|
||||
return UNKNOWN_RECORD;
|
||||
}
|
||||
|
||||
void decodeSectorRecord() override
|
||||
void decodeSectorRecord()
|
||||
{
|
||||
readRawBits(14);
|
||||
|
||||
|
||||
131
dep/libui/CONTRIBUTING.md
Normal file
131
dep/libui/CONTRIBUTING.md
Normal file
@@ -0,0 +1,131 @@
|
||||
# Contributing to libui
|
||||
|
||||
libui is an open source project that openly accepts contributions. I appreciate your help!
|
||||
|
||||
## Rules for contributing code
|
||||
|
||||
While libui is open to contributions, a number of recent, significantly large contributions and uncontributed forks have recently surfaced that do not present themselves in a form that makes it easy for libui to accept them. In order to give your contribution a high chance of being accepted into libui, please keep the following in mind as you prepare your contribution.
|
||||
|
||||
### Commit messages and pull request description
|
||||
|
||||
libui does not enforce rules about the length or detail that a commit message. I'm not looking for an essay. However, single-word descriptions of nontrivial changes are *not* acceptable. I should be able to get a glimpse of what a commit does from the commit message, even if it's just one sentence to describe a trivial change. (Yes, I know I haven't followed this rule strictly myself, but I try not to break it too.) And a commit message should encompass everything; typically, I make a number of incremental commits toward a feature, so the commit messages don't have to be too long to explain everything.
|
||||
|
||||
Your pull request description, on the other hand, must be a summary of the sum total of all the changes made to libui. Don't just drop a pull request on me with a one-line-long elevator pitch of what you added. Describe your proposed API changes, implementation requirements, and any important consequences of your work.
|
||||
|
||||
### Code formatting
|
||||
|
||||
libui uses K&R C formatting rules for overall code structure: spaces after keywords like `if`, `{` on the same line as a statement with a space, `{` on its own line after a function or method signature (even those inside the class body), no space after the name of a function, etc.
|
||||
|
||||
Use hard tabs, NOT spaces, for indentation. I use a proportional-width font and my text editor doesn't set tabs to a multiple of the space width, so I *will* be able to tell. If you use a fixed-width font, I suggest setting a tab width of 4 spaces per tab, but don't put diagrams in comments with hard tabs, because not everyone does this.
|
||||
|
||||
Expressions should have a space around binary operators, and use parentheses where it would help humans gather the meaning of an expression, regardless of whether a computer could tell what is correct.
|
||||
|
||||
When breaking expressions into multiple lines, always break *after* an operator, such as `,` or `&&`.
|
||||
|
||||
There should be a newline between a function's variables and a function's code. After that, you can place newlines to delimit different parts of a function, but don't go crazy.
|
||||
|
||||
In the event you are unsure of something, refer to existing libui code for examples. I may wind up fixing minor details later anyway, so don't fret about getting minor details right the first time.
|
||||
|
||||
### Naming
|
||||
|
||||
libui uses camel-case for naming, with a handful of very specific exceptions (namely GObject method names, where GObject itself enforces the naming convention).
|
||||
|
||||
All public API names should begin with `ui` and followed by a capital letter. All public struct field names should begin with a capital letter. This is identical to the visibiilty rules of Go, assuming a package name of `ui`.
|
||||
|
||||
Private API names — specifcally those used by more than one source file — should begin with `uipriv` and be followed by a capital letter. This avoids namespace collisions in static libraries.
|
||||
|
||||
Static functions and static objects do not have naming restrictions.
|
||||
|
||||
Acronyms should **NOT** be mixed-case. `http` for the first word in a camel-case name, `HTTP` for all else, but **NEVER** `Http`. This is possibly the only aspect of the controversial nature of code style that I consider indefensibly stupid.
|
||||
|
||||
### API documentation
|
||||
|
||||
(TODO I am writing an API documentation tool; once that becomes stable enough I can talk about documenting libui properly. You'll see vestiges of it throughout ui.h, though.)
|
||||
|
||||
### Other commenting
|
||||
|
||||
(TODO write this part)
|
||||
|
||||
### Compatibility
|
||||
|
||||
libui takes backward compatibility seriously. Your code should not break the current compatibility requirements. All platforms provide a series of macros, defined in the various `uipriv_*.h` files (or `winapi.hpp` on Windows), that specify the minimum required version. If you find yourself needing to remove these or ignore resultant warnings or errors, you're probably breaking compatibility.
|
||||
|
||||
Choosing to drop older versions of Windows, GTK+, and OS X that I could have easily continued to support was not done lightly. If you want to discuss dropping support for an older version of any of these for the benefit of libui, file an issue pleading your case (see below).
|
||||
|
||||
GTK+ versions are harder to drop because I am limited by Linux distribution packaging. In general, I will consider bumping GTK+ versions on a new Ubuntu LTS release, choosing the earliest version available on the major distributions at the time of the *previous* Ubuntu LTS release. As of writing, the next milestone will be *after* April 2018, and the target GTK+ version appears to be 3.18, judging by Ubuntu 16.04 LTS alone. This may be bumped back depending on other distros (or it may not be bumped at all), but you may wish to keep this in mind as you write.
|
||||
|
||||
(TODO talk about future.c/.cpp/.m files)
|
||||
|
||||
As for language compatibility, libui is written in C99. I have no intention of changing this.
|
||||
|
||||
As for build system compatibility, libui uses CMake 3.1.0. If you wish to bump the version, file an issue pleading your case (but see below).
|
||||
|
||||
**If you do plead your case**, keep in mind that "it's old" is not a sufficient reason to drop things. If you can prove that **virtually no one** uses the minimum version anymore, then that is stronger evidence. The best evidence, however, is that not upgrading will hold libui back in some significant way — but beware that there are some things I won't add to libui itself.
|
||||
|
||||
### Windows-specific notes
|
||||
|
||||
The Windows backend of libui is written in C++ using C++11.
|
||||
|
||||
Despite using C++, please refrain from using the following:
|
||||
|
||||
- using C++ in ui_windows.h (this file should still be C compatible)
|
||||
- smart pointers
|
||||
- namespaces
|
||||
- `using namespace`
|
||||
- ATL, MFC, WTL
|
||||
|
||||
The following are not recommended, for consistency with the rest of libui:
|
||||
|
||||
- variable declarations anywhere in a function (keep them all at the top)
|
||||
- `for (int x...` (C++11 foreach syntax is fine, though)
|
||||
- omitting the `struct` on type names for ordinary structs
|
||||
|
||||
The format of a class should be
|
||||
|
||||
```c++
|
||||
class name : public ancestor {
|
||||
int privateVariable;
|
||||
// etc.
|
||||
public:
|
||||
// public stuff here
|
||||
};
|
||||
```
|
||||
|
||||
### GTK+-specific notes
|
||||
|
||||
Avoid GNU-specific language features. I build with strict C99 conformance.
|
||||
|
||||
### OS X-specific notes
|
||||
|
||||
Avoid GNU-specific/clang-specific language features. I build with strict C99 conformance.
|
||||
|
||||
libui is presently **not** ARC-compliant. Features that require ARC should be avoided for now. I may consider changing this in the future, but it will be a significant change.
|
||||
|
||||
To ensure maximum compiler output in the event of a coding error, there should not be any implicit method calls in Objective-C code. For instance, don't do
|
||||
|
||||
```objective-c
|
||||
[[array objectAtIndex:i] method]
|
||||
```
|
||||
|
||||
Instead, cast the result of `objectAtIndex:` to the appropriate type, and then call the method. (TODO learn about, then decide a policy on, soft-generics on things other than `id`)
|
||||
|
||||
The format of a class should be
|
||||
|
||||
```objective-c
|
||||
@interface name : parent<protocols> {
|
||||
// ivars
|
||||
}
|
||||
// properties
|
||||
- (ret)method:(int)arg;
|
||||
// more methods
|
||||
@end
|
||||
|
||||
@implementation name
|
||||
|
||||
- (ret)method:(int)arg
|
||||
{
|
||||
// note the lack of semicolon
|
||||
}
|
||||
|
||||
@end
|
||||
```
|
||||
141
dep/libui/Compatibility.md
Normal file
141
dep/libui/Compatibility.md
Normal file
@@ -0,0 +1,141 @@
|
||||
# Useful things in newer versions
|
||||
|
||||
## Windows
|
||||
### Windows 7
|
||||
http://channel9.msdn.com/blogs/pdc2008/pc43
|
||||
|
||||
TODO look up PDC 2008 talk "new shell user interface"
|
||||
|
||||
- new animation and text engine
|
||||
- ribbon control (didn't this have some additional license?)
|
||||
- LVITEM.piColFmt
|
||||
|
||||
### Windows 8
|
||||
|
||||
### Windows 8.1
|
||||
|
||||
### Windows 10
|
||||
|
||||
## GTK+
|
||||
TODO what ships with Ubuntu Quantal (12.10)?
|
||||
|
||||
### GTK+ 3.6
|
||||
ships with: Ubuntu Raring (13.04)
|
||||
|
||||
- GtkEntry and GtkTextView have input purposes and input hints for external input methods but do not change input themselves
|
||||
- according to Company, we connect to insert-text for that
|
||||
- GtkLevelBar
|
||||
- GtkMenuButton
|
||||
- **GtkSearchEntry**
|
||||
|
||||
### GTK+ 3.8
|
||||
ships with: Ubuntu Saucy (13.10)
|
||||
|
||||
Not many interesting new things to us here, unless you count widget-internal tickers and single-click instead of double-click to select list items (a la KDE)... and oh yeah, also widget opacity.
|
||||
|
||||
### GTK+ 3.10
|
||||
ships with: **Ubuntu Trusty (14.04 LTS)**
|
||||
<br>GLib version: 2.40
|
||||
|
||||
- tab character stops in GtkEntry
|
||||
- GtkHeaderBar
|
||||
- intended for titlebar overrides; GtkInfoBar is what I keep thinking GtkHeaderBar is
|
||||
- **GtkListBox**
|
||||
- GtkRevealer for smooth animations of disclosure triangles
|
||||
- GtkSearchBar for custom search popups
|
||||
- **GtkStack and GtkStackSwitcher**
|
||||
- titlebar overrides (seems to be the hot new thing)
|
||||
|
||||
### GTK+ 3.12
|
||||
ships with: Ubuntu Utopic (14.10)
|
||||
<br>GLib version: 2.42
|
||||
|
||||
- GtkActionBar (basically like the bottom-of-the-window toolbars in Mac programs)
|
||||
- gtk_get_locale_direction(), for internationalization
|
||||
- more control over GtkHeaderBar
|
||||
- **GtkPopover**
|
||||
- GtkPopovers on GtkMenuButtons
|
||||
- GtkStack signaling
|
||||
- **gtk_tree_path_new_from_indicesv()** (for when we add Table if we have trees too)
|
||||
|
||||
### GTK+ 3.14
|
||||
ships with: **Debian Jessie**, Ubuntu Vivid (15.04)
|
||||
<br>GLib version: Debian: 2.42, Ubuntu: 2.44
|
||||
|
||||
- gestures
|
||||
- better GtkListbox selection handling
|
||||
- more style classes (TODO also prior?)
|
||||
- delayed switch changes on GtkSwitch
|
||||
|
||||
### GTK+ 3.16
|
||||
ships with: Ubuntu Wily (15.10)
|
||||
<br>GLib version: 2.46
|
||||
|
||||
- gtk_clipboard_get_default() (???)
|
||||
- **GtkGLArea**
|
||||
- proper xalign and yalign for GtkLabel; should get rid of runtime deprecation warnings
|
||||
- better control of GtkListBox model-based creation (probably not relevant but)
|
||||
- GtkModelButton (for GActions; probably not relevant?)
|
||||
- wide handles on GtkPaned
|
||||
- GtkPopoverMenu
|
||||
- IPP paper names in GtkPaperSize (TODO will this be important for printing?)
|
||||
- multiple matches in GtkSearchEntry (TODO evaluate priority)
|
||||
- **GtkStackSidebar**
|
||||
- GTK_STYLE_CLASS_LABEL, GTK_STYLE_CLASS_MONOSPACE, GTK_STYLE_CLASS_STATUSBAR, GTK_STYLE_CLASS_TOUCH_SELECTION, GTK_STYLE_CLASS_WIDE (TODO figure out which of these are useful)
|
||||
- GtkTextView: extend-selection
|
||||
- GtkTextView: font fallbacks
|
||||
|
||||
### GTK+ 3.18
|
||||
|
||||
### GTK+ 3.20
|
||||
|
||||
## Cocoa
|
||||
### Mac OS X 10.8
|
||||
|
||||
- Foundation ([full details](https://developer.apple.com/library/mac/releasenotes/Foundation/RN-FoundationOlderNotes/#//apple_ref/doc/uid/TP40008080-TRANSLATED_CHAPTER_965-TRANSLATED_DEST_999B))
|
||||
- NSDateComponents supports leap months
|
||||
- NSNumberFormatter and NSDateFormatter default to 10.4 behavior by default (need to explicitly do this on 10.7)
|
||||
- **NSUserNotification and NSUserNotificationCenter for Growl-style notifications**
|
||||
- better linguistic triggers for Spanish and Italian
|
||||
- NSByteCountFormatter
|
||||
- AppKit ([full details](https://developer.apple.com/library/mac/releasenotes/AppKit/RN-AppKitOlderNotes/#X10_8Notes))
|
||||
- view-based NSTableView/NSOutlineView have expansion tooltips
|
||||
- NSScrollView magnification
|
||||
- Quick Look events; TODO see if they conflict with keyboard handling in Area
|
||||
- NSPageController (maybe useful?)
|
||||
- not useful for package UI, but may be useful for a new library (probably not by me): NSSharingService
|
||||
- NSOpenPanel and NSSavePanel are now longer NSPanels or NSWindows in sandboxed applications; this may be an issue should anyone dare to enable sandboxing on a program that uses package ui
|
||||
- NSTextAlternatives
|
||||
- -[NSOpenGLContext setFullScreen] now ineffective
|
||||
- +[NSColor underPageBackgroundColor]
|
||||
|
||||
### Mac OS X 10.9
|
||||
|
||||
- Foundation ([full details](https://developer.apple.com/library/mac/releasenotes/Foundation/RN-Foundation/))
|
||||
- system-provided progress reporting/cancellation support
|
||||
- NSURLComponents
|
||||
- **NSCalendar, NSDateFormatter, and NSNumberFormatter are now thread-safe**
|
||||
- various NSCalendar and NSDateComponents improvements
|
||||
- AppKit ([full details](https://developer.apple.com/library/mac/releasenotes/AppKit/RN-AppKit/))
|
||||
- sheet handling is now block-based, queued, and in NSWindow; the delegate-based NSApplication API will still exist, except without the queue
|
||||
- similar changes to NSAlert
|
||||
- **return value changes to NSAlert**
|
||||
- window visibility APIs (occlusion)
|
||||
- NSApplicationActivationPolicyAccessory
|
||||
- fullscreen toolbar behavior changes
|
||||
- status items for multiple menu bars
|
||||
- better NSSharingService support
|
||||
- a special accelerated scrolling mode, Responsive Scrolling; won't matter for us since I plan to support the scroll wheel and it won't
|
||||
- NSScrollView live scrolling notifications
|
||||
- NSScrollView floating (anchored/non-scrolling) subviews
|
||||
- better multimonitor support
|
||||
- better key-value observing for NSOpenPanel/NSSavePanel (might want to look this up to see if we can override some other juicy details... TODO)
|
||||
- better accessory view key-view handling in NSOpenPanel/NSSavePanel
|
||||
- NSAppearance
|
||||
- **-[NSTableView moveRowAtIndex:toIndex:] bug regarding first responders fixed**
|
||||
- view-specific RTL overrides
|
||||
|
||||
### Mac OS X 10.10
|
||||
|
||||
### Mac OS X 10.11
|
||||
* **NSLayoutGuide**
|
||||
9
dep/libui/LICENSE
Normal file
9
dep/libui/LICENSE
Normal file
@@ -0,0 +1,9 @@
|
||||
Copyright (c) 2014 Pietro Gagliardi
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
(this is called the MIT License or Expat License; see http://www.opensource.org/licenses/MIT)
|
||||
113
dep/libui/NEWS.md
Normal file
113
dep/libui/NEWS.md
Normal file
@@ -0,0 +1,113 @@
|
||||
# Old News
|
||||
|
||||
* **27 November 2016**
|
||||
* Decided to split the table stuff into its own branch. It will be developed independently of everything else, along with a few other features.
|
||||
|
||||
* **2 November 2016**
|
||||
* Added two new functions to replace the deleted `uiWindowPosition()` and friends: `uiAreaBeginUserWindowMove()` and `uiAreaBeginUserWindowResize()`. When used in a `uiAreaHandler.Mouse()` event handler, these let you initiate a user-driven mouse move or mouse resize of the window at any point in a uiArea.
|
||||
|
||||
* **31 October 2016**
|
||||
* @krakjoe noticed that I accidentally used thread-unsafe code in uiQueueMain() on Unix. Fixed.
|
||||
|
||||
* **24 October 2016**
|
||||
* `uiWindowSetContentSize()` on Unix no longer needs to call up the GTK+ main loop. As a result, bugs related to strange behavior using that function (and the now-deleted `uiWindowSetPosition()` and `uiWindowCenter()`) should go away. I'll need to go through the bugs to verify as much, though.
|
||||
|
||||
* **22 October 2016**
|
||||
* Due to being unable to guarantee they will work (especially as we move toward capability-driven window systems like Wayland), or being unable to work without hacking that breaks other things, the following functions have been removed: `uiWindowPosition()`, `uiWindowSetPosition()`, `uiWindowCenter()`, and `uiWindowOnPositionChanged()`. Centering may come back at some point in the future, albeit in a possibly restricted form. A function to initiate a user move when a part of a uiArea is clicked will be provided soon.
|
||||
|
||||
* **21 October 2016**
|
||||
* `uiDrawTextWeightUltraBold` is now spelled correctly. Thanks to @krakjoe.
|
||||
|
||||
* **18 June 2016**
|
||||
* Help decide [the design of tables and trees in libui](https://github.com/andlabs/libui/issues/159); the implementation starts within the next few days, if not tomorrow!
|
||||
|
||||
* **17 June 2016**
|
||||
* **CMake 3.1.0 is now required.** This is due to CMake's rapid development pace in the past few years adding things libui needs to build on as many systems as possible. If your OS is supported by libui but its repositories ship with an older version of CMake, you will need to find an updated one somewhere.
|
||||
* Please help [plan out a better menu API](https://github.com/andlabs/libui/issues/152).
|
||||
* `uiMainSteps()` no longer takes any arguments and no longer needs to invoke a function to do the work. You still need to call it, but once you do, it will return immediately and you can then get right to your main loop.
|
||||
* **CMake 3.1.0 is now required.** This is due to CMake's rapid development pace in the past few years adding things libui needs to build on as many systems as possible. If your OS is supported by libui but its repositories ship with an older version of CMake, you will need to find an updated one somewhere.
|
||||
* Added `uiNewVerticalSeparator()` to complement `uiNewHorizontalSeparator()`.
|
||||
|
||||
* **16 June 2016**
|
||||
* Added `uiWindowContentSize()`, `uiWindowSetContentSize()`, and `uiWindowOnContentSizeChanged()` methods for manipulating uiWindow content sizes. Note the use of "content size"; the size you work with does NOT include window decorations (titlebars, menus, etc.).
|
||||
* Added `uiWindowFullscreen()` and `uiWindowSetFullscreen()` to allow making fullscreen uiWindows, taking advantage of OS facilities for fullscreen and without changing the screen resolution (!).
|
||||
* Added `uiWindowBorderless()` and `uiWindowSetBorderless()` for allowing borderless uiWindows.
|
||||
* Added `uiMainSteps()`. You call this instead of `uiMain()` if you want to run the main loop yourself. You pass in a function that will be called; within that function, you call `uiMainStep()` repeatedly until it returns 0, doing whatever you need to do in the meantime. (This was needed because just having `uiMainStep()` by itself only worked on some systems.)
|
||||
* Added `uiProgressBarValue()` and allowed passing -1 to `uiProgressBarSetValue()` to make an indeterminate progress bar. Thanks to @emersion.
|
||||
|
||||
* **15 June 2016**
|
||||
* Added `uiFormDelete()`; thanks to @emersion.
|
||||
* Added `uiWindowPosition()`, `uiWindowSetPosition()`, `uiWindowCenter()`, and `uiWindowOnPositionChanged()`, methods for manipulating uiWindow position.
|
||||
|
||||
* **14 June 2016**
|
||||
* uiDarwinControl now has a `ChildVisibilityChanged()` method and a corresponding `NotifyVisibilityChanged()` function that is called by the default show/hide handlers. This is used to make visibility changes work on OS X; uiBox, uiForm, and uiGrid all respect these now.
|
||||
* The same has been done on the Windows side as well.
|
||||
* Hiding and showing controls and padding calculations are now correct on Windows at long last.
|
||||
* Hiding a control in a uiForm now hides its label on all platforms.
|
||||
|
||||
* **13 June 2016**
|
||||
* `intmax_t` and `uintmax_t` are no longer used for libui API functions; now we use `int`. This should make things much easier for bindings. `int` should be at least 32 bits wide; this should be sufficient for all but the most extreme cases.
|
||||
|
||||
* **12 June 2016**
|
||||
* Added `uiGrid`, a new container control that arranges controls in rows and columns, with stretchy ("expanding") rows, stretchy ("expanding") columns, cells that span rows and columns, and cells whose content is aligned in either direction rather than just filling. It's quite powerful, is it? =P
|
||||
|
||||
* **8 June 2016**
|
||||
* Added `uiForm`, a new container control that arranges controls vertically, with properly aligned labels on each. Have fun!
|
||||
|
||||
* **6 June 2016**
|
||||
* Added `uiRadioButtonsSelected()`, `uiRadioButtonsSetSelected()`, and `uiRadioButtonsOnSelected()` to control selection of a radio button and catch an event when such a thing happens.
|
||||
|
||||
* **5 June 2016**
|
||||
* **Alpha 3.1 is here.** This was a much-needed update to Alpha 3 that changes a few things:
|
||||
* **The build system is now cmake.** cmake 2.8.11 or higher is needed.
|
||||
* Static linking is now fully possible.
|
||||
* MinGW linking is back, but static only.
|
||||
* Added `uiNewPasswordEntry()`, which creates a new `uiEntry` suitable for entering passwords.
|
||||
* Added `uiNewSearchEntry()`, which creates a new `uiEntry` suitable for searching. On some systems, the `OnChanged()` event will be slightly delayed and/or combined, to produce a more natural feel when searching.
|
||||
|
||||
* **29 May 2016**
|
||||
* **Alpha 3 is here!** Get it [here](https://github.com/andlabs/libui/releases/tag/alpha3).
|
||||
* The next packaged release will introduce:
|
||||
* uiGrid, another way to lay out controls, a la GtkGrid
|
||||
* uiOpenGLArea, a way to render OpenGL content in a libui uiArea
|
||||
* uiTable, a data grid control that may or may not have tree facilities (if it does, it will be called uiTree instead)
|
||||
* a complete, possibly rewritten, drawing and text rendering infrastructure
|
||||
* Thanks to @pcwalton, we can now statically link libui! Simply do `make STATIC=1` instead of just `make`.
|
||||
* On Windows you must link both `libui.lib` and `libui.res` AND provide a Common Controls 6 manifest for output static binaries to work properly.
|
||||
|
||||
* **28 May 2016**
|
||||
* As promised, **the minimum system requirements are now OS X 10.8 and GTK+ 3.10 for OS X and Unix, respectively**.
|
||||
|
||||
* **26 May 2016**
|
||||
* Two OS X-specific functions have been added: `uiDarwinMarginAmount()` and `uiDarwinPaddingAmount()`. These return the amount of margins and padding, respectively, to give to a control, and are intended for container implementations. These are suitable for the constant of a NSLayoutConstraint. They both take a pointer parameter that is reserved for future use and should be `NULL`.
|
||||
|
||||
* **25 May 2016**
|
||||
* uiDrawTextLayout attributes are now specified in units of *graphemes* on all platforms. This means characters as seen from a user's perspective, not Unicode codepoints or UTF-8 bytes. So a long string of combining marker codepoints after one codepoint would still count as one grapheme.
|
||||
|
||||
* **24 May 2016**
|
||||
* You can now help choose [a potential new build system for libui](https://github.com/andlabs/libui/issues/62).
|
||||
* Tomorrow I will decide if OS X 10.7 will also be dropped alongside GTK+ 3.4-3.8 this Saturday. Stay tuned.
|
||||
* As promised, `uiCombobox` is now split into `uiCombobox` for non-editable comboboxes and `uiEditableCombobox` for editable comboboxes. Mind the function changes as well :)
|
||||
* There is a new function `uiMainStep()`, which runs one iteration of the main loop. It takes a single boolean argument, indicating whether to wait for an event to occur or not. It returns true if an event was processed (or if no event is available if you don't want to wait) and false if the event loop was told to stop (for instance, `uiQuit()` was called).
|
||||
|
||||
* **23 May 2016**
|
||||
* Fixed surrogate pair drawing on OS X.
|
||||
|
||||
* **22 May 2016**
|
||||
* Two more open questions I'd like your feedback on are available [here](https://github.com/andlabs/libui/issues/48) and [here](https://github.com/andlabs/libui/issues/25).
|
||||
* Sometime in the next 48 hours (before 23:59 EDT on 24 May 2016) I will split `uiCombobox` into two separate controls, `uiCombobox` and `uiEditableCombobox`, each with slightly different events and "selected item" mechanics. Prepare your existing code.
|
||||
* Removed `uiControlVerifyDestroy()`; that is now part of `uiFreeControl()` itself.
|
||||
* Added `uiPi`, a constant for π. This is provided for C and C++ programmers, where there is no standard named constant for π; bindings authors shouldn't need to worry about this.
|
||||
* Fixed uiMultilineEntry not properly having line breaks on Windows.
|
||||
* Added `uiNewNonWrappingMultilineEntry()`, which creates a uiMultilineEntry that scrolls horizontally instead of wrapping lines. (This is not documented as being changeable after the fact on Windows, hence it's a creation-time choice.)
|
||||
* uiAreas on Windows and some internal Direct2D areas now respond to `WM_PRINTCLIENT` properly, which should hopefully increase the quality of screenshots.
|
||||
* uiDateTimePicker on GTK+ works properly on RTL layouts and no longer disappears off the bottom of the screen if not enough room is available. It will also no longer be marked for localization of the time format (what the separator should be and whether to use 24-hour time), as that information is not provided by the locale system. :(
|
||||
* Added `uiUserBugCannotSetParentOnToplevel()`, which should be used by implementations of toplevel controls in their `SetParent()` implementations. This will also be the beginning of consolidating common user bug messages into a single place, though this will be one of the only few exported user bug functions.
|
||||
* uiSpinbox and uiSlider now merely swap their min and max if min ≥ max. They will no longer panic and do nothing, respectively.
|
||||
* Matrix scaling will no longer leave the matrix in an invalid state on OS X and GTK+.
|
||||
* `uiMultilineEntrySetText()` and `uiMutlilineEntryAppend()` on GTK+ no longer fire `OnChanged()` events.
|
||||
|
||||
* **21 May 2016**
|
||||
* I will now post announcements and updates here.
|
||||
* Now that Ubuntu 16.04 LTS is here, no earlier than next Saturday, 28 May 2016 at noon EDT, **I will bump the minimum GTK+ version from 3.4 to 3.10**. This will add a lot of new features that I can now add to libui, such as search-oriented uiEntries, lists of arbitrary control layouts, and more. If you are still running a Linux distribution that doesn't come with 3.10, you will either need to upgrade or use jhbuild to set up a newer version of GTK+ in a private environment.
|
||||
* You can decide if I should also drop OS X 10.7 [here](https://github.com/andlabs/libui/issues/46).
|
||||
195
dep/libui/README.md
Normal file
195
dep/libui/README.md
Normal file
@@ -0,0 +1,195 @@
|
||||
# libui: a portable GUI library for C
|
||||
|
||||
This README is being written.<br>
|
||||
[](https://dev.azure.com/andlabs/libui/_build/latest?definitionId=1&branchName=master)<br>
|
||||
[](https://ci.appveyor.com/project/andlabs/libui/branch/master)
|
||||
|
||||
## Status
|
||||
|
||||
It has come to my attention that I have not been particularly clear about how usable or feature-complete libui is, and that this has fooled many people into expecting more from libui right this moment than I have explicitly promised to make available. I apologize for not doing this sooner.
|
||||
|
||||
libui is currently **mid-alpha** software. Much of what is currently present runs stabily enough for the examples and perhaps some small programs to work, but the stability is still a work-in-progress, much of what is already there is not feature-complete, some of it will be buggy on certain platforms, and there's a lot of stuff missing. In short, here's a list of features that I would like to add to libui, but that aren't in yet:
|
||||
|
||||
- trees
|
||||
- clipboard support, including drag and drop
|
||||
- more and better dialogs
|
||||
- printing
|
||||
- accessibility for uiArea and custom controls
|
||||
- document-based programs
|
||||
- tighter OS integration (especially for document-based programs), to allow programs to fully feel native, rather than merely look and act native
|
||||
- better support for standard dialogs and features (search bars, etc.)
|
||||
- OpenGL support
|
||||
|
||||
In addition, [here](https://github.com/andlabs/libui/issues?utf8=%E2%9C%93&q=master+in%3Atitle+is%3Aissue+is%3Aopen) is a list of issues generalizing existing problems.
|
||||
|
||||
Furthermore, libui is not properly fully documented yet. This is mainly due to the fact that the API was initially unstable enough so as to result in rewriting documentation multiple times, in addition to me not being happy with really any existing C code documentation tool. That being said, I have started to pin down my ideal code documentation style in parts of `ui.h`, most notably in the uiAttributedString APIs. Over time, I plan on extending this to the rest of the headers. You can also use [the documentation for libui's Go bindings](https://godoc.org/github.com/andlabs/ui) as a reference, though it is somewhat stale and not optimally written.
|
||||
|
||||
But libui is not dead; I am working on it whenever I can, and I hope to get it to a point of real quality soon!
|
||||
|
||||
## News
|
||||
|
||||
*Note that today's entry (Eastern Time) may be updated later today.*
|
||||
|
||||
* **7 April 2019**
|
||||
* **The build system has been switched to Meson.** See below for instructions. This change was made because the previous build system, CMake, caused countless headaches over trivial issues. Meson was chosen due to how unproblematic setting up libui's build just right was, as well as having design goals that are by coincidence closely aligned with what libui wants.
|
||||
* Travis CI has been replaced with Azure Pipelines and much of the AppVeyor CI configuration was integrated into the Azure Pipelines configuration. This shouldn't affect most developers.
|
||||
|
||||
* **1 September 2018**
|
||||
* **Alpha 4.1 is here.** This is an emergency fix to Alpha 4 to fix `uiImageAppend()` not working as documented. It now works properly, with one important difference you'll need to care about: **it now requires image data to be alpha-premultiplied**. In addition, `uiImage` also is implemented slightly more nicely now, and `ui.h` has minor documentation typo fixes.
|
||||
* Alpha 4.1 also tries to make everything properly PIC-enabled.
|
||||
|
||||
* **10 August 2018**
|
||||
* **Alpha 4 is finally here.** Everything from Alpha 3.5 and what's listed below is in this release; the two biggest changes are still the new text drawing API and new uiTable control. In between all that is a whole bunch of bugfixes, and hopefully more stability too. Thanks to everybody who helped contribute!
|
||||
* Alpha 4 should hopefully also include automated binary releases via CI. Thanks to those who helped set that up!
|
||||
|
||||
* **8 August 2018**
|
||||
* Finally introduced an API for loading images, `uiImage`, and a new control, `uiTable`, for displaying tabular data. These provide enough basic functionality for now, but will be improved over time. You can read the documentation for the new features as they are [here](https://github.com/andlabs/libui/blob/f47e1423cf95ad7b1001663f3381b5a819fc67b9/uitable.h). Thanks to everyone who helped get to this point, in particular @bcampbell for the initial Windows code, and to everyone else for their patience!
|
||||
|
||||
* **30 May 2018**
|
||||
* Merged the previous Announcements and Updates section of this README into a single News section, and merged the respective archive files into a single NEWS.md file.
|
||||
|
||||
* **16 May 2018**
|
||||
* Thanks to @parro-it and @msink, libui now has better CI, including AppVeyor for Windows CI, and automated creation of binary releases when I make a tagged release.
|
||||
|
||||
* **13 May 2018**
|
||||
* Added new functions to work with uiDateTimePickers: `uiDateTimePickerTime()`, `uiDateTimePickerSetTime()`, and `uiDateTimePickerOnChanged()`. These operate on standard `<time.h>` `struct tm`s. Thanks @cody271!
|
||||
* Release builds on Windows with MSVC should be fixed now; thanks @l0calh05t, @slahn, @mischnic, and @zentner-kyle.
|
||||
|
||||
* **12 May 2018**
|
||||
* GTK+ and OS X now have a cleaner build process for static libraries which no longer has intermediate files and differing configurations. As a result, certain issues should no longer be present. New naming rules for internal symbols of libui have also started being drafted; runtime symbols and edge cases still need to be handled (and the rules applied to Windows) before this can become a regular thing.
|
||||
|
||||
* **2 May 2018**
|
||||
* On Windows, you no longer need to carry around a `libui.res` file with static builds. You do need to link in the appropriate manifest file, such as the one in the `windows/` folder (I still need to figure out exactly what is needed apart from the Common Controls v6 dependency, or at least to create a complete-ish template), or at least include it alongside your executables. This also means you should no longer see random cmake errors when building the static libraries.
|
||||
|
||||
* **18 April 2018**
|
||||
* Introduced a new `uiTimer()` function for running code on a timer on the main thread. (Thanks to @cody271.)
|
||||
* Migrated all code in the `common/` directory to use `uipriv` prefixes for everything that isn't `static`. This is the first step toward fixing static library oddities within libui, allowing libui to truly be safely used as either a static library or a shared library.
|
||||
|
||||
* **18 March 2018**
|
||||
* Introduced an all-new formatted text API that allows you to process formatted text in ways that the old API wouldn't allow. You can read on the whole API [here](https://github.com/andlabs/libui/blob/8944a3fc5528445b9027b1294b6c86bae03eeb89/ui_attrstr.h). There is also a new examples for it: `drawtext`, which shows the whole API at a glance. It doesn't yet support measuring or manipulating text, nor does it currently support functions that would be necessary for things like text editors; all of this will be added back later.
|
||||
* libui also now uses my [utf library](https://github.com/andlabs/utf) for UTF-8 and UTF-16 processing, to allow consistent behavior across platforms. This usage is not completely propagated throughout libui, but the Windows port uses it in most places now, and eventually this will become what libui will use throughout.
|
||||
* Also introduced a formal set of contribution guidelines, see `CONTRIBUTING.md` for details. They are still WIP.
|
||||
|
||||
* **17 February 2018**
|
||||
* The longstanding Enter+Escape crashes on Windows have finally been fixed (thanks to @lxn).
|
||||
* **Alpha 3.5 is now here.** This is a quickie release primiarly intended to deploy the above fix to package ui itself. **It is a partial binary release; sorry!** More new things will come in the next release, which will also introduce semver (so it will be called v0.4.0 instead).
|
||||
* Alpha 3.5 also includes a new control gallery example. The screenshots below have not been updated yet.
|
||||
|
||||
*Old announcements can be found in the NEWS.md file.*
|
||||
|
||||
## Runtime Requirements
|
||||
|
||||
* Windows: Windows Vista SP2 with Platform Update or newer
|
||||
* Unix: GTK+ 3.10 or newer
|
||||
* Mac OS X: OS X 10.8 or newer
|
||||
|
||||
## Build Requirements
|
||||
|
||||
* All platforms:
|
||||
* [Meson](https://mesonbuild.com/) 0.48.0 or newer
|
||||
* Any of Meson's backends; this section assumes you are using [Ninja](https://ninja-build.org/), but there is no reason the other backends shouldn't work.
|
||||
* Windows: either
|
||||
* Microsoft Visual Studio 2013 or newer (2013 is needed for `va_copy()`) — you can build either a static or a shared library
|
||||
* MinGW-w64 (other flavors of MinGW may not work) — **you can only build a static library**; shared library support will be re-added once the following features come in:
|
||||
* [Isolation awareness](https://msdn.microsoft.com/en-us/library/aa375197%28v=vs.85%29.aspx), which is how you get themed controls from a DLL without needing a manifest
|
||||
* Unix: nothing else specific
|
||||
* Mac OS X: nothing else specific, so long as you can build Cocoa programs
|
||||
|
||||
## Building
|
||||
|
||||
libui uses only [the standard Meson build options](https://mesonbuild.com/Builtin-options.html), so a libui build can be set up just like any other:
|
||||
|
||||
```
|
||||
$ # you must be in the top-level libui directory, otherwise this won't work
|
||||
$ meson setup build [options]
|
||||
$ ninja -C build
|
||||
```
|
||||
|
||||
Once this completes, everything will be under `build/meson-out/`. (Note that unlike the previous build processes, everything is built by default, including tests and examples.)
|
||||
|
||||
The most important options are:
|
||||
|
||||
* `--buildtype=(debug|release|...)` controls the type of build made; the default is `debug`. For a full list of valid values, consult [the Meson documentation](https://mesonbuild.com/Running-Meson.html).
|
||||
* `--default-library=(shared|static)` controls whether libui is built as a shared library or a static library; the default is `shared`. You currently cannot specify `both`, as the build process changes depending on the target type (though I am willing to look into changing things if at all possible).
|
||||
* `-Db_sanitize=which` allows enabling the chosen [sanitizer](https://github.com/google/sanitizers) on a system that supports sanitizers. The list of supported values is in [the Meson documentation](https://mesonbuild.com/Builtin-options.html#base-options).
|
||||
* `--backend=backend` allows using the specified `backend` for builds instead of `ninja` (the default). A list of supported values is in [the Meson documentation](https://mesonbuild.com/Builtin-options.html#universal-options).
|
||||
|
||||
Most other built-in options will work, though keep in mind there are a handful of options that cannot be overridden because libui depends on them holding a specific value; if you do override these, though, libui will warn you when you run `meson`.
|
||||
|
||||
The Meson website and documentation has more in-depth usage instructions.
|
||||
|
||||
For the sake of completeness, I should note that the default value of `--layout` is `flat`, not the usual `mirror`. This is done both to make creating the release archives easier as well as to reduce the chance that shared library builds will fail to start on Windows because the DLL is in another directory. You can always specify this manually if you want.
|
||||
|
||||
Backends other than `ninja` should work, but are untested by me.
|
||||
|
||||
## Installation
|
||||
|
||||
Meson also supports installing from source; if you use Ninja, just do
|
||||
|
||||
```
|
||||
$ ninja -C build install
|
||||
```
|
||||
|
||||
When running `meson`, the `--prefix` option will set the installation prefix. [The Meson documentation](https://mesonbuild.com/Builtin-options.html#universal-options) has more information, and even lists more fine-grained options that you can use to control the installation.
|
||||
|
||||
#### Arch Linux
|
||||
|
||||
Can be built from AUR: https://aur.archlinux.org/packages/libui-git/
|
||||
|
||||
## Documentation
|
||||
|
||||
Needs to be written. Consult `ui.h` and the examples for details for now.
|
||||
|
||||
## Language Bindings
|
||||
|
||||
libui was originally written as part of my [package ui for Go](https://github.com/andlabs/ui). Now that libui is separate, package ui has become a binding to libui. As such, package ui is the only official binding.
|
||||
|
||||
Other people have made bindings to other languages:
|
||||
|
||||
Language | Bindings
|
||||
--- | ---
|
||||
C++ | [libui-cpp](https://github.com/billyquith/libui-cpp), [cpp-libui-qtlike](https://github.com/aoloe/cpp-libui-qtlike)
|
||||
C# / .NET Framework | [LibUI.Binding](https://github.com/NattyNarwhal/LibUI.Binding)
|
||||
C# / .NET Core | [DevZH.UI](https://github.com/noliar/DevZH.UI), [SharpUI](https://github.com/benpye/sharpui/), [TCD.UI](https://github.com/tacdevel/tcdfx)
|
||||
CHICKEN Scheme | [wasamasa/libui](https://github.com/wasamasa/libui)
|
||||
Common Lisp | [jinwoo/cl-ui](https://github.com/jinwoo/cl-ui)
|
||||
Crystal | [libui.cr](https://github.com/Fusion/libui.cr), [hedron](https://github.com/Qwerp-Derp/hedron)
|
||||
D | [DerelictLibui (flat API)](https://github.com/Extrawurst/DerelictLibui), [libuid (object-oriented)](https://github.com/mogud/libuid)
|
||||
Euphoria | [libui-euphoria](https://github.com/ghaberek/libui-euphoria)
|
||||
Harbour | [hbui](https://github.com/rjopek/hbui)
|
||||
Haskell | [haskell-libui](https://github.com/beijaflor-io/haskell-libui)
|
||||
JavaScript/Node.js | [libui-node](https://github.com/parro-it/libui-node), [libui.js (merged into libui-node?)](https://github.com/mavenave/libui.js), [proton-native](https://github.com/kusti8/proton-native), [vuido](https://github.com/mimecorg/vuido)
|
||||
Julia | [Libui.jl](https://github.com/joa-quim/Libui.jl)
|
||||
Kotlin | [kotlin-libui](https://github.com/msink/kotlin-libui)
|
||||
Lua | [libuilua](https://github.com/zevv/libuilua), [libui-lua](https://github.com/mdombroski/libui-lua), [lui](http://tset.de/lui/index.html), [lui](https://github.com/zhaozg/lui)
|
||||
Nim | [ui](https://github.com/nim-lang/ui)
|
||||
Perl6 | [perl6-libui](https://github.com/Garland-g/perl6-libui)
|
||||
PHP | [ui](https://github.com/krakjoe/ui)
|
||||
Python | [pylibui](https://github.com/joaoventura/pylibui)
|
||||
Ruby | [libui-ruby](https://github.com/jamescook/libui-ruby), [libui](https://github.com/kojix2/libui)
|
||||
Rust | [libui-rs](https://github.com/rust-native-ui/libui-rs)
|
||||
Scala | [scalaui](https://github.com/lolgab/scalaui)
|
||||
Swift | [libui-swift](https://github.com/sclukey/libui-swift)
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
### Why does my program start in the background on OS X if I run from the command line?
|
||||
OS X normally does not start program executables directly; instead, it uses [Launch Services](https://developer.apple.com/reference/coreservices/1658613-launch_services?language=objc) to coordinate the launching of the program between the various parts of the system and the loading of info from an .app bundle. One of these coordination tasks is responsible for bringing a newly launched app into the foreground. This is called "activation".
|
||||
|
||||
When you run a binary directly from the Terminal, however, you are running it directly, not through Launch Services. Therefore, the program starts in the background, because no one told it to activate! Now, it turns out [there is an API](https://developer.apple.com/reference/appkit/nsapplication/1428468-activateignoringotherapps) that we can use to force our app to be activated. But if we use it, then we'd be trampling over Launch Services, which already knows whether it should activate or not. Therefore, libui does not step over Launch Services, at the cost of requiring an extra user step if running directly from the command line.
|
||||
|
||||
See also [this](https://github.com/andlabs/libui/pull/20#issuecomment-211381971) and [this](http://stackoverflow.com/questions/25318524/what-exactly-should-i-pass-to-nsapp-activateignoringotherapps-to-get-my-appl).
|
||||
|
||||
## Contributing
|
||||
|
||||
See `CONTRIBUTING.md`.
|
||||
|
||||
## Screenshots
|
||||
|
||||
From examples/controlgallery:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
262
dep/libui/TODO.md
Normal file
262
dep/libui/TODO.md
Normal file
@@ -0,0 +1,262 @@
|
||||
- make sure the last line of text layouts include leading
|
||||
|
||||
- documentation notes:
|
||||
- static binaries do not link system libraries, meaning apps still depend on shared GTK+, etc.
|
||||
- ui*Buttons are NOT compatible with uiButton functions
|
||||
|
||||
- more robust layout handling
|
||||
- uiFormTie() for ensuring multiple uiForms have the same label area widths
|
||||
- uiSizeGroup for size groups (GtkSizeGroup on GTK+, auto layout constraints on OS X; consider adding after 10.8 is gone)
|
||||
|
||||
- windows: should the initial hwndInsertAfter be HWND_BOTTOM for what we want?
|
||||
|
||||
- windows: document the rules for controls and containers
|
||||
|
||||
- windows: document the minimum size change propagation system
|
||||
|
||||
- provisions for controls that cannot be grown? especiailly for windows
|
||||
|
||||
- LC_VERSION_MIN_MACOSX has the 10.11 SDK; see if we can knock it down to 10.8 too; OS version is fine
|
||||
- apply the OS version stuff to the test program and examples too
|
||||
- what about micro versions (10.8.x)? force 10.8.0?
|
||||
|
||||
- go through ALL the objective-c objects we create and make sure we are using the proper ownership (alloc/init and new are owned by us, all class method constructors are autoreleased - thanks mikeash)
|
||||
|
||||
- on OS X, edit shortcuts like command-C working require that the menu entries be defined, or so it seems, even for NSAlert
|
||||
- other platforms?
|
||||
|
||||
- make sure all OS X event handlers that use target-action set the action to NULL when the target is unset
|
||||
|
||||
- provide a way to get the currently selected uiTab page? set?
|
||||
|
||||
- make it so that the windows cntrols only register a resize if their new minimum size is larger than their current size to easen the effect of flicker
|
||||
- it won't remove that outright, but it'll help
|
||||
|
||||
- add an option to the test program to run page7b as an independent test in its own window
|
||||
- same for page7c
|
||||
|
||||
- http://blogs.msdn.com/b/oldnewthing/archive/2004/01/12/57833.aspx provide a DEF file on Windows
|
||||
|
||||
- all ports: update state when adding a control to a parent
|
||||
- should uiWindowsSizing be computed against the window handle, not the parent?
|
||||
|
||||
- DPI awareness on windows
|
||||
|
||||
- http://stackoverflow.com/questions/4543087/applicationwillterminate-and-the-dock-but-wanting-to-cancel-this-action
|
||||
|
||||
ultimately:
|
||||
- MAYBE readd lifetime handling/destruction blocking
|
||||
- related? [12:25] <ZeroOne> And the blue outline on those buttons [ALL clicked buttons on Windows 7] won't go away
|
||||
- I get this too
|
||||
- not anymore
|
||||
- SWP_NOCOPYBITS to avoid button redraw issues on Windows when not in tab, but only when making resize faster
|
||||
- secondary side alignment control in uiBox
|
||||
- Windows: don't abort if a cleanup function fails?
|
||||
|
||||
- 32-bit Mac OS X support (requires lots of code changes)
|
||||
- change the build system to be more receptive to arch changes
|
||||
|
||||
notes to self
|
||||
- explicitly document label position at top-left corner
|
||||
- explicitly document that if number of radio buttons >= 1 there will always be a selection
|
||||
- mark that uiControlShow() on a uiWindow() will bring to front and give keyboard focus because of OS X
|
||||
- make sure ShowWindow() is sufficient for zorder on Windows
|
||||
- document that you CAN use InsertAt functions to insert at the first invalid index, even if the array is empty
|
||||
- note that uiTabInsertAt() does NOT change the current tab page (it may change its index if inserting before the current page)
|
||||
- note that the default action for uiWindowOnClosing() is to return 0 (keep the window open)
|
||||
- note that uiInitOptions should be initialized to zero
|
||||
- explicitly document that uiCheckboxSetChecked() and uiEntrySetText() do not fire uiCheckboxOnToggled() and uiEntryOnChanged(), respectively
|
||||
- note that if a menu is requested on systems with menubars on windows but no menus are defined, the result is a blank menubar, with whatever that means left up to the OS to decide
|
||||
- note that handling of multiple consecutive separators in menus, leading separators in menus, and trailing separators in menus are all OS-defined
|
||||
- note that uiDrawMatrixInvert() does not change the matrix if it fails
|
||||
- note that the use of strings that are not strictly valid UTF-8 results in undefined behavior
|
||||
|
||||
- test RTL
|
||||
- automate RTL
|
||||
- now that stock items are deprecated, I have to maintain translations of the Cancel, Open, and Save buttons on GTK+ myself (thanks baedert in irc.gimp.net/#gtk+)
|
||||
- either that or keep using stock items
|
||||
|
||||
- http://blogs.msdn.com/b/oldnewthing/archive/2014/02/26/10503148.aspx
|
||||
|
||||
- build optimizations
|
||||
|
||||
- use http://www.appveyor.com/ to do Windows build CI since people want CI
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
- consider just having the windows backend in C++
|
||||
- consider having it all in C++
|
||||
|
||||
|
||||
|
||||
don't forget LONGTERMs as well
|
||||
|
||||
notes
|
||||
- http://blogs.msdn.com/b/oldnewthing/archive/2004/03/29/101121.aspx on accelerators
|
||||
|
||||
- group and tab should act as if they have no child if the child is hidden
|
||||
on windows
|
||||
|
||||
|
||||
|
||||
- a way to do recursive main loops
|
||||
- how do we handle 0 returns from non-recursive uiMainStep() calls that aren't the main loop? (event handlers, for instance)
|
||||
- should repeated calls to uiMainStep() after uiQuit() return 0 reliably? this will be needed for non-recursive loops
|
||||
|
||||
http://stackoverflow.com/questions/38338426/meaning-of-ampersand-in-rc-files/38338841?noredirect=1#comment64093084_38338841
|
||||
|
||||
label shortcut keys
|
||||
|
||||
- remove whining from source code
|
||||
|
||||
[01:41:47] <vrishab> Hi. does pango support "fgalpha". I see that foreground="112233xx" works ( alpha=xx ), but fgalpha is a no-op
|
||||
[01:52:29] <vrishab> pango_attr_foreground_alpha_new (32767) seems to be called in either case, but only the "foreground" attr works
|
||||
[01:56:09] lolek (lolek@ip-91-244-230-76.simant.pl) joined the channel
|
||||
[01:57:48] <vrishab> ok. seems like "foreground" is mandatory attr, 1. "foreground-without-alpha" + "alpha" works 2. "foreground-with-alpha" works. 3. "alpha" alone doesn
|
||||
[01:57:52] <vrishab> 't work
|
||||
[01:58:29] <vrishab> Is there a way to just specify alpha on the current foreground color ?
|
||||
[02:00:23] lolek (lolek@ip-91-244-230-76.simant.pl) left the channel
|
||||
[02:07:41] mjog (mjog@uniwide-pat-pool-129-94-8-98.gw.unsw.edu.au) left IRC (Quit: mjog)
|
||||
[02:08:10] seb128 (seb128@53542B83.cm-6-5a.dynamic.ziggo.nl) joined the channel
|
||||
[02:12:37] <andlabs> huh
|
||||
[02:12:41] <andlabs> what version of pango?
|
||||
[02:13:05] <vrishab> the latest .
|
||||
[02:15:00] <vrishab> 1.40.3
|
||||
[02:20:46] <andlabs> I'll ahve to keep this in mind then, thanks
|
||||
[02:20:59] <andlabs> if only there was a cairo-specific attribute for alpha...
|
||||
|
||||
FONT LOADING
|
||||
|
||||
[00:10:08] <hergertme> andlabs: is there API yet to load from memory? last i checked i only found from file (which we use in builder). https://git.gnome.org/browse/gnome-builder/tree/libide/editor/ide-editor-map-bin.c#n115
|
||||
[00:13:12] mrmcq2u_ (mrmcq2u@109.79.53.90) joined the channel
|
||||
[00:14:59] mrmcq2u (mrmcq2u@109.79.73.102) left IRC (Ping timeout: 181 seconds)
|
||||
[00:15:19] <andlabs> hergertme: no, which is why I was asking =P
|
||||
[00:15:30] <andlabs> I would have dug down if I could ensure at least something about the backends a GTK+ 3 program uses
|
||||
[00:15:39] <andlabs> on all platforms except windows and os x
|
||||
[00:16:11] <hergertme> to the best of my (partially outdated, given pace of foss) knowledge there isn't an api to load from memory
|
||||
[00:16:28] <hergertme> you can possibly make a tmpdir and put a temp file in there
|
||||
[00:16:52] <hergertme> and load that as your font dir in your FcConfig, so any PangoFontDescription would point to that one font, no matter what
|
||||
[00:17:18] <hergertme> (using the API layed out in that link)
|
||||
[00:18:18] dsr1014__ (dsr1014@c-73-72-102-18.hsd1.il.comcast.net) joined the channel
|
||||
[00:35:18] simukis_ (simukis@78-60-58-6.static.zebra.lt) left IRC (Quit: simukis_)
|
||||
[00:35:48] dreamon_ (dreamon@ppp-188-174-49-41.dynamic.mnet-online.de) joined the channel
|
||||
[00:40:09] samtoday_ (samtoday@114-198-116-132.dyn.iinet.net.au) joined the channel
|
||||
[00:40:32] mjog (mjog@120.18.225.46) joined the channel
|
||||
[00:40:38] <andlabs> hergertme: not necessarily fontconfig
|
||||
[00:40:45] <andlabs> it can be with ft2 or xft I guess
|
||||
[00:40:55] <andlabs> especially since I want the API NOT to make the font part of the font panel
|
||||
[00:42:07] <hergertme> what sort of deprecated code are you trying to support?
|
||||
[00:42:35] <hergertme> both of those are deprecated in pango fwiw
|
||||
[00:43:06] <hergertme> on Linux im pretty sure we use FC everywhere these days
|
||||
[00:44:46] <hergertme> (and gtk_widget_set_font_map() is how you get your custom font into a widget without affecting the global font lists, as layed out in that link)
|
||||
[00:49:14] vasaikar (vasaikar@125.16.97.121) joined the channel
|
||||
[00:50:14] karlt (karl@2400:e780:801:224:f121:e611:d139:e70e) left IRC (Client exited)
|
||||
[00:50:49] karlt (karl@2400:e780:801:224:f121:e611:d139:e70e) joined the channel
|
||||
[00:51:43] PioneerAxon (PioneerAxo@122.171.61.146) left IRC (Ping timeout: 180 seconds)
|
||||
[00:57:47] PioneerAxon (PioneerAxo@106.201.37.181) joined the channel
|
||||
[01:03:01] karlt (karl@2400:e780:801:224:f121:e611:d139:e70e) left IRC (Ping timeout: 181 seconds)
|
||||
[01:05:49] muhannad (muhannad@95.218.26.152) left IRC (Quit: muhannad)
|
||||
[01:07:51] <andlabs> hergertme: hm
|
||||
[01:07:54] <andlabs> all right, thanks
|
||||
[01:08:05] <andlabs> hergertme: fwiw right now my requirement is 3.10
|
||||
[01:10:47] <hergertme> ah, well you'll probably be missing the neccesary font API on gtk_widget
|
||||
[01:11:04] <hergertme> but pango should be fine even back as far as https://developer.gnome.org/pango/1.28/PangoFcFontMap.html
|
||||
[01:11:56] <andlabs> good
|
||||
[01:12:04] <andlabs> because this is for custom drawing into a DrawingArea
|
||||
[01:14:12] <hergertme> presumably just create your PangoContext as normal, but call pango_context_set_font_map() with the map you've setup. now, the load a font from a file i dont think was added to FontConfig until later though (not sure what release)
|
||||
[01:15:53] <hergertme> FcConfigAppFontAddFile() <-- that API
|
||||
[01:16:30] <hergertme> great, and they don't say what version the API was added in teh docs
|
||||
function: ide_editor_map_bin_add()
|
||||
|
||||
- Mouse ClickLock: do we need to do anything special? *should* we? https://msdn.microsoft.com/en-us/library/windows/desktop/ms724947(v=vs.85).aspx
|
||||
- consider a uiAnticipateDoubleClick() or uiDoubleClickTime() (for a uiQueueTimer()) or something: https://blogs.msdn.microsoft.com/oldnewthing/20041015-00/?p=37553
|
||||
|
||||
- determine whether MSGF_USER is for and if it's correct for our uiArea message filter (if we have one)
|
||||
|
||||
- source file encoding and MSVC compiler itself? https://stackoverflow.com/questions/20518040/how-can-i-get-the-directwrite-padwrite-sample-to-work
|
||||
- also need to worry about object file and output encoding...
|
||||
- this also names the author of the padwrite sample
|
||||
|
||||
- OpenType features TODOs
|
||||
- https://stackoverflow.com/questions/32545675/what-are-the-default-typography-settings-used-by-idwritetextlayout
|
||||
- feature/shaping interaction rules for arabic: https://www.microsoft.com/typography/OpenTypeDev/arabic/intro.htm
|
||||
- other stuff, mostly about UIs and what users expect to be able to set
|
||||
- https://klim.co.nz/blog/towards-an-ideal-opentype-user-interface/
|
||||
- https://libregraphicsmeeting.org/2016/designing-for-many-applications-opentype-features-ui/
|
||||
- https://www.youtube.com/watch?v=wEyDhsH076Y
|
||||
- https://twitter.com/peter_works
|
||||
- http://ilovetypography.com/2014/10/22/better-ui-for-better-typography-adobe-petition/
|
||||
- http://silgraphite.sourceforge.net/ui/studynote.html
|
||||
|
||||
- add NXCOMPAT (DEP awareness) to the Windows builds
|
||||
- and ASLR too? or is that not a linker setting
|
||||
|
||||
OS X: embedding an Info.plist into a binary directly
|
||||
https://www.objc.io/issues/6-build-tools/mach-o-executables/
|
||||
TODO will this let Dictation work?
|
||||
TODO investigate ad-hoc codesigning
|
||||
|
||||
https://blogs.msdn.microsoft.com/oldnewthing/20040112-00/?p=41083 def files for decoration (I forget if I said this earlier)
|
||||
|
||||
TODO ClipCursor() stuff; probably not useful for libui but still
|
||||
https://blogs.msdn.microsoft.com/oldnewthing/20140102-00/?p=2183
|
||||
https://blogs.msdn.microsoft.com/oldnewthing/20061117-03/?p=28973
|
||||
https://msdn.microsoft.com/en-us/library/windows/desktop/ms648383(v=vs.85).aspx
|
||||
|
||||
https://cmake.org/Wiki/CMake_Useful_Variables
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
|
||||
On Unix systems, this will make linker report any unresolved symbols from object files (which is quite typical when you compile many targets in CMake projects, but do not bother with linking target dependencies in proper order).
|
||||
(I used to have something like this back when I used makefiles; did it convert in? I forget)
|
||||
|
||||
look into these for the os x port
|
||||
https://developer.apple.com/documentation/appkit/view_management/nseditor?language=objc
|
||||
https://developer.apple.com/documentation/appkit/view_management/nseditorregistration?language=objc
|
||||
|
||||
for future versions of the os x port
|
||||
https://developer.apple.com/documentation/appkit/nslayoutguide?language=objc and anchors
|
||||
https://developer.apple.com/documentation/appkit/nsuserinterfacecompression?language=objc https://developer.apple.com/documentation/appkit/nsuserinterfacecompressionoptions?language=objc
|
||||
though at some point we'll be able to use NSStackView and NSGridView directly, so...
|
||||
|
||||
Cocoa PDFs
|
||||
https://developer.apple.com/documentation/appkit/nspdfimagerep?language=objc
|
||||
https://developer.apple.com/documentation/coregraphics?language=objc
|
||||
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Printing/osxp_pagination/osxp_pagination.html#//apple_ref/doc/uid/20001051-119037
|
||||
https://developer.apple.com/documentation/appkit/nsprintoperation/1529269-pdfoperationwithview?language=objc
|
||||
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Printing/osxp_printapps/osxp_printapps.html#//apple_ref/doc/uid/20000861-BAJBFGED
|
||||
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Printing/osxp_printingapi/osxp_printingapi.html#//apple_ref/doc/uid/10000083i-CH2-SW2
|
||||
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Printing/osxp_printinfo/osxp_printinfo.html#//apple_ref/doc/uid/20000864-BAJBFGED
|
||||
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Printing/osxp_printlayoutpanel/osxp_printlayoutpanel.html#//apple_ref/doc/uid/20000863-BAJBFGED
|
||||
https://developer.apple.com/documentation/appkit/nspagelayout?language=objc
|
||||
https://developer.apple.com/documentation/appkit/nsprintinfo?language=objc
|
||||
https://developer.apple.com/documentation/applicationservices/core_printing?language=objc
|
||||
https://developer.apple.com/documentation/applicationservices/1463247-pmcreatesession?language=objc
|
||||
https://developer.apple.com/documentation/applicationservices/pmprintsession?language=objc
|
||||
https://developer.apple.com/documentation/applicationservices/1460101-pmsessionbegincgdocumentnodialog?language=objc
|
||||
https://developer.apple.com/documentation/applicationservices/1463416-pmsessionbeginpagenodialog?language=objc
|
||||
https://developer.apple.com/documentation/applicationservices/1506831-anonymous/kpmdestinationprocesspdf?language=objc
|
||||
https://developer.apple.com/documentation/applicationservices/1461960-pmcreategenericprinter?language=objc
|
||||
https://developer.apple.com/documentation/applicationservices/1460101-pmsessionbegincgdocumentnodialog?language=objc
|
||||
https://developer.apple.com/documentation/applicationservices/1464527-pmsessionenddocumentnodialog?language=objc
|
||||
https://developer.apple.com/documentation/applicationservices/1461952-pmsessiongetcggraphicscontext?language=objc
|
||||
https://developer.apple.com/library/content/technotes/tn2248/_index.html
|
||||
https://developer.apple.com/library/content/samplecode/PMPrinterPrintWithFile/Introduction/Intro.html
|
||||
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Printing/osxp_aboutprinting/osxp_aboutprt.html
|
||||
|
||||
- run os x code with `OBJC_DEBUG_MISSING_POOLS=YES` and other `OBJC_HELP=YES` options
|
||||
- turn off the autorelease pool to make sure we're not autoreleasing improperly
|
||||
|
||||
TODO investigate -Weverything in clang alongside -Wall in MSVC (and in gcc too maybe...)
|
||||
|
||||
mac os x accessibility
|
||||
- https://developer.apple.com/documentation/appkit/nsworkspace/1524656-accessibilitydisplayshoulddiffer?language=objc
|
||||
- https://developer.apple.com/documentation/appkit/nsworkspace/1526290-accessibilitydisplayshouldincrea?language=objc
|
||||
- https://developer.apple.com/documentation/appkit/nsworkspace/1533006-accessibilitydisplayshouldreduce?language=objc
|
||||
|
||||
uiEntry disabling bugs http://www.cocoabuilder.com/archive/cocoa/215525-nstextfield-bug-can-be.html
|
||||
uiMultilineEntry disabling https://developer.apple.com/library/content/qa/qa1461/_index.html
|
||||
|
||||
more TODOs:
|
||||
- make no guarantee about buildability of feature branches
|
||||
3
dep/libui/UPSTREAM.md
Normal file
3
dep/libui/UPSTREAM.md
Normal file
@@ -0,0 +1,3 @@
|
||||
This is a clone of the master branch of https://github.com/andlabs/libui made
|
||||
on 2021-12-05.
|
||||
|
||||
378
dep/libui/azure-pipelines.yml
Normal file
378
dep/libui/azure-pipelines.yml
Normal file
@@ -0,0 +1,378 @@
|
||||
# 31 march 2019
|
||||
|
||||
trigger:
|
||||
branches:
|
||||
include:
|
||||
- '*'
|
||||
tags:
|
||||
include:
|
||||
- '*'
|
||||
|
||||
variables:
|
||||
releaseExamples: 'controlgallery cpp-multithread datetime drawtext histogram tester timer'
|
||||
|
||||
jobs:
|
||||
|
||||
# linux {
|
||||
|
||||
- job: linux_386_shared
|
||||
displayName: 'Linux 386 Shared'
|
||||
pool:
|
||||
vmImage: 'ubuntu-16.04'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/setup-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/linux-386-install-gtk-dev.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: export CFLAGS=-m32 CXXFLAGS=-m32 PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig
|
||||
defaultLibrary: shared
|
||||
- template: azure-pipelines/build.yml
|
||||
- template: azure-pipelines/artifacts.yml
|
||||
parameters:
|
||||
os: linux
|
||||
arch: 386
|
||||
libtype: shared
|
||||
libfiles: libui.so.0
|
||||
osHeader: ui_unix.h
|
||||
|
||||
- job: linux_386_static
|
||||
displayName: 'Linux 386 Static'
|
||||
pool:
|
||||
vmImage: 'ubuntu-16.04'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/setup-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/linux-386-install-gtk-dev.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: export CFLAGS=-m32 CXXFLAGS=-m32 PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig
|
||||
defaultLibrary: static
|
||||
- template: azure-pipelines/build.yml
|
||||
- template: azure-pipelines/artifacts.yml
|
||||
parameters:
|
||||
os: linux
|
||||
arch: 386
|
||||
libtype: static
|
||||
libfiles: libui.a
|
||||
osHeader: ui_unix.h
|
||||
|
||||
- job: linux_amd64_shared
|
||||
displayName: 'Linux amd64 Shared'
|
||||
pool:
|
||||
vmImage: 'ubuntu-16.04'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/setup-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/linux-install-gtk-dev.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
defaultLibrary: shared
|
||||
- template: azure-pipelines/build.yml
|
||||
- template: azure-pipelines/artifacts.yml
|
||||
parameters:
|
||||
os: linux
|
||||
arch: amd64
|
||||
libtype: shared
|
||||
libfiles: libui.so.0
|
||||
osHeader: ui_unix.h
|
||||
|
||||
- job: linux_amd64_static
|
||||
displayName: 'Linux amd64 Static'
|
||||
pool:
|
||||
vmImage: 'ubuntu-16.04'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/setup-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/linux-install-gtk-dev.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
defaultLibrary: static
|
||||
- template: azure-pipelines/build.yml
|
||||
- template: azure-pipelines/artifacts.yml
|
||||
parameters:
|
||||
os: linux
|
||||
arch: amd64
|
||||
libtype: static
|
||||
libfiles: libui.a
|
||||
osHeader: ui_unix.h
|
||||
|
||||
# }
|
||||
|
||||
# windows vs2015 {
|
||||
|
||||
- job: windows_386_msvc2015_shared
|
||||
displayName: 'Windows 386 MSVC2015 Shared'
|
||||
pool:
|
||||
vmImage: 'vs2015-win2012r2'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/vs2015-install-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/windows-install-ninja.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
|
||||
defaultLibrary: shared
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: 386
|
||||
toolchain: msvc2015
|
||||
libtype: shared
|
||||
libfiles: libui.dll libui.exp libui.lib
|
||||
osHeader: ui_windows.h
|
||||
|
||||
- job: windows_386_msvc2015_static
|
||||
displayName: 'Windows 386 MSVC2015 Static'
|
||||
pool:
|
||||
vmImage: 'vs2015-win2012r2'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/vs2015-install-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/windows-install-ninja.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
|
||||
defaultLibrary: static
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
|
||||
afterBuild: ren build\meson-out\libui.a libui.lib
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: 386
|
||||
toolchain: msvc2015
|
||||
libtype: static
|
||||
libfiles: libui.lib
|
||||
osHeader: ui_windows.h
|
||||
|
||||
- job: windows_amd64_msvc2015_shared
|
||||
displayName: 'Windows amd64 MSVC2015 Shared'
|
||||
pool:
|
||||
vmImage: 'vs2015-win2012r2'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/vs2015-install-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/windows-install-ninja.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
defaultLibrary: shared
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: amd64
|
||||
toolchain: msvc2015
|
||||
libtype: shared
|
||||
libfiles: libui.dll libui.exp libui.lib
|
||||
osHeader: ui_windows.h
|
||||
|
||||
- job: windows_amd64_msvc2015_static
|
||||
displayName: 'Windows amd64 MSVC2015 Static'
|
||||
pool:
|
||||
vmImage: 'vs2015-win2012r2'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/vs2015-install-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/windows-install-ninja.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
defaultLibrary: static
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
afterBuild: ren build\meson-out\libui.a libui.lib
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: amd64
|
||||
toolchain: msvc2015
|
||||
libtype: static
|
||||
libfiles: libui.lib
|
||||
osHeader: ui_windows.h
|
||||
|
||||
# }
|
||||
|
||||
# windows vs2017 {
|
||||
|
||||
- job: windows_386_msvc2017_shared
|
||||
displayName: 'Windows 386 MSVC2017 Shared'
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/setup-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/windows-install-ninja.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
defaultLibrary: shared
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: 386
|
||||
toolchain: msvc2017
|
||||
libtype: shared
|
||||
libfiles: libui.dll libui.exp libui.lib
|
||||
osHeader: ui_windows.h
|
||||
|
||||
- job: windows_386_msvc2017_static
|
||||
displayName: 'Windows 386 MSVC2017 Static'
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/setup-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/windows-install-ninja.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
defaultLibrary: static
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
afterBuild: ren build\meson-out\libui.a libui.lib
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: 386
|
||||
toolchain: msvc2017
|
||||
libtype: static
|
||||
libfiles: libui.lib
|
||||
osHeader: ui_windows.h
|
||||
|
||||
- job: windows_amd64_msvc2017_shared
|
||||
displayName: 'Windows amd64 MSVC2017 Shared'
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/setup-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/windows-install-ninja.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
defaultLibrary: shared
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: amd64
|
||||
toolchain: msvc2017
|
||||
libtype: shared
|
||||
libfiles: libui.dll libui.exp libui.lib
|
||||
osHeader: ui_windows.h
|
||||
|
||||
- job: windows_amd64_msvc2017_static
|
||||
displayName: 'Windows amd64 MSVC2017 Static'
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/setup-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/windows-install-ninja.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
defaultLibrary: static
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
afterBuild: ren build\meson-out\libui.a libui.lib
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: amd64
|
||||
toolchain: msvc2017
|
||||
libtype: static
|
||||
libfiles: libui.lib
|
||||
osHeader: ui_windows.h
|
||||
|
||||
# }
|
||||
|
||||
# mac {
|
||||
|
||||
# TODO beforeConfigure/beforeBuild: export SDKROOT=$(xcodebuild -version -sdk macosx10.13 Path)?
|
||||
|
||||
- job: darwin_amd64_shared
|
||||
displayName: 'Darwin amd64 Shared'
|
||||
pool:
|
||||
vmImage: 'macos-10.13'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/setup-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/darwin-install-ninja.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
defaultLibrary: shared
|
||||
- template: azure-pipelines/build.yml
|
||||
- template: azure-pipelines/artifacts.yml
|
||||
parameters:
|
||||
os: darwin
|
||||
arch: amd64
|
||||
libtype: shared
|
||||
libfiles: libui.A.dylib
|
||||
osHeader: ui_darwin.h
|
||||
|
||||
- job: darwin_amd64_static
|
||||
displayName: 'Darwin amd64 Static'
|
||||
pool:
|
||||
vmImage: 'macos-10.13'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/setup-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/darwin-install-ninja.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
defaultLibrary: static
|
||||
- template: azure-pipelines/build.yml
|
||||
- template: azure-pipelines/artifacts.yml
|
||||
parameters:
|
||||
os: darwin
|
||||
arch: amd64
|
||||
libtype: static
|
||||
libfiles: libui.a
|
||||
osHeader: ui_darwin.h
|
||||
|
||||
# }
|
||||
399
dep/libui/azure-pipelines/TODOMatrix
Normal file
399
dep/libui/azure-pipelines/TODOMatrix
Normal file
@@ -0,0 +1,399 @@
|
||||
# 31 march 2019
|
||||
|
||||
variables:
|
||||
releaseExamples: 'controlgallery cpp-multithread datetime drawtext histogram tester timer'
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
# targetname:
|
||||
# os: 'fill this in'
|
||||
# arch: 'fill this in'
|
||||
# toolchain: 'fill this in'
|
||||
# libtype: 'fill this in'
|
||||
# vmImage: 'fill this in'
|
||||
# python3Template: 'fill filename'
|
||||
# depsAndNinjaTemplate: 'fill filename'
|
||||
# beforeConfigure: 'fill this in'
|
||||
# beforeBuild: 'fill this in'
|
||||
# afterBuild: 'fill this in'
|
||||
# artifactTemplate: 'fill filename'
|
||||
# libfiles: 'fill this in'
|
||||
# osHeader: 'fill this in'
|
||||
linux_386_shared:
|
||||
os: 'linux'
|
||||
arch: '386'
|
||||
libtype: 'shared'
|
||||
vmImage: 'ubuntu-16.04'
|
||||
python3Template: 'azure-pipelines/setup-python3.yml'
|
||||
depsAndNinjaTemplate: 'azure-pipelines/linux-386-install-gtk-dev.yml'
|
||||
beforeConfigure: 'export CFLAGS=-m32 CXXFLAGS=-m32 PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig'
|
||||
artifactTemplate: 'azure-pipelines/artifacts.yml'
|
||||
libfiles: 'libui.so.0'
|
||||
osHeader: 'ui_unix.h'
|
||||
|
||||
pool:
|
||||
vmImage: $(vmImage)
|
||||
|
||||
workspace:
|
||||
clean: all
|
||||
|
||||
steps:
|
||||
- template: $(variables.python3Template)
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: $(variables.depsAndNinjaTemplate)
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: $(beforeConfigure)
|
||||
defaultLibrary: $(libtype)
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: $(beforeBuild)
|
||||
afterBuild: $(afterBuild)
|
||||
- template: $(variables.artifactTemplate)
|
||||
parameters:
|
||||
os: $(os)
|
||||
arch: $(arch)
|
||||
toolchain: $(toolchain)
|
||||
libtype: $(libtype)
|
||||
libfiles: $(libfiles)
|
||||
osHeader: $(osHeader)
|
||||
|
||||
## linux {
|
||||
#- job: linux_386_static
|
||||
# displayName: 'Linux 386 Static'
|
||||
# pool:
|
||||
# vmImage: 'ubuntu-16.04'
|
||||
# workspace:
|
||||
# clean: all
|
||||
# steps:
|
||||
# - template: azure-pipelines/setup-python3.yml
|
||||
# - template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
# - template: azure-pipelines/linux-386-install-gtk-dev.yml
|
||||
# - template: azure-pipelines/configure.yml
|
||||
# parameters:
|
||||
# beforeConfigure: export CFLAGS=-m32 CXXFLAGS=-m32 PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig
|
||||
# defaultLibrary: static
|
||||
# - template: azure-pipelines/build.yml
|
||||
# - template: azure-pipelines/artifacts.yml
|
||||
# parameters:
|
||||
# os: linux
|
||||
# arch: 386
|
||||
# libtype: static
|
||||
# libfiles: libui.a
|
||||
# osHeader: ui_unix.h
|
||||
#
|
||||
#- job: linux_amd64_shared
|
||||
# displayName: 'Linux amd64 Shared'
|
||||
# pool:
|
||||
# vmImage: 'ubuntu-16.04'
|
||||
# workspace:
|
||||
# clean: all
|
||||
# steps:
|
||||
# - template: azure-pipelines/setup-python3.yml
|
||||
# - template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
# - template: azure-pipelines/linux-install-gtk-dev.yml
|
||||
# - template: azure-pipelines/configure.yml
|
||||
# parameters:
|
||||
# defaultLibrary: shared
|
||||
# - template: azure-pipelines/build.yml
|
||||
# - template: azure-pipelines/artifacts.yml
|
||||
# parameters:
|
||||
# os: linux
|
||||
# arch: amd64
|
||||
# libtype: shared
|
||||
# libfiles: libui.so.0
|
||||
# osHeader: ui_unix.h
|
||||
#
|
||||
#- job: linux_amd64_static
|
||||
# displayName: 'Linux amd64 Static'
|
||||
# pool:
|
||||
# vmImage: 'ubuntu-16.04'
|
||||
# workspace:
|
||||
# clean: all
|
||||
# steps:
|
||||
# - template: azure-pipelines/setup-python3.yml
|
||||
# - template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
# - template: azure-pipelines/linux-install-gtk-dev.yml
|
||||
# - template: azure-pipelines/configure.yml
|
||||
# parameters:
|
||||
# defaultLibrary: static
|
||||
# - template: azure-pipelines/build.yml
|
||||
# - template: azure-pipelines/artifacts.yml
|
||||
# parameters:
|
||||
# os: linux
|
||||
# arch: amd64
|
||||
# libtype: static
|
||||
# libfiles: libui.a
|
||||
# osHeader: ui_unix.h
|
||||
#
|
||||
## }
|
||||
#
|
||||
## windows vs2015 {
|
||||
#
|
||||
#- job: windows_386_msvc2015_shared
|
||||
# displayName: 'Windows 386 MSVC2015 Shared'
|
||||
# pool:
|
||||
# vmImage: 'vs2015-win2012r2'
|
||||
# workspace:
|
||||
# clean: all
|
||||
# steps:
|
||||
# - template: azure-pipelines/vs2015-install-python3.yml
|
||||
# - template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
# - template: azure-pipelines/windows-install-ninja.yml
|
||||
# - template: azure-pipelines/configure.yml
|
||||
# parameters:
|
||||
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
|
||||
# defaultLibrary: shared
|
||||
# - template: azure-pipelines/build.yml
|
||||
# parameters:
|
||||
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
|
||||
# - template: azure-pipelines/windows-artifacts.yml
|
||||
# parameters:
|
||||
# os: windows
|
||||
# arch: 386
|
||||
# toolchain: msvc2015
|
||||
# libtype: shared
|
||||
# libfiles: libui.dll libui.exp libui.lib
|
||||
# osHeader: ui_windows.h
|
||||
#
|
||||
#- job: windows_386_msvc2015_static
|
||||
# displayName: 'Windows 386 MSVC2015 Static'
|
||||
# pool:
|
||||
# vmImage: 'vs2015-win2012r2'
|
||||
# workspace:
|
||||
# clean: all
|
||||
# steps:
|
||||
# - template: azure-pipelines/vs2015-install-python3.yml
|
||||
# - template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
# - template: azure-pipelines/windows-install-ninja.yml
|
||||
# - template: azure-pipelines/configure.yml
|
||||
# parameters:
|
||||
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
|
||||
# defaultLibrary: static
|
||||
# - template: azure-pipelines/build.yml
|
||||
# parameters:
|
||||
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
|
||||
# afterBuild: ren build\meson-out\libui.a libui.lib
|
||||
# - template: azure-pipelines/windows-artifacts.yml
|
||||
# parameters:
|
||||
# os: windows
|
||||
# arch: 386
|
||||
# toolchain: msvc2015
|
||||
# libtype: static
|
||||
# libfiles: libui.lib
|
||||
# osHeader: ui_windows.h
|
||||
#
|
||||
#- job: windows_amd64_msvc2015_shared
|
||||
# displayName: 'Windows amd64 MSVC2015 Shared'
|
||||
# pool:
|
||||
# vmImage: 'vs2015-win2012r2'
|
||||
# workspace:
|
||||
# clean: all
|
||||
# steps:
|
||||
# - template: azure-pipelines/vs2015-install-python3.yml
|
||||
# - template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
# - template: azure-pipelines/windows-install-ninja.yml
|
||||
# - template: azure-pipelines/configure.yml
|
||||
# parameters:
|
||||
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
# defaultLibrary: shared
|
||||
# - template: azure-pipelines/build.yml
|
||||
# parameters:
|
||||
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
# - template: azure-pipelines/windows-artifacts.yml
|
||||
# parameters:
|
||||
# os: windows
|
||||
# arch: amd64
|
||||
# toolchain: msvc2015
|
||||
# libtype: shared
|
||||
# libfiles: libui.dll libui.exp libui.lib
|
||||
# osHeader: ui_windows.h
|
||||
#
|
||||
#- job: windows_amd64_msvc2015_static
|
||||
# displayName: 'Windows amd64 MSVC2015 Static'
|
||||
# pool:
|
||||
# vmImage: 'vs2015-win2012r2'
|
||||
# workspace:
|
||||
# clean: all
|
||||
# steps:
|
||||
# - template: azure-pipelines/vs2015-install-python3.yml
|
||||
# - template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
# - template: azure-pipelines/windows-install-ninja.yml
|
||||
# - template: azure-pipelines/configure.yml
|
||||
# parameters:
|
||||
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
# defaultLibrary: static
|
||||
# - template: azure-pipelines/build.yml
|
||||
# parameters:
|
||||
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
# afterBuild: ren build\meson-out\libui.a libui.lib
|
||||
# - template: azure-pipelines/windows-artifacts.yml
|
||||
# parameters:
|
||||
# os: windows
|
||||
# arch: amd64
|
||||
# toolchain: msvc2015
|
||||
# libtype: static
|
||||
# libfiles: libui.lib
|
||||
# osHeader: ui_windows.h
|
||||
#
|
||||
## }
|
||||
#
|
||||
## windows vs2017 {
|
||||
#
|
||||
#- job: windows_386_msvc2017_shared
|
||||
# displayName: 'Windows 386 MSVC2017 Shared'
|
||||
# pool:
|
||||
# vmImage: 'vs2017-win2016'
|
||||
# workspace:
|
||||
# clean: all
|
||||
# steps:
|
||||
# - template: azure-pipelines/setup-python3.yml
|
||||
# - template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
# - template: azure-pipelines/windows-install-ninja.yml
|
||||
# - template: azure-pipelines/configure.yml
|
||||
# parameters:
|
||||
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
# defaultLibrary: shared
|
||||
# - template: azure-pipelines/build.yml
|
||||
# parameters:
|
||||
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
# - template: azure-pipelines/windows-artifacts.yml
|
||||
# parameters:
|
||||
# os: windows
|
||||
# arch: 386
|
||||
# toolchain: msvc2017
|
||||
# libtype: shared
|
||||
# libfiles: libui.dll libui.exp libui.lib
|
||||
# osHeader: ui_windows.h
|
||||
#
|
||||
#- job: windows_386_msvc2017_static
|
||||
# displayName: 'Windows 386 MSVC2017 Static'
|
||||
# pool:
|
||||
# vmImage: 'vs2017-win2016'
|
||||
# workspace:
|
||||
# clean: all
|
||||
# steps:
|
||||
# - template: azure-pipelines/setup-python3.yml
|
||||
# - template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
# - template: azure-pipelines/windows-install-ninja.yml
|
||||
# - template: azure-pipelines/configure.yml
|
||||
# parameters:
|
||||
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
# defaultLibrary: static
|
||||
# - template: azure-pipelines/build.yml
|
||||
# parameters:
|
||||
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
# afterBuild: ren build\meson-out\libui.a libui.lib
|
||||
# - template: azure-pipelines/windows-artifacts.yml
|
||||
# parameters:
|
||||
# os: windows
|
||||
# arch: 386
|
||||
# toolchain: msvc2017
|
||||
# libtype: static
|
||||
# libfiles: libui.lib
|
||||
# osHeader: ui_windows.h
|
||||
#
|
||||
#- job: windows_amd64_msvc2017_shared
|
||||
# displayName: 'Windows amd64 MSVC2017 Shared'
|
||||
# pool:
|
||||
# vmImage: 'vs2017-win2016'
|
||||
# workspace:
|
||||
# clean: all
|
||||
# steps:
|
||||
# - template: azure-pipelines/setup-python3.yml
|
||||
# - template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
# - template: azure-pipelines/windows-install-ninja.yml
|
||||
# - template: azure-pipelines/configure.yml
|
||||
# parameters:
|
||||
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
# defaultLibrary: shared
|
||||
# - template: azure-pipelines/build.yml
|
||||
# parameters:
|
||||
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
# - template: azure-pipelines/windows-artifacts.yml
|
||||
# parameters:
|
||||
# os: windows
|
||||
# arch: amd64
|
||||
# toolchain: msvc2017
|
||||
# libtype: shared
|
||||
# libfiles: libui.dll libui.exp libui.lib
|
||||
# osHeader: ui_windows.h
|
||||
#
|
||||
#- job: windows_amd64_msvc2017_static
|
||||
# displayName: 'Windows amd64 MSVC2017 Static'
|
||||
# pool:
|
||||
# vmImage: 'vs2017-win2016'
|
||||
# workspace:
|
||||
# clean: all
|
||||
# steps:
|
||||
# - template: azure-pipelines/setup-python3.yml
|
||||
# - template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
# - template: azure-pipelines/windows-install-ninja.yml
|
||||
# - template: azure-pipelines/configure.yml
|
||||
# parameters:
|
||||
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
# defaultLibrary: static
|
||||
# - template: azure-pipelines/build.yml
|
||||
# parameters:
|
||||
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
# afterBuild: ren build\meson-out\libui.a libui.lib
|
||||
# - template: azure-pipelines/windows-artifacts.yml
|
||||
# parameters:
|
||||
# os: windows
|
||||
# arch: amd64
|
||||
# toolchain: msvc2017
|
||||
# libtype: static
|
||||
# libfiles: libui.lib
|
||||
# osHeader: ui_windows.h
|
||||
#
|
||||
## }
|
||||
#
|
||||
## mac {
|
||||
#
|
||||
## TODO beforeConfigure/beforeBuild: export SDKROOT=$(xcodebuild -version -sdk macosx10.13 Path)?
|
||||
#
|
||||
#- job: darwin_amd64_shared
|
||||
# displayName: 'Darwin amd64 Shared'
|
||||
# pool:
|
||||
# vmImage: 'macos-10.13'
|
||||
# workspace:
|
||||
# clean: all
|
||||
# steps:
|
||||
# - template: azure-pipelines/setup-python3.yml
|
||||
# - template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
# - template: azure-pipelines/darwin-install-ninja.yml
|
||||
# - template: azure-pipelines/configure.yml
|
||||
# parameters:
|
||||
# defaultLibrary: shared
|
||||
# - template: azure-pipelines/build.yml
|
||||
# - template: azure-pipelines/artifacts.yml
|
||||
# parameters:
|
||||
# os: darwin
|
||||
# arch: amd64
|
||||
# libtype: shared
|
||||
# libfiles: libui.A.dylib
|
||||
# osHeader: ui_darwin.h
|
||||
#
|
||||
#- job: darwin_amd64_static
|
||||
# displayName: 'Darwin amd64 Static'
|
||||
# pool:
|
||||
# vmImage: 'macos-10.13'
|
||||
# workspace:
|
||||
# clean: all
|
||||
# steps:
|
||||
# - template: azure-pipelines/setup-python3.yml
|
||||
# - template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
# - template: azure-pipelines/darwin-install-ninja.yml
|
||||
# - template: azure-pipelines/configure.yml
|
||||
# parameters:
|
||||
# defaultLibrary: static
|
||||
# - template: azure-pipelines/build.yml
|
||||
# - template: azure-pipelines/artifacts.yml
|
||||
# parameters:
|
||||
# os: darwin
|
||||
# arch: amd64
|
||||
# libtype: static
|
||||
# libfiles: libui.a
|
||||
# osHeader: ui_darwin.h
|
||||
#
|
||||
## }
|
||||
28
dep/libui/azure-pipelines/artifacts.yml
Normal file
28
dep/libui/azure-pipelines/artifacts.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
# 6 april 2019
|
||||
|
||||
parameters:
|
||||
os: ''
|
||||
arch: ''
|
||||
libtype: ''
|
||||
libfiles: ''
|
||||
osHeader: ''
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
set -x
|
||||
pushd build/meson-out
|
||||
cp ../../ui.h ../../${{ parameters.osHeader }} .
|
||||
tar czf $(Build.ArtifactStagingDirectory)/libui-$(Build.SourceBranchName)-${{ parameters.os }}-${{ parameters.arch }}-${{ parameters.libtype }}.tgz ${{ parameters.libfiles }} ui.h ${{ parameters.osHeader}}
|
||||
tar czf $(Build.ArtifactStagingDirectory)/examples-$(Build.SourceBranchName)-${{ parameters.os }}-${{ parameters.arch }}-${{ parameters.libtype }}.tgz $(releaseExamples)
|
||||
rm ui.h ${{ parameters.osHeader }}
|
||||
popd
|
||||
displayName: 'Create Artifacts'
|
||||
- task: GitHubRelease@0
|
||||
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
|
||||
inputs:
|
||||
gitHubConnection: andlabs
|
||||
repositoryName: andlabs/libui
|
||||
action: 'edit'
|
||||
addChangelog: false
|
||||
assets: '$(Build.ArtifactStagingDirectory)/*'
|
||||
assetUploadMode: 'replace'
|
||||
12
dep/libui/azure-pipelines/build.yml
Normal file
12
dep/libui/azure-pipelines/build.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
# 5 april 2019
|
||||
|
||||
parameters:
|
||||
beforeBuild: ''
|
||||
afterBuild: ''
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
${{ parameters.beforeBuild }}
|
||||
ninja -C build -v
|
||||
${{ parameters.afterBuild }}
|
||||
displayName: 'Build'
|
||||
43
dep/libui/azure-pipelines/collapse.awk
Normal file
43
dep/libui/azure-pipelines/collapse.awk
Normal file
@@ -0,0 +1,43 @@
|
||||
# 7 april 2019
|
||||
|
||||
BEGIN {
|
||||
RS = ""
|
||||
FS = "\n +- "
|
||||
}
|
||||
|
||||
/^- job:/ {
|
||||
for (i = 1; i <= NF; i++) {
|
||||
if (!(i in nextindex)) {
|
||||
# fast path for first occurrence
|
||||
lines[i, 0] = $i
|
||||
nextindex[i] = 1
|
||||
if (maxIndex < i)
|
||||
maxIndex = i
|
||||
continue
|
||||
}
|
||||
found = 0
|
||||
for (j = 0; j < nextindex[i]; j++)
|
||||
if (lines[i, j] == $i) {
|
||||
found = 1
|
||||
break
|
||||
}
|
||||
if (!found) {
|
||||
lines[i, nextindex[i]] = $i
|
||||
nextindex[i]++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
END {
|
||||
for (i = 1; i <= maxIndex; i++) {
|
||||
if (nextindex[i] == 1) {
|
||||
# only one entry here, just print it
|
||||
print "- " lines[i, 0]
|
||||
continue
|
||||
}
|
||||
print "{"
|
||||
for (j = 0; j < nextindex[i]; j++)
|
||||
print "- " lines[i, j]
|
||||
print "}"
|
||||
}
|
||||
}
|
||||
298
dep/libui/azure-pipelines/collapsed
Normal file
298
dep/libui/azure-pipelines/collapsed
Normal file
@@ -0,0 +1,298 @@
|
||||
{
|
||||
- - job: linux_386_shared
|
||||
displayName: 'Linux 386 Shared'
|
||||
pool:
|
||||
vmImage: 'ubuntu-16.04'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- - job: linux_386_static
|
||||
displayName: 'Linux 386 Static'
|
||||
pool:
|
||||
vmImage: 'ubuntu-16.04'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- - job: linux_amd64_shared
|
||||
displayName: 'Linux amd64 Shared'
|
||||
pool:
|
||||
vmImage: 'ubuntu-16.04'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- - job: linux_amd64_static
|
||||
displayName: 'Linux amd64 Static'
|
||||
pool:
|
||||
vmImage: 'ubuntu-16.04'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- - job: windows_386_msvc2015_shared
|
||||
displayName: 'Windows 386 MSVC2015 Shared'
|
||||
pool:
|
||||
vmImage: 'vs2015-win2012r2'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- - job: windows_386_msvc2015_static
|
||||
displayName: 'Windows 386 MSVC2015 Static'
|
||||
pool:
|
||||
vmImage: 'vs2015-win2012r2'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- - job: windows_amd64_msvc2015_shared
|
||||
displayName: 'Windows amd64 MSVC2015 Shared'
|
||||
pool:
|
||||
vmImage: 'vs2015-win2012r2'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- - job: windows_amd64_msvc2015_static
|
||||
displayName: 'Windows amd64 MSVC2015 Static'
|
||||
pool:
|
||||
vmImage: 'vs2015-win2012r2'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- - job: windows_386_msvc2017_shared
|
||||
displayName: 'Windows 386 MSVC2017 Shared'
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- - job: windows_386_msvc2017_static
|
||||
displayName: 'Windows 386 MSVC2017 Static'
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- - job: windows_amd64_msvc2017_shared
|
||||
displayName: 'Windows amd64 MSVC2017 Shared'
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- - job: windows_amd64_msvc2017_static
|
||||
displayName: 'Windows amd64 MSVC2017 Static'
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- - job: darwin_amd64_shared
|
||||
displayName: 'Darwin amd64 Shared'
|
||||
pool:
|
||||
vmImage: 'macos-10.13'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- - job: darwin_amd64_static
|
||||
displayName: 'Darwin amd64 Static'
|
||||
pool:
|
||||
vmImage: 'macos-10.13'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
}
|
||||
{
|
||||
- template: azure-pipelines/setup-python3.yml
|
||||
- template: azure-pipelines/vs2015-install-python3.yml
|
||||
}
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
{
|
||||
- template: azure-pipelines/linux-386-install-gtk-dev.yml
|
||||
- template: azure-pipelines/linux-install-gtk-dev.yml
|
||||
- template: azure-pipelines/windows-install-ninja.yml
|
||||
- template: azure-pipelines/darwin-install-ninja.yml
|
||||
}
|
||||
{
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: export CFLAGS=-m32 CXXFLAGS=-m32 PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig
|
||||
defaultLibrary: shared
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: export CFLAGS=-m32 CXXFLAGS=-m32 PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig
|
||||
defaultLibrary: static
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
defaultLibrary: shared
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
defaultLibrary: static
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
|
||||
defaultLibrary: shared
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
|
||||
defaultLibrary: static
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
defaultLibrary: shared
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
defaultLibrary: static
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
defaultLibrary: shared
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
defaultLibrary: static
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
defaultLibrary: shared
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
defaultLibrary: static
|
||||
}
|
||||
{
|
||||
- template: azure-pipelines/build.yml
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
|
||||
afterBuild: ren build\meson-out\libui.a libui.lib
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
afterBuild: ren build\meson-out\libui.a libui.lib
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
afterBuild: ren build\meson-out\libui.a libui.lib
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
afterBuild: ren build\meson-out\libui.a libui.lib
|
||||
}
|
||||
{
|
||||
- template: azure-pipelines/artifacts.yml
|
||||
parameters:
|
||||
os: linux
|
||||
arch: 386
|
||||
libtype: shared
|
||||
libfiles: libui.so.0
|
||||
osHeader: ui_unix.h
|
||||
- template: azure-pipelines/artifacts.yml
|
||||
parameters:
|
||||
os: linux
|
||||
arch: 386
|
||||
libtype: static
|
||||
libfiles: libui.a
|
||||
osHeader: ui_unix.h
|
||||
- template: azure-pipelines/artifacts.yml
|
||||
parameters:
|
||||
os: linux
|
||||
arch: amd64
|
||||
libtype: shared
|
||||
libfiles: libui.so.0
|
||||
osHeader: ui_unix.h
|
||||
- template: azure-pipelines/artifacts.yml
|
||||
parameters:
|
||||
os: linux
|
||||
arch: amd64
|
||||
libtype: static
|
||||
libfiles: libui.a
|
||||
osHeader: ui_unix.h
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: 386
|
||||
toolchain: msvc2015
|
||||
libtype: shared
|
||||
libfiles: libui.dll libui.exp libui.lib
|
||||
osHeader: ui_windows.h
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: 386
|
||||
toolchain: msvc2015
|
||||
libtype: static
|
||||
libfiles: libui.lib
|
||||
osHeader: ui_windows.h
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: amd64
|
||||
toolchain: msvc2015
|
||||
libtype: shared
|
||||
libfiles: libui.dll libui.exp libui.lib
|
||||
osHeader: ui_windows.h
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: amd64
|
||||
toolchain: msvc2015
|
||||
libtype: static
|
||||
libfiles: libui.lib
|
||||
osHeader: ui_windows.h
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: 386
|
||||
toolchain: msvc2017
|
||||
libtype: shared
|
||||
libfiles: libui.dll libui.exp libui.lib
|
||||
osHeader: ui_windows.h
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: 386
|
||||
toolchain: msvc2017
|
||||
libtype: static
|
||||
libfiles: libui.lib
|
||||
osHeader: ui_windows.h
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: amd64
|
||||
toolchain: msvc2017
|
||||
libtype: shared
|
||||
libfiles: libui.dll libui.exp libui.lib
|
||||
osHeader: ui_windows.h
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: amd64
|
||||
toolchain: msvc2017
|
||||
libtype: static
|
||||
libfiles: libui.lib
|
||||
osHeader: ui_windows.h
|
||||
- template: azure-pipelines/artifacts.yml
|
||||
parameters:
|
||||
os: darwin
|
||||
arch: amd64
|
||||
libtype: shared
|
||||
libfiles: libui.A.dylib
|
||||
osHeader: ui_darwin.h
|
||||
- template: azure-pipelines/artifacts.yml
|
||||
parameters:
|
||||
os: darwin
|
||||
arch: amd64
|
||||
libtype: static
|
||||
libfiles: libui.a
|
||||
osHeader: ui_darwin.h
|
||||
}
|
||||
11
dep/libui/azure-pipelines/configure.yml
Normal file
11
dep/libui/azure-pipelines/configure.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
# 5 april 2019
|
||||
|
||||
parameters:
|
||||
beforeConfigure: ''
|
||||
defaultLibrary: 'must-be-set'
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
${{ parameters.beforeConfigure }}
|
||||
meson setup build --buildtype=release --default-library=${{ parameters.defaultLibrary }}
|
||||
displayName: 'Configure'
|
||||
13
dep/libui/azure-pipelines/darwin-install-ninja.yml
Normal file
13
dep/libui/azure-pipelines/darwin-install-ninja.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
# 5 april 2019
|
||||
# because brew install is also slow (it runs an update task first)
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
sudo mkdir -p /opt/ninja
|
||||
pushd /opt/ninja
|
||||
sudo wget https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-mac.zip
|
||||
sudo unzip ninja-mac.zip
|
||||
sudo chmod a+rx ninja
|
||||
popd
|
||||
echo '##vso[task.prependpath]/opt/ninja'
|
||||
displayName: 'Install Ninja'
|
||||
9
dep/libui/azure-pipelines/install-latest-meson-ninja.yml
Normal file
9
dep/libui/azure-pipelines/install-latest-meson-ninja.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
# 4 april 2019
|
||||
|
||||
# TODO remove ninja installation from non-Linux OSs and make the same ninja via pip change in the AppVeyor script
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
python -m pip install --upgrade pip setuptools wheel
|
||||
pip install meson ninja
|
||||
displayName: 'Install Latest Meson and Ninja'
|
||||
17
dep/libui/azure-pipelines/linux-386-install-gtk-dev.yml
Normal file
17
dep/libui/azure-pipelines/linux-386-install-gtk-dev.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
# 7 april 2019
|
||||
|
||||
# TODO figure out how to get meson to recognize the compiler is producing 32-bit output
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
# Azure Pipelines ships with a patched version of this and that patch is only available on 64-bit systems, so trying to install the 32-bit versions will remove the 64-bit versions outright
|
||||
# This is a dependency of Mesa, so we'll have to downgrade to the stock distro ones :/
|
||||
llvmPackages=
|
||||
for i in libllvm6.0 clang-6.0 libclang-common-6.0-dev liblldb-6.0 liblldb-6.0-dev lld-6.0 lldb-6.0 llvm-6.0-dev python-lldb-6.0 libclang1-6.0 llvm-6.0 llvm-6.0-runtime; do llvmPackages="$llvmPackages $i=1:6.0-1ubuntu2~16.04.1"; done
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt-get update
|
||||
sudo apt-get install --allow-downgrades \
|
||||
gcc-multilib g++-multilib \
|
||||
$llvmPackages \
|
||||
libgtk-3-dev:i386
|
||||
displayName: 'Install GTK+ Dev Files'
|
||||
6
dep/libui/azure-pipelines/linux-install-gtk-dev.yml
Normal file
6
dep/libui/azure-pipelines/linux-install-gtk-dev.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
# 7 april 2019
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
sudo apt-get install libgtk-3-dev
|
||||
displayName: 'Install GTK+ Dev Files'
|
||||
7
dep/libui/azure-pipelines/setup-python3.yml
Normal file
7
dep/libui/azure-pipelines/setup-python3.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
# 4 april 2019
|
||||
|
||||
steps:
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: '3.6'
|
||||
architecture: 'x64'
|
||||
10
dep/libui/azure-pipelines/vs2015-install-python3.yml
Normal file
10
dep/libui/azure-pipelines/vs2015-install-python3.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
# 4 april 2019
|
||||
# see https://github.com/Microsoft/azure-pipelines-image-generation/issues/374 for context and source
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
powershell -Command "Invoke-WebRequest https://www.python.org/ftp/python/3.7.1/python-3.7.1-amd64-webinstall.exe -OutFile C:\py3-setup.exe"
|
||||
C:\py3-setup.exe /quiet PrependPath=0 InstallAllUsers=0 Include_launcher=0 InstallLauncherAllUsers=0 Include_test=0 Include_doc=0 Include_dev=0 Include_debug=0 Include_tcltk=0 TargetDir=C:\Python37
|
||||
@echo ##vso[task.prependpath]C:\Python37
|
||||
@echo ##vso[task.prependpath]C:\Python37\Scripts
|
||||
displayName: 'Install Python 3'
|
||||
28
dep/libui/azure-pipelines/windows-artifacts.yml
Normal file
28
dep/libui/azure-pipelines/windows-artifacts.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
# 6 april 2019
|
||||
|
||||
parameters:
|
||||
os: ''
|
||||
arch: ''
|
||||
toolchain: ''
|
||||
libtype: ''
|
||||
libfiles: ''
|
||||
osHeader: ''
|
||||
|
||||
steps:
|
||||
- powershell: |
|
||||
pushd build\meson-out
|
||||
Copy-Item @("..\..\ui.h","..\..\${{ parameters.osHeader }}") -Destination .
|
||||
Compress-Archive -Destination $(Build.ArtifactStagingDirectory)\libui-$(Build.SourceBranchName)-${{ parameters.os }}-${{ parameters.arch }}-${{ parameters.toolchain }}-${{ parameters.libtype }}.zip -Path @("${{ parameters.libfiles }}".Split(" ") + @("ui.h","${{ parameters.osHeader}}"))
|
||||
Compress-Archive -Destination $(Build.ArtifactStagingDirectory)\examples-$(Build.SourceBranchName)-${{ parameters.os }}-${{ parameters.arch }}-${{ parameters.libtype }}.zip -Path @("$(releaseExamples)".Split(" ") | % {$_ + ".exe"})
|
||||
Remove-Item @("ui.h","${{ parameters.osHeader }}")
|
||||
popd
|
||||
displayName: 'Create Artifacts'
|
||||
- task: GitHubRelease@0
|
||||
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
|
||||
inputs:
|
||||
gitHubConnection: andlabs
|
||||
repositoryName: andlabs/libui
|
||||
action: 'edit'
|
||||
addChangelog: false
|
||||
assets: '$(Build.ArtifactStagingDirectory)/*'
|
||||
assetUploadMode: 'replace'
|
||||
10
dep/libui/azure-pipelines/windows-install-ninja.yml
Normal file
10
dep/libui/azure-pipelines/windows-install-ninja.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
# 4 april 2019
|
||||
# why this? because choco isn't available on the VS2015 image and is extremely slow on the VS2017 one (it should not take 2.5 minutes to install just ninja!)
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
powershell -Command "Invoke-WebRequest https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-win.zip -OutFile C:\ninja-win.zip"
|
||||
mkdir C:\ninja
|
||||
powershell -Command "Expand-Archive -LiteralPath C:\ninja-win.zip -DestinationPath C:\ninja"
|
||||
@echo ##vso[task.prependpath]C:\ninja
|
||||
displayName: 'Install Ninja'
|
||||
169
dep/libui/common/areaevents.c
Normal file
169
dep/libui/common/areaevents.c
Normal file
@@ -0,0 +1,169 @@
|
||||
// 29 march 2014
|
||||
#include "../ui.h"
|
||||
#include "uipriv.h"
|
||||
|
||||
/*
|
||||
Windows and GTK+ have a limit of 2 and 3 clicks, respectively, natively supported. Fortunately, we can simulate the double/triple-click behavior to build higher-order clicks. We can use the same algorithm Windows uses on both:
|
||||
http://blogs.msdn.com/b/oldnewthing/archive/2004/10/18/243925.aspx
|
||||
For GTK+, we pull the double-click time and double-click distance, which work the same as the equivalents on Windows (so the distance is in all directions), from the GtkSettings system.
|
||||
|
||||
On GTK+ this will also allow us to discard the GDK_BUTTON_2PRESS and GDK_BUTTON_3PRESS events, so the button press stream will be just like on other platforms.
|
||||
|
||||
Thanks to mclasen, garnacho_, halfline, and tristan in irc.gimp.net/#gtk+.
|
||||
|
||||
TODO note the bits about asymmetry and g_rcClick initial value not mattering in the oldnewthing article
|
||||
*/
|
||||
|
||||
// x, y, xdist, ydist, and c.rect must have the same units
|
||||
// so must time, maxTime, and c.prevTime
|
||||
int uiprivClickCounterClick(uiprivClickCounter *c, int button, int x, int y, uintptr_t time, uintptr_t maxTime, int32_t xdist, int32_t ydist)
|
||||
{
|
||||
// different button than before? if so, don't count
|
||||
if (button != c->curButton)
|
||||
c->count = 0;
|
||||
|
||||
// (x, y) in the allowed region for a double-click? if not, don't count
|
||||
if (x < c->rectX0)
|
||||
c->count = 0;
|
||||
if (y < c->rectY0)
|
||||
c->count = 0;
|
||||
if (x >= c->rectX1)
|
||||
c->count = 0;
|
||||
if (y >= c->rectY1)
|
||||
c->count = 0;
|
||||
|
||||
// too slow? if so, don't count
|
||||
// note the below expression; time > (c.prevTime + maxTime) can overflow!
|
||||
if ((time - c->prevTime) > maxTime) // too slow; don't count
|
||||
c->count = 0;
|
||||
|
||||
c->count++; // if either of the above ifs happened, this will make the click count 1; otherwise it will make the click count 2, 3, 4, 5, ...
|
||||
|
||||
// now we need to update the internal structures for the next test
|
||||
c->curButton = button;
|
||||
c->prevTime = time;
|
||||
c->rectX0 = x - xdist;
|
||||
c->rectY0 = y - ydist;
|
||||
c->rectX1 = x + xdist;
|
||||
c->rectY1 = y + ydist;
|
||||
|
||||
return c->count;
|
||||
}
|
||||
|
||||
void uiprivClickCounterReset(uiprivClickCounter *c)
|
||||
{
|
||||
c->curButton = 0;
|
||||
c->rectX0 = 0;
|
||||
c->rectY0 = 0;
|
||||
c->rectX1 = 0;
|
||||
c->rectY1 = 0;
|
||||
c->prevTime = 0;
|
||||
c->count = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
For position independence across international keyboard layouts, typewriter keys are read using scancodes (which are always set 1).
|
||||
Windows provides the scancodes directly in the LPARAM.
|
||||
GTK+ provides the scancodes directly from the underlying window system via GdkEventKey.hardware_keycode.
|
||||
On X11, this is scancode + 8 (because X11 keyboard codes have a range of [8,255]).
|
||||
Wayland is guaranteed to give the same result (thanks ebassi in irc.gimp.net/#gtk+).
|
||||
On Linux, where evdev is used instead of polling scancodes directly from the keyboard, evdev's typewriter section key code constants are the same as scancodes anyway, so the rules above apply.
|
||||
Typewriter section scancodes are the same across international keyboards with some exceptions that have been accounted for (see KeyEvent's documentation); see http://www.quadibloc.com/comp/scan.htm for details.
|
||||
Non-typewriter keys can be handled safely using constants provided by the respective backend API.
|
||||
|
||||
Because GTK+ keysyms may or may not obey Num Lock, we also handle the 0-9 and . keys on the numeric keypad with scancodes (they match too).
|
||||
*/
|
||||
|
||||
// use uintptr_t to be safe; the size of the scancode/hardware key code field on each platform is different
|
||||
static const struct {
|
||||
uintptr_t scancode;
|
||||
char equiv;
|
||||
} scancodeKeys[] = {
|
||||
{ 0x02, '1' },
|
||||
{ 0x03, '2' },
|
||||
{ 0x04, '3' },
|
||||
{ 0x05, '4' },
|
||||
{ 0x06, '5' },
|
||||
{ 0x07, '6' },
|
||||
{ 0x08, '7' },
|
||||
{ 0x09, '8' },
|
||||
{ 0x0A, '9' },
|
||||
{ 0x0B, '0' },
|
||||
{ 0x0C, '-' },
|
||||
{ 0x0D, '=' },
|
||||
{ 0x0E, '\b' },
|
||||
{ 0x0F, '\t' },
|
||||
{ 0x10, 'q' },
|
||||
{ 0x11, 'w' },
|
||||
{ 0x12, 'e' },
|
||||
{ 0x13, 'r' },
|
||||
{ 0x14, 't' },
|
||||
{ 0x15, 'y' },
|
||||
{ 0x16, 'u' },
|
||||
{ 0x17, 'i' },
|
||||
{ 0x18, 'o' },
|
||||
{ 0x19, 'p' },
|
||||
{ 0x1A, '[' },
|
||||
{ 0x1B, ']' },
|
||||
{ 0x1C, '\n' },
|
||||
{ 0x1E, 'a' },
|
||||
{ 0x1F, 's' },
|
||||
{ 0x20, 'd' },
|
||||
{ 0x21, 'f' },
|
||||
{ 0x22, 'g' },
|
||||
{ 0x23, 'h' },
|
||||
{ 0x24, 'j' },
|
||||
{ 0x25, 'k' },
|
||||
{ 0x26, 'l' },
|
||||
{ 0x27, ';' },
|
||||
{ 0x28, '\'' },
|
||||
{ 0x29, '`' },
|
||||
{ 0x2B, '\\' },
|
||||
{ 0x2C, 'z' },
|
||||
{ 0x2D, 'x' },
|
||||
{ 0x2E, 'c' },
|
||||
{ 0x2F, 'v' },
|
||||
{ 0x30, 'b' },
|
||||
{ 0x31, 'n' },
|
||||
{ 0x32, 'm' },
|
||||
{ 0x33, ',' },
|
||||
{ 0x34, '.' },
|
||||
{ 0x35, '/' },
|
||||
{ 0x39, ' ' },
|
||||
{ 0xFFFF, 0 },
|
||||
};
|
||||
|
||||
static const struct {
|
||||
uintptr_t scancode;
|
||||
uiExtKey equiv;
|
||||
} scancodeExtKeys[] = {
|
||||
{ 0x47, uiExtKeyN7 },
|
||||
{ 0x48, uiExtKeyN8 },
|
||||
{ 0x49, uiExtKeyN9 },
|
||||
{ 0x4B, uiExtKeyN4 },
|
||||
{ 0x4C, uiExtKeyN5 },
|
||||
{ 0x4D, uiExtKeyN6 },
|
||||
{ 0x4F, uiExtKeyN1 },
|
||||
{ 0x50, uiExtKeyN2 },
|
||||
{ 0x51, uiExtKeyN3 },
|
||||
{ 0x52, uiExtKeyN0 },
|
||||
{ 0x53, uiExtKeyNDot },
|
||||
{ 0xFFFF, 0 },
|
||||
};
|
||||
|
||||
int uiprivFromScancode(uintptr_t scancode, uiAreaKeyEvent *ke)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; scancodeKeys[i].scancode != 0xFFFF; i++)
|
||||
if (scancodeKeys[i].scancode == scancode) {
|
||||
ke->Key = scancodeKeys[i].equiv;
|
||||
return 1;
|
||||
}
|
||||
for (i = 0; scancodeExtKeys[i].scancode != 0xFFFF; i++)
|
||||
if (scancodeExtKeys[i].scancode == scancode) {
|
||||
ke->ExtKey = scancodeExtKeys[i].equiv;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
266
dep/libui/common/attribute.c
Normal file
266
dep/libui/common/attribute.c
Normal file
@@ -0,0 +1,266 @@
|
||||
// 19 february 2018
|
||||
#include "../ui.h"
|
||||
#include "uipriv.h"
|
||||
#include "attrstr.h"
|
||||
|
||||
struct uiAttribute {
|
||||
int ownedByUser;
|
||||
size_t refcount;
|
||||
uiAttributeType type;
|
||||
union {
|
||||
char *family;
|
||||
double size;
|
||||
uiTextWeight weight;
|
||||
uiTextItalic italic;
|
||||
uiTextStretch stretch;
|
||||
struct {
|
||||
double r;
|
||||
double g;
|
||||
double b;
|
||||
double a;
|
||||
// put this here so we can reuse this structure
|
||||
uiUnderlineColor underlineColor;
|
||||
} color;
|
||||
uiUnderline underline;
|
||||
uiOpenTypeFeatures *features;
|
||||
} u;
|
||||
};
|
||||
|
||||
static uiAttribute *newAttribute(uiAttributeType type)
|
||||
{
|
||||
uiAttribute *a;
|
||||
|
||||
a = uiprivNew(uiAttribute);
|
||||
a->ownedByUser = 1;
|
||||
a->refcount = 0;
|
||||
a->type = type;
|
||||
return a;
|
||||
}
|
||||
|
||||
// returns a to allow expressions like b = uiprivAttributeRetain(a)
|
||||
// TODO would this allow us to copy attributes between strings in a foreach func, and if so, should that be allowed?
|
||||
uiAttribute *uiprivAttributeRetain(uiAttribute *a)
|
||||
{
|
||||
a->ownedByUser = 0;
|
||||
a->refcount++;
|
||||
return a;
|
||||
}
|
||||
|
||||
static void destroy(uiAttribute *a)
|
||||
{
|
||||
switch (a->type) {
|
||||
case uiAttributeTypeFamily:
|
||||
uiprivFree(a->u.family);
|
||||
break;
|
||||
case uiAttributeTypeFeatures:
|
||||
uiFreeOpenTypeFeatures(a->u.features);
|
||||
break;
|
||||
}
|
||||
uiprivFree(a);
|
||||
}
|
||||
|
||||
void uiprivAttributeRelease(uiAttribute *a)
|
||||
{
|
||||
if (a->ownedByUser)
|
||||
/* TODO implementation bug: we can't release an attribute we don't own */;
|
||||
a->refcount--;
|
||||
if (a->refcount == 0)
|
||||
destroy(a);
|
||||
}
|
||||
|
||||
void uiFreeAttribute(uiAttribute *a)
|
||||
{
|
||||
if (!a->ownedByUser)
|
||||
/* TODO user bug: you can't free an attribute you don't own */;
|
||||
destroy(a);
|
||||
}
|
||||
|
||||
uiAttributeType uiAttributeGetType(const uiAttribute *a)
|
||||
{
|
||||
return a->type;
|
||||
}
|
||||
|
||||
uiAttribute *uiNewFamilyAttribute(const char *family)
|
||||
{
|
||||
uiAttribute *a;
|
||||
|
||||
a = newAttribute(uiAttributeTypeFamily);
|
||||
a->u.family = (char *) uiprivAlloc((strlen(family) + 1) * sizeof (char), "char[] (uiAttribute)");
|
||||
strcpy(a->u.family, family);
|
||||
return a;
|
||||
}
|
||||
|
||||
const char *uiAttributeFamily(const uiAttribute *a)
|
||||
{
|
||||
return a->u.family;
|
||||
}
|
||||
|
||||
uiAttribute *uiNewSizeAttribute(double size)
|
||||
{
|
||||
uiAttribute *a;
|
||||
|
||||
a = newAttribute(uiAttributeTypeSize);
|
||||
a->u.size = size;
|
||||
return a;
|
||||
}
|
||||
|
||||
double uiAttributeSize(const uiAttribute *a)
|
||||
{
|
||||
return a->u.size;
|
||||
}
|
||||
|
||||
uiAttribute *uiNewWeightAttribute(uiTextWeight weight)
|
||||
{
|
||||
uiAttribute *a;
|
||||
|
||||
a = newAttribute(uiAttributeTypeWeight);
|
||||
a->u.weight = weight;
|
||||
return a;
|
||||
}
|
||||
|
||||
uiTextWeight uiAttributeWeight(const uiAttribute *a)
|
||||
{
|
||||
return a->u.weight;
|
||||
}
|
||||
|
||||
uiAttribute *uiNewItalicAttribute(uiTextItalic italic)
|
||||
{
|
||||
uiAttribute *a;
|
||||
|
||||
a = newAttribute(uiAttributeTypeItalic);
|
||||
a->u.italic = italic;
|
||||
return a;
|
||||
}
|
||||
|
||||
uiTextItalic uiAttributeItalic(const uiAttribute *a)
|
||||
{
|
||||
return a->u.italic;
|
||||
}
|
||||
|
||||
uiAttribute *uiNewStretchAttribute(uiTextStretch stretch)
|
||||
{
|
||||
uiAttribute *a;
|
||||
|
||||
a = newAttribute(uiAttributeTypeStretch);
|
||||
a->u.stretch = stretch;
|
||||
return a;
|
||||
}
|
||||
|
||||
uiTextStretch uiAttributeStretch(const uiAttribute *a)
|
||||
{
|
||||
return a->u.stretch;
|
||||
}
|
||||
|
||||
uiAttribute *uiNewColorAttribute(double r, double g, double b, double a)
|
||||
{
|
||||
uiAttribute *at;
|
||||
|
||||
at = newAttribute(uiAttributeTypeColor);
|
||||
at->u.color.r = r;
|
||||
at->u.color.g = g;
|
||||
at->u.color.b = b;
|
||||
at->u.color.a = a;
|
||||
return at;
|
||||
}
|
||||
|
||||
void uiAttributeColor(const uiAttribute *a, double *r, double *g, double *b, double *alpha)
|
||||
{
|
||||
*r = a->u.color.r;
|
||||
*g = a->u.color.g;
|
||||
*b = a->u.color.b;
|
||||
*alpha = a->u.color.a;
|
||||
}
|
||||
|
||||
uiAttribute *uiNewBackgroundAttribute(double r, double g, double b, double a)
|
||||
{
|
||||
uiAttribute *at;
|
||||
|
||||
at = newAttribute(uiAttributeTypeBackground);
|
||||
at->u.color.r = r;
|
||||
at->u.color.g = g;
|
||||
at->u.color.b = b;
|
||||
at->u.color.a = a;
|
||||
return at;
|
||||
}
|
||||
|
||||
uiAttribute *uiNewUnderlineAttribute(uiUnderline u)
|
||||
{
|
||||
uiAttribute *a;
|
||||
|
||||
a = newAttribute(uiAttributeTypeUnderline);
|
||||
a->u.underline = u;
|
||||
return a;
|
||||
}
|
||||
|
||||
uiUnderline uiAttributeUnderline(const uiAttribute *a)
|
||||
{
|
||||
return a->u.underline;
|
||||
}
|
||||
|
||||
uiAttribute *uiNewUnderlineColorAttribute(uiUnderlineColor u, double r, double g, double b, double a)
|
||||
{
|
||||
uiAttribute *at;
|
||||
|
||||
at = uiNewColorAttribute(r, g, b, a);
|
||||
at->type = uiAttributeTypeUnderlineColor;
|
||||
at->u.color.underlineColor = u;
|
||||
return at;
|
||||
}
|
||||
|
||||
void uiAttributeUnderlineColor(const uiAttribute *a, uiUnderlineColor *u, double *r, double *g, double *b, double *alpha)
|
||||
{
|
||||
*u = a->u.color.underlineColor;
|
||||
uiAttributeColor(a, r, g, b, alpha);
|
||||
}
|
||||
|
||||
uiAttribute *uiNewFeaturesAttribute(const uiOpenTypeFeatures *otf)
|
||||
{
|
||||
uiAttribute *a;
|
||||
|
||||
a = newAttribute(uiAttributeTypeFeatures);
|
||||
a->u.features = uiOpenTypeFeaturesClone(otf);
|
||||
return a;
|
||||
}
|
||||
|
||||
const uiOpenTypeFeatures *uiAttributeFeatures(const uiAttribute *a)
|
||||
{
|
||||
return a->u.features;
|
||||
}
|
||||
|
||||
int uiprivAttributeEqual(const uiAttribute *a, const uiAttribute *b)
|
||||
{
|
||||
if (a == b)
|
||||
return 1;
|
||||
if (a->type != b->type)
|
||||
return 0;
|
||||
switch (a->type) {
|
||||
case uiAttributeTypeFamily:
|
||||
return uiprivStricmp(a->u.family, b->u.family);
|
||||
case uiAttributeTypeSize:
|
||||
// TODO is the use of == correct?
|
||||
return a->u.size == b->u.size;
|
||||
case uiAttributeTypeWeight:
|
||||
return a->u.weight == b->u.weight;
|
||||
case uiAttributeTypeItalic:
|
||||
return a->u.italic == b->u.italic;
|
||||
case uiAttributeTypeStretch:
|
||||
return a->u.stretch == b->u.stretch;
|
||||
case uiAttributeTypeUnderline:
|
||||
return a->u.underline == b->u.underline;
|
||||
case uiAttributeTypeUnderlineColor:
|
||||
if (a->u.color.underlineColor != b->u.color.underlineColor)
|
||||
return 0;
|
||||
// fall through
|
||||
case uiAttributeTypeColor:
|
||||
case uiAttributeTypeBackground:
|
||||
// TODO is the use of == correct?
|
||||
return (a->u.color.r == b->u.color.r) &&
|
||||
(a->u.color.g == b->u.color.g) &&
|
||||
(a->u.color.b == b->u.color.b) &&
|
||||
(a->u.color.a == b->u.color.a);
|
||||
case uiAttributeTypeFeatures:
|
||||
return uiprivOpenTypeFeaturesEqual(a->u.features, b->u.features);
|
||||
}
|
||||
// TODO should not be reached
|
||||
return 0;
|
||||
}
|
||||
612
dep/libui/common/attrlist.c
Normal file
612
dep/libui/common/attrlist.c
Normal file
@@ -0,0 +1,612 @@
|
||||
// 16 december 2016
|
||||
#include "../ui.h"
|
||||
#include "uipriv.h"
|
||||
#include "attrstr.h"
|
||||
|
||||
/*
|
||||
An attribute list is a doubly linked list of attributes.
|
||||
Attribute start positions are inclusive and attribute end positions are exclusive (or in other words, [start, end)).
|
||||
The list is kept sorted in increasing order by start position. Whether or not the sort is stable is undefined, so no temporal information should be expected to stay.
|
||||
Overlapping attributes are not allowed; if an attribute is added that conflicts with an existing one, the existing one is removed.
|
||||
In addition, the linked list tries to reduce fragmentation: if an attribute is added that just expands another, then there will only be one entry in alist, not two. (TODO does it really?)
|
||||
The linked list is not a ring; alist->fist->prev == NULL and alist->last->next == NULL.
|
||||
TODO verify that this disallows attributes of length zero
|
||||
*/
|
||||
|
||||
struct attr {
|
||||
uiAttribute *val;
|
||||
size_t start;
|
||||
size_t end;
|
||||
struct attr *prev;
|
||||
struct attr *next;
|
||||
};
|
||||
|
||||
struct uiprivAttrList {
|
||||
struct attr *first;
|
||||
struct attr *last;
|
||||
};
|
||||
|
||||
// if before is NULL, add to the end of the list
|
||||
static void attrInsertBefore(uiprivAttrList *alist, struct attr *a, struct attr *before)
|
||||
{
|
||||
// if the list is empty, this is the first item
|
||||
if (alist->first == NULL) {
|
||||
alist->first = a;
|
||||
alist->last = a;
|
||||
return;
|
||||
}
|
||||
|
||||
// add to the end
|
||||
if (before == NULL) {
|
||||
struct attr *oldlast;
|
||||
|
||||
oldlast = alist->last;
|
||||
alist->last = a;
|
||||
a->prev = oldlast;
|
||||
oldlast->next = a;
|
||||
return;
|
||||
}
|
||||
|
||||
// add to the beginning
|
||||
if (before == alist->first) {
|
||||
struct attr *oldfirst;
|
||||
|
||||
oldfirst = alist->first;
|
||||
alist->first = a;
|
||||
oldfirst->prev = a;
|
||||
a->next = oldfirst;
|
||||
return;
|
||||
}
|
||||
|
||||
// add to the middle
|
||||
a->prev = before->prev;
|
||||
a->next = before;
|
||||
before->prev = a;
|
||||
a->prev->next = a;
|
||||
}
|
||||
|
||||
static int attrHasPos(struct attr *a, size_t pos)
|
||||
{
|
||||
if (pos < a->start)
|
||||
return 0;
|
||||
return pos < a->end;
|
||||
}
|
||||
|
||||
// returns 1 if there was an intersection and 0 otherwise
|
||||
static int attrRangeIntersect(struct attr *a, size_t *start, size_t *end)
|
||||
{
|
||||
// is the range outside a entirely?
|
||||
if (*start >= a->end)
|
||||
return 0;
|
||||
if (*end < a->start)
|
||||
return 0;
|
||||
|
||||
// okay, so there is an overlap
|
||||
// compute the intersection
|
||||
if (*start < a->start)
|
||||
*start = a->start;
|
||||
if (*end > a->end)
|
||||
*end = a->end;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// returns the old a->next, for forward iteration
|
||||
static struct attr *attrUnlink(uiprivAttrList *alist, struct attr *a)
|
||||
{
|
||||
struct attr *p, *n;
|
||||
|
||||
p = a->prev;
|
||||
n = a->next;
|
||||
a->prev = NULL;
|
||||
a->next = NULL;
|
||||
|
||||
// only item in list?
|
||||
if (p == NULL && n == NULL) {
|
||||
alist->first = NULL;
|
||||
alist->last = NULL;
|
||||
return NULL;
|
||||
}
|
||||
// start of list?
|
||||
if (p == NULL) {
|
||||
n->prev = NULL;
|
||||
alist->first = n;
|
||||
return n;
|
||||
}
|
||||
// end of list?
|
||||
if (n == NULL) {
|
||||
p->next = NULL;
|
||||
alist->last = p;
|
||||
return NULL;
|
||||
}
|
||||
// middle of list
|
||||
p->next = n;
|
||||
n->prev = p;
|
||||
return n;
|
||||
}
|
||||
|
||||
// returns the old a->next, for forward iteration
|
||||
static struct attr *attrDelete(uiprivAttrList *alist, struct attr *a)
|
||||
{
|
||||
struct attr *next;
|
||||
|
||||
next = attrUnlink(alist, a);
|
||||
uiprivAttributeRelease(a->val);
|
||||
uiprivFree(a);
|
||||
return next;
|
||||
}
|
||||
|
||||
// attrDropRange() removes attributes without deleting characters.
|
||||
//
|
||||
// If the attribute needs no change, then nothing is done.
|
||||
//
|
||||
// If the attribute needs to be deleted, it is deleted.
|
||||
//
|
||||
// If the attribute only needs to be resized at the end, it is adjusted.
|
||||
//
|
||||
// If the attribute only needs to be resized at the start, it is adjusted, unlinked, and returned in tail.
|
||||
//
|
||||
// Otherwise, the attribute needs to be split. The existing attribute is adjusted to make the left half and a new attribute with the right half. This attribute is kept unlinked and returned in tail.
|
||||
//
|
||||
// In all cases, the return value is the next attribute to look at in a forward sequential loop.
|
||||
static struct attr *attrDropRange(uiprivAttrList *alist, struct attr *a, size_t start, size_t end, struct attr **tail)
|
||||
{
|
||||
struct attr *b;
|
||||
|
||||
// always pre-initialize tail to NULL
|
||||
*tail = NULL;
|
||||
|
||||
if (!attrRangeIntersect(a, &start, &end))
|
||||
// out of range; nothing to do
|
||||
return a->next;
|
||||
|
||||
// just outright delete the attribute?
|
||||
// the inequalities handle attributes entirely inside the range
|
||||
// if both are equal, the attribute's range is equal to the range
|
||||
if (a->start >= start && a->end <= end)
|
||||
return attrDelete(alist, a);
|
||||
|
||||
// only chop off the start or end?
|
||||
if (a->start == start) { // chop off the start
|
||||
// we are dropping the left half, so set a->start and unlink
|
||||
a->start = end;
|
||||
*tail = a;
|
||||
return attrUnlink(alist, a);
|
||||
}
|
||||
if (a->end == end) { // chop off the end
|
||||
// we are dropping the right half, so just set a->end
|
||||
a->end = start;
|
||||
return a->next;
|
||||
}
|
||||
|
||||
// we'll need to split the attribute into two
|
||||
b = uiprivNew(struct attr);
|
||||
b->val = uiprivAttributeRetain(a->val);
|
||||
b->start = end;
|
||||
b->end = a->end;
|
||||
*tail = b;
|
||||
|
||||
a->end = start;
|
||||
return a->next;
|
||||
}
|
||||
|
||||
static void attrGrow(uiprivAttrList *alist, struct attr *a, size_t start, size_t end)
|
||||
{
|
||||
struct attr *before;
|
||||
|
||||
// adjusting the end is simple: if it ends before our new end, just set the new end
|
||||
if (a->end < end)
|
||||
a->end = end;
|
||||
|
||||
// adjusting the start is harder
|
||||
// if the start is before our new start, we are done
|
||||
// otherwise, we have to move the start back AND reposition the attribute to keep the sorted order
|
||||
if (a->start <= start)
|
||||
return;
|
||||
a->start = start;
|
||||
attrUnlink(alist, a);
|
||||
for (before = alist->first; before != NULL; before = before->next)
|
||||
if (before->start > a->start)
|
||||
break;
|
||||
attrInsertBefore(alist, a, before);
|
||||
}
|
||||
|
||||
// returns the right side of the split, which is unlinked, or NULL if no split was done
|
||||
static struct attr *attrSplitAt(uiprivAttrList *alist, struct attr *a, size_t at)
|
||||
{
|
||||
struct attr *b;
|
||||
|
||||
// no splittng needed?
|
||||
// note the equality: we don't need to split at start or end
|
||||
// in the end case, the last split point is at - 1; at itself is outside the range, and at - 1 results in the right hand side having length 1
|
||||
if (at <= a->start)
|
||||
return NULL;
|
||||
if (at >= a->end)
|
||||
return NULL;
|
||||
|
||||
b = uiprivNew(struct attr);
|
||||
b->val = uiprivAttributeRetain(a->val);
|
||||
b->start = at;
|
||||
b->end = a->end;
|
||||
|
||||
a->end = at;
|
||||
return b;
|
||||
}
|
||||
|
||||
// attrDeleteRange() removes attributes while deleting characters.
|
||||
//
|
||||
// If the attribute does not include the deleted range, then nothing is done (though the start and end are adjusted as necessary).
|
||||
//
|
||||
// If the attribute needs to be deleted, it is deleted.
|
||||
//
|
||||
// Otherwise, the attribute only needs the start or end deleted, and it is adjusted.
|
||||
//
|
||||
// In all cases, the return value is the next attribute to look at in a forward sequential loop.
|
||||
// TODO rewrite this comment
|
||||
static struct attr *attrDeleteRange(uiprivAttrList *alist, struct attr *a, size_t start, size_t end)
|
||||
{
|
||||
size_t ostart, oend;
|
||||
size_t count;
|
||||
|
||||
ostart = start;
|
||||
oend = end;
|
||||
count = oend - ostart;
|
||||
|
||||
if (!attrRangeIntersect(a, &start, &end)) {
|
||||
// out of range
|
||||
// adjust if necessary
|
||||
if (a->start >= ostart)
|
||||
a->start -= count;
|
||||
if (a->end >= oend)
|
||||
a->end -= count;
|
||||
return a->next;
|
||||
}
|
||||
|
||||
// just outright delete the attribute?
|
||||
// the inequalities handle attributes entirely inside the range
|
||||
// if both are equal, the attribute's range is equal to the range
|
||||
if (a->start >= start && a->end <= end)
|
||||
return attrDelete(alist, a);
|
||||
|
||||
// only chop off the start or end?
|
||||
if (a->start == start) { // chop off the start
|
||||
// if we weren't adjusting positions this would just be setting a->start to end
|
||||
// but since this is deleting from the start, we need to adjust both by count
|
||||
a->start = end - count;
|
||||
a->end -= count;
|
||||
return a->next;
|
||||
}
|
||||
if (a->end == end) { // chop off the end
|
||||
// a->start is already good
|
||||
a->end = start;
|
||||
return a->next;
|
||||
}
|
||||
|
||||
// in this case, the deleted range is inside the attribute
|
||||
// we can clear it by just removing count from a->end
|
||||
a->end -= count;
|
||||
return a->next;
|
||||
}
|
||||
|
||||
uiprivAttrList *uiprivNewAttrList(void)
|
||||
{
|
||||
return uiprivNew(uiprivAttrList);
|
||||
}
|
||||
|
||||
void uiprivFreeAttrList(uiprivAttrList *alist)
|
||||
{
|
||||
struct attr *a, *next;
|
||||
|
||||
a = alist->first;
|
||||
while (a != NULL) {
|
||||
next = a->next;
|
||||
uiprivAttributeRelease(a->val);
|
||||
uiprivFree(a);
|
||||
a = next;
|
||||
}
|
||||
uiprivFree(alist);
|
||||
}
|
||||
|
||||
void uiprivAttrListInsertAttribute(uiprivAttrList *alist, uiAttribute *val, size_t start, size_t end)
|
||||
{
|
||||
struct attr *a;
|
||||
struct attr *before;
|
||||
struct attr *tail = NULL;
|
||||
int split = 0;
|
||||
uiAttributeType valtype;
|
||||
|
||||
// first, figure out where in the list this should go
|
||||
// in addition, if this attribute overrides one that already exists, split that one apart so this one can take over
|
||||
before = alist->first;
|
||||
valtype = uiAttributeGetType(val);
|
||||
while (before != NULL) {
|
||||
size_t lstart, lend;
|
||||
|
||||
// once we get to the first point after start, we know where to insert
|
||||
if (before->start > start)
|
||||
break;
|
||||
|
||||
// if we have already split a prior instance of this attribute, don't bother doing it again
|
||||
if (split)
|
||||
goto next;
|
||||
|
||||
// should we split this attribute?
|
||||
if (uiAttributeGetType(before->val) != valtype)
|
||||
goto next;
|
||||
lstart = start;
|
||||
lend = end;
|
||||
if (!attrRangeIntersect(before, &lstart, &lend))
|
||||
goto next;
|
||||
|
||||
// okay so this might conflict; if the val is the same as the one we want, we need to expand the existing attribute, not fragment anything
|
||||
// TODO will this reduce fragmentation if we first add from 0 to 2 and then from 2 to 4? or do we have to do that separately?
|
||||
if (uiprivAttributeEqual(before->val, val)) {
|
||||
attrGrow(alist, before, start, end);
|
||||
return;
|
||||
}
|
||||
// okay the values are different; we need to split apart
|
||||
before = attrDropRange(alist, before, start, end, &tail);
|
||||
split = 1;
|
||||
continue;
|
||||
|
||||
next:
|
||||
before = before->next;
|
||||
}
|
||||
|
||||
// if we got here, we know we have to add the attribute before before
|
||||
a = uiprivNew(struct attr);
|
||||
a->val = uiprivAttributeRetain(val);
|
||||
a->start = start;
|
||||
a->end = end;
|
||||
attrInsertBefore(alist, a, before);
|
||||
|
||||
// and finally, if we split, insert the remainder
|
||||
if (tail == NULL)
|
||||
return;
|
||||
// note we start at before; it won't be inserted before that by the sheer nature of how the code above works
|
||||
for (; before != NULL; before = before->next)
|
||||
if (before->start > tail->start)
|
||||
break;
|
||||
attrInsertBefore(alist, tail, before);
|
||||
}
|
||||
|
||||
void uiprivAttrListInsertCharactersUnattributed(uiprivAttrList *alist, size_t start, size_t count)
|
||||
{
|
||||
struct attr *a;
|
||||
struct attr *tails = NULL;
|
||||
|
||||
// every attribute before the insertion point can either cross into the insertion point or not
|
||||
// if it does, we need to split that attribute apart at the insertion point, keeping only the old attribute in place, adjusting the new tail, and preparing it for being re-added later
|
||||
for (a = alist->first; a != NULL; a = a->next) {
|
||||
struct attr *tail;
|
||||
|
||||
// stop once we get to the insertion point
|
||||
if (a->start >= start)
|
||||
break;
|
||||
// only do something if overlapping
|
||||
if (!attrHasPos(a, start))
|
||||
continue;
|
||||
|
||||
tail = attrSplitAt(alist, a, start);
|
||||
// adjust the new tail for the insertion
|
||||
tail->start += count;
|
||||
tail->end += count;
|
||||
// and queue it for re-adding later
|
||||
// we can safely use tails as if it was singly-linked since it's just a temporary list; we properly merge them back in below and they'll be doubly-linked again then
|
||||
// TODO actually we could probably save some time by making then doubly-linked now and adding them in one fell swoop, but that would make things a bit more complicated...
|
||||
tail->next = tails;
|
||||
tails = tail;
|
||||
}
|
||||
|
||||
// at this point in the attribute list, we are at or after the insertion point
|
||||
// all the split-apart attributes will be at the insertion point
|
||||
// therefore, we can just add them all back now, and the list will still be sorted correctly
|
||||
while (tails != NULL) {
|
||||
struct attr *next;
|
||||
|
||||
// make all the links NULL before insertion, just to be safe
|
||||
next = tails->next;
|
||||
tails->next = NULL;
|
||||
attrInsertBefore(alist, tails, a);
|
||||
tails = next;
|
||||
}
|
||||
|
||||
// every remaining attribute will be either at or after the insertion point
|
||||
// we just need to move them ahead
|
||||
for (; a != NULL; a = a->next) {
|
||||
a->start += count;
|
||||
a->end += count;
|
||||
}
|
||||
}
|
||||
|
||||
// The attributes are those of character start - 1.
|
||||
// If start == 0, the attributes are those of character 0.
|
||||
/*
|
||||
This is an obtuse function. Here's some diagrams to help.
|
||||
|
||||
Given the input string
|
||||
abcdefghi (positions: 012345678 9)
|
||||
and attribute set
|
||||
red start 0 end 3
|
||||
bold start 2 end 6
|
||||
underline start 5 end 8
|
||||
or visually:
|
||||
012345678 9
|
||||
rrr------
|
||||
--bbbb---
|
||||
-----uuu-
|
||||
If we insert qwe to result in positions 0123456789AB C:
|
||||
|
||||
before 0, 1, 2 (grow the red part, move everything else down)
|
||||
red -> start 0 (no change) end 3+3=6
|
||||
bold -> start 2+3=5 end 6+3=9
|
||||
underline -> start 5+3=8 end 8+3=B
|
||||
before 3 (grow red and bold, move underline down)
|
||||
red -> start 0 (no change) end 3+3=6
|
||||
bold -> start 2 (no change) end 6+3=9
|
||||
underline -> start 5+3=8 end 8+3=B
|
||||
before 4, 5 (keep red, grow bold, move underline down)
|
||||
red -> start 0 (no change) end 3 (no change)
|
||||
bold -> start 2 (no change) end 6+3=9
|
||||
underline -> start 5+3=8 end 8+3=B
|
||||
before 6 (keep red, grow bold and underline)
|
||||
red -> start 0 (no change) end 3 (no change)
|
||||
bold -> start 2 (no change) end 6+3=9
|
||||
underline -> start 5 (no change) end 8+3=B
|
||||
before 7, 8 (keep red and bold, grow underline)
|
||||
red -> start 0 (no change) end 3 (no change)
|
||||
bold -> start 2 (no change) end 6 (no change)
|
||||
underline -> start 5 (no change) end 8+3=B
|
||||
before 9 (keep all three)
|
||||
red -> start 0 (no change) end 3 (no change)
|
||||
bold -> start 2 (no change) end 6 (no change)
|
||||
underline -> start 5 (no change) end 8 (no change)
|
||||
|
||||
result:
|
||||
0 1 2 3 4 5 6 7 8 9
|
||||
red E E E e n n n n n n
|
||||
bold s s S E E E e n n n
|
||||
underline s s s s s S E E e n
|
||||
N = none
|
||||
E = end only
|
||||
S = start and end
|
||||
uppercase = in original range, lowercase = not
|
||||
|
||||
which results in our algorithm:
|
||||
for each attribute
|
||||
if start < insertion point
|
||||
move start up
|
||||
else if start == insertion point
|
||||
if start != 0
|
||||
move start up
|
||||
if end <= insertion point
|
||||
move end up
|
||||
*/
|
||||
// TODO does this ensure the list remains sorted?
|
||||
void uiprivAttrListInsertCharactersExtendingAttributes(uiprivAttrList *alist, size_t start, size_t count)
|
||||
{
|
||||
struct attr *a;
|
||||
|
||||
for (a = alist->first; a != NULL; a = a->next) {
|
||||
if (a->start < start)
|
||||
a->start += count;
|
||||
else if (a->start == start && start != 0)
|
||||
a->start += count;
|
||||
if (a->end <= start)
|
||||
a->end += count;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO replace at point with — replaces with first character's attributes
|
||||
|
||||
void uiprivAttrListRemoveAttribute(uiprivAttrList *alist, uiAttributeType type, size_t start, size_t end)
|
||||
{
|
||||
struct attr *a;
|
||||
struct attr *tails = NULL; // see uiprivAttrListInsertCharactersUnattributed() above
|
||||
struct attr *tailsAt = NULL;
|
||||
|
||||
a = alist->first;
|
||||
while (a != NULL) {
|
||||
size_t lstart, lend;
|
||||
struct attr *tail;
|
||||
|
||||
// this defines where to re-attach the tails
|
||||
// (all the tails will have their start at end, so we can just insert them all before tailsAt)
|
||||
if (a->start >= end) {
|
||||
tailsAt = a;
|
||||
// and at this point we're done, so
|
||||
break;
|
||||
}
|
||||
if (uiAttributeGetType(a->val) != type)
|
||||
goto next;
|
||||
lstart = start;
|
||||
lend = end;
|
||||
if (!attrRangeIntersect(a, &lstart, &lend))
|
||||
goto next;
|
||||
a = attrDropRange(alist, a, start, end, &tail);
|
||||
if (tail != NULL) {
|
||||
tail->next = tails;
|
||||
tails = tail;
|
||||
}
|
||||
continue;
|
||||
|
||||
next:
|
||||
a = a->next;
|
||||
}
|
||||
|
||||
while (tails != NULL) {
|
||||
struct attr *next;
|
||||
|
||||
// make all the links NULL before insertion, just to be safe
|
||||
next = tails->next;
|
||||
tails->next = NULL;
|
||||
attrInsertBefore(alist, tails, a);
|
||||
tails = next;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO merge this with the above
|
||||
void uiprivAttrListRemoveAttributes(uiprivAttrList *alist, size_t start, size_t end)
|
||||
{
|
||||
struct attr *a;
|
||||
struct attr *tails = NULL; // see uiprivAttrListInsertCharactersUnattributed() above
|
||||
struct attr *tailsAt = NULL;
|
||||
|
||||
a = alist->first;
|
||||
while (a != NULL) {
|
||||
size_t lstart, lend;
|
||||
struct attr *tail;
|
||||
|
||||
// this defines where to re-attach the tails
|
||||
// (all the tails will have their start at end, so we can just insert them all before tailsAt)
|
||||
if (a->start >= end) {
|
||||
tailsAt = a;
|
||||
// and at this point we're done, so
|
||||
break;
|
||||
}
|
||||
lstart = start;
|
||||
lend = end;
|
||||
if (!attrRangeIntersect(a, &lstart, &lend))
|
||||
goto next;
|
||||
a = attrDropRange(alist, a, start, end, &tail);
|
||||
if (tail != NULL) {
|
||||
tail->next = tails;
|
||||
tails = tail;
|
||||
}
|
||||
continue;
|
||||
|
||||
next:
|
||||
a = a->next;
|
||||
}
|
||||
|
||||
while (tails != NULL) {
|
||||
struct attr *next;
|
||||
|
||||
// make all the links NULL before insertion, just to be safe
|
||||
next = tails->next;
|
||||
tails->next = NULL;
|
||||
attrInsertBefore(alist, tails, a);
|
||||
tails = next;
|
||||
}
|
||||
}
|
||||
|
||||
void uiprivAttrListRemoveCharacters(uiprivAttrList *alist, size_t start, size_t end)
|
||||
{
|
||||
struct attr *a;
|
||||
|
||||
a = alist->first;
|
||||
while (a != NULL)
|
||||
a = attrDeleteRange(alist, a, start, end);
|
||||
}
|
||||
|
||||
void uiprivAttrListForEach(const uiprivAttrList *alist, const uiAttributedString *s, uiAttributedStringForEachAttributeFunc f, void *data)
|
||||
{
|
||||
struct attr *a;
|
||||
uiForEach ret;
|
||||
|
||||
for (a = alist->first; a != NULL; a = a->next) {
|
||||
ret = (*f)(s, a->val, a->start, a->end, data);
|
||||
if (ret == uiForEachStop)
|
||||
// TODO for all: break or return?
|
||||
break;
|
||||
}
|
||||
}
|
||||
357
dep/libui/common/attrstr.c
Normal file
357
dep/libui/common/attrstr.c
Normal file
@@ -0,0 +1,357 @@
|
||||
// 3 december 2016
|
||||
#include "../ui.h"
|
||||
#include "uipriv.h"
|
||||
#include "attrstr.h"
|
||||
|
||||
struct uiAttributedString {
|
||||
char *s;
|
||||
size_t len;
|
||||
|
||||
uiprivAttrList *attrs;
|
||||
|
||||
// indiscriminately keep a UTF-16 copy of the string on all platforms so we can hand this off to the grapheme calculator
|
||||
// this ensures no one platform has a speed advantage (sorry GTK+)
|
||||
uint16_t *u16;
|
||||
size_t u16len;
|
||||
|
||||
size_t *u8tou16;
|
||||
size_t *u16tou8;
|
||||
|
||||
// this is lazily created to keep things from getting *too* slow
|
||||
uiprivGraphemes *graphemes;
|
||||
};
|
||||
|
||||
static void resize(uiAttributedString *s, size_t u8, size_t u16)
|
||||
{
|
||||
s->len = u8;
|
||||
s->s = (char *) uiprivRealloc(s->s, (s->len + 1) * sizeof (char), "char[] (uiAttributedString)");
|
||||
s->u8tou16 = (size_t *) uiprivRealloc(s->u8tou16, (s->len + 1) * sizeof (size_t), "size_t[] (uiAttributedString)");
|
||||
s->u16len = u16;
|
||||
s->u16 = (uint16_t *) uiprivRealloc(s->u16, (s->u16len + 1) * sizeof (uint16_t), "uint16_t[] (uiAttributedString)");
|
||||
s->u16tou8 = (size_t *) uiprivRealloc(s->u16tou8, (s->u16len + 1) * sizeof (size_t), "size_t[] (uiAttributedString)");
|
||||
}
|
||||
|
||||
uiAttributedString *uiNewAttributedString(const char *initialString)
|
||||
{
|
||||
uiAttributedString *s;
|
||||
|
||||
s = uiprivNew(uiAttributedString);
|
||||
s->attrs = uiprivNewAttrList();
|
||||
uiAttributedStringAppendUnattributed(s, initialString);
|
||||
return s;
|
||||
}
|
||||
|
||||
// TODO make sure that all implementations of uiprivNewGraphemes() work fine with empty strings; in particular, the Windows one might not
|
||||
static void recomputeGraphemes(uiAttributedString *s)
|
||||
{
|
||||
if (s->graphemes != NULL)
|
||||
return;
|
||||
if (uiprivGraphemesTakesUTF16()) {
|
||||
s->graphemes = uiprivNewGraphemes(s->u16, s->u16len);
|
||||
return;
|
||||
}
|
||||
s->graphemes = uiprivNewGraphemes(s->s, s->len);
|
||||
}
|
||||
|
||||
static void invalidateGraphemes(uiAttributedString *s)
|
||||
{
|
||||
if (s->graphemes == NULL)
|
||||
return;
|
||||
uiprivFree(s->graphemes->pointsToGraphemes);
|
||||
uiprivFree(s->graphemes->graphemesToPoints);
|
||||
uiprivFree(s->graphemes);
|
||||
s->graphemes = NULL;
|
||||
}
|
||||
|
||||
void uiFreeAttributedString(uiAttributedString *s)
|
||||
{
|
||||
uiprivFreeAttrList(s->attrs);
|
||||
invalidateGraphemes(s);
|
||||
uiprivFree(s->u16tou8);
|
||||
uiprivFree(s->u8tou16);
|
||||
uiprivFree(s->u16);
|
||||
uiprivFree(s->s);
|
||||
uiprivFree(s);
|
||||
}
|
||||
|
||||
const char *uiAttributedStringString(const uiAttributedString *s)
|
||||
{
|
||||
return s->s;
|
||||
}
|
||||
|
||||
size_t uiAttributedStringLen(const uiAttributedString *s)
|
||||
{
|
||||
return s->len;
|
||||
}
|
||||
|
||||
static void u8u16len(const char *str, size_t *n8, size_t *n16)
|
||||
{
|
||||
uint32_t rune;
|
||||
char buf[4];
|
||||
uint16_t buf16[2];
|
||||
|
||||
*n8 = 0;
|
||||
*n16 = 0;
|
||||
while (*str) {
|
||||
str = uiprivUTF8DecodeRune(str, 0, &rune);
|
||||
// TODO document the use of the function vs a pointer subtract here
|
||||
// TODO also we need to consider namespace collision with utf.h...
|
||||
*n8 += uiprivUTF8EncodeRune(rune, buf);
|
||||
*n16 += uiprivUTF16EncodeRune(rune, buf16);
|
||||
}
|
||||
}
|
||||
|
||||
void uiAttributedStringAppendUnattributed(uiAttributedString *s, const char *str)
|
||||
{
|
||||
uiAttributedStringInsertAtUnattributed(s, str, s->len);
|
||||
}
|
||||
|
||||
// this works (and returns true, which is what we want) at s->len too because s->s[s->len] is always going to be 0 due to us allocating s->len + 1 bytes and because uiprivRealloc() always zero-fills allocated memory
|
||||
static int onCodepointBoundary(uiAttributedString *s, size_t at)
|
||||
{
|
||||
uint8_t c;
|
||||
|
||||
// for uiNewAttributedString()
|
||||
if (s->s == NULL && at == 0)
|
||||
return 1;
|
||||
c = (uint8_t) (s->s[at]);
|
||||
return c < 0x80 || c >= 0xC0;
|
||||
}
|
||||
|
||||
// TODO note that at must be on a codeoint boundary
|
||||
void uiAttributedStringInsertAtUnattributed(uiAttributedString *s, const char *str, size_t at)
|
||||
{
|
||||
uint32_t rune;
|
||||
char buf[4];
|
||||
uint16_t buf16[2];
|
||||
size_t n8, n16; // TODO make loop-local? to avoid using them in the wrong place again
|
||||
size_t old, old16;
|
||||
size_t oldn8, oldn16;
|
||||
size_t oldlen, old16len;
|
||||
size_t at16;
|
||||
size_t i;
|
||||
|
||||
if (!onCodepointBoundary(s, at)) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
at16 = 0;
|
||||
if (s->u8tou16 != NULL)
|
||||
at16 = s->u8tou16[at];
|
||||
|
||||
// do this first to reclaim memory
|
||||
invalidateGraphemes(s);
|
||||
|
||||
// first figure out how much we need to grow by
|
||||
// this includes post-validated UTF-8
|
||||
u8u16len(str, &n8, &n16);
|
||||
|
||||
// and resize
|
||||
old = at;
|
||||
old16 = at16;
|
||||
oldlen = s->len;
|
||||
old16len = s->u16len;
|
||||
resize(s, s->len + n8, s->u16len + n16);
|
||||
|
||||
// move existing characters out of the way
|
||||
// note the use of memmove(): https://twitter.com/rob_pike/status/737797688217894912
|
||||
memmove(
|
||||
s->s + at + n8,
|
||||
s->s + at,
|
||||
(oldlen - at) * sizeof (char));
|
||||
memmove(
|
||||
s->u16 + at16 + n16,
|
||||
s->u16 + at16,
|
||||
(old16len - at16) * sizeof (uint16_t));
|
||||
// note the + 1 for these; we want to copy the terminating null too
|
||||
memmove(
|
||||
s->u8tou16 + at + n8,
|
||||
s->u8tou16 + at,
|
||||
(oldlen - at + 1) * sizeof (size_t));
|
||||
memmove(
|
||||
s->u16tou8 + at16 + n16,
|
||||
s->u16tou8 + at16,
|
||||
(old16len - at16 + 1) * sizeof (size_t));
|
||||
oldn8 = n8;
|
||||
oldn16 = n16;
|
||||
|
||||
// and copy
|
||||
while (*str) {
|
||||
size_t n;
|
||||
|
||||
str = uiprivUTF8DecodeRune(str, 0, &rune);
|
||||
n = uiprivUTF8EncodeRune(rune, buf);
|
||||
n16 = uiprivUTF16EncodeRune(rune, buf16);
|
||||
s->s[old] = buf[0];
|
||||
s->u8tou16[old] = old16;
|
||||
if (n > 1) {
|
||||
s->s[old + 1] = buf[1];
|
||||
s->u8tou16[old + 1] = old16;
|
||||
}
|
||||
if (n > 2) {
|
||||
s->s[old + 2] = buf[2];
|
||||
s->u8tou16[old + 2] = old16;
|
||||
}
|
||||
if (n > 3) {
|
||||
s->s[old + 3] = buf[3];
|
||||
s->u8tou16[old + 3] = old16;
|
||||
}
|
||||
s->u16[old16] = buf16[0];
|
||||
s->u16tou8[old16] = old;
|
||||
if (n16 > 1) {
|
||||
s->u16[old16 + 1] = buf16[1];
|
||||
s->u16tou8[old16 + 1] = old;
|
||||
}
|
||||
old += n;
|
||||
old16 += n16;
|
||||
}
|
||||
// and have an index for the end of the string
|
||||
// TODO is this done by the below?
|
||||
//TODO s->u8tou16[old] = old16;
|
||||
//TODO s->u16tou8[old16] = old;
|
||||
|
||||
// and adjust the prior values in the conversion tables
|
||||
// use <= so the terminating 0 gets updated too
|
||||
for (i = 0; i <= oldlen - at; i++)
|
||||
s->u8tou16[at + oldn8 + i] += s->u16len - old16len;
|
||||
for (i = 0; i <= old16len - at16; i++)
|
||||
s->u16tou8[at16 + oldn16 + i] += s->len - oldlen;
|
||||
|
||||
// and finally do the attributes
|
||||
uiprivAttrListInsertCharactersUnattributed(s->attrs, at, n8);
|
||||
}
|
||||
|
||||
// TODO document that end is the first index that will be maintained
|
||||
void uiAttributedStringDelete(uiAttributedString *s, size_t start, size_t end)
|
||||
{
|
||||
size_t start16, end16;
|
||||
size_t count, count16;
|
||||
size_t i;
|
||||
|
||||
if (!onCodepointBoundary(s, start)) {
|
||||
// TODO
|
||||
}
|
||||
if (!onCodepointBoundary(s, end)) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
count = end - start;
|
||||
start16 = s->u8tou16[start];
|
||||
end16 = s->u8tou16[end];
|
||||
count16 = end16 - start16;
|
||||
|
||||
invalidateGraphemes(s);
|
||||
|
||||
// overwrite old characters
|
||||
memmove(
|
||||
s->s + start,
|
||||
s->s + end,
|
||||
(s->len - end) * sizeof (char));
|
||||
memmove(
|
||||
s->u16 + start16,
|
||||
s->u16 + end16,
|
||||
(s->u16len - end16) * sizeof (uint16_t));
|
||||
// note the + 1 for these; we want to copy the terminating null too
|
||||
memmove(
|
||||
s->u8tou16 + start,
|
||||
s->u8tou16 + end,
|
||||
(s->len - end + 1) * sizeof (size_t));
|
||||
memmove(
|
||||
s->u16tou8 + start16,
|
||||
s->u16tou8 + end16,
|
||||
(s->u16len - end16 + 1) * sizeof (size_t));
|
||||
|
||||
// update the conversion tables
|
||||
// note the use of <= to include the null terminator
|
||||
for (i = 0; i <= (s->len - end); i++)
|
||||
s->u8tou16[start + i] -= count16;
|
||||
for (i = 0; i <= (s->u16len - end16); i++)
|
||||
s->u16tou8[start16 + i] -= count;
|
||||
|
||||
// null-terminate the string
|
||||
s->s[start + (s->len - end)] = 0;
|
||||
s->u16[start16 + (s->u16len - end16)] = 0;
|
||||
|
||||
// fix up attributes
|
||||
uiprivAttrListRemoveCharacters(s->attrs, start, end);
|
||||
|
||||
// and finally resize
|
||||
resize(s, s->len - count, s->u16len - count16);
|
||||
}
|
||||
|
||||
void uiAttributedStringSetAttribute(uiAttributedString *s, uiAttribute *a, size_t start, size_t end)
|
||||
{
|
||||
uiprivAttrListInsertAttribute(s->attrs, a, start, end);
|
||||
}
|
||||
|
||||
// LONGTERM introduce an iterator object instead?
|
||||
void uiAttributedStringForEachAttribute(const uiAttributedString *s, uiAttributedStringForEachAttributeFunc f, void *data)
|
||||
{
|
||||
uiprivAttrListForEach(s->attrs, s, f, data);
|
||||
}
|
||||
|
||||
// TODO figure out if we should count the grapheme past the end
|
||||
size_t uiAttributedStringNumGraphemes(uiAttributedString *s)
|
||||
{
|
||||
recomputeGraphemes(s);
|
||||
return s->graphemes->len;
|
||||
}
|
||||
|
||||
size_t uiAttributedStringByteIndexToGrapheme(uiAttributedString *s, size_t pos)
|
||||
{
|
||||
recomputeGraphemes(s);
|
||||
if (uiprivGraphemesTakesUTF16())
|
||||
pos = s->u8tou16[pos];
|
||||
return s->graphemes->pointsToGraphemes[pos];
|
||||
}
|
||||
|
||||
size_t uiAttributedStringGraphemeToByteIndex(uiAttributedString *s, size_t pos)
|
||||
{
|
||||
recomputeGraphemes(s);
|
||||
pos = s->graphemes->graphemesToPoints[pos];
|
||||
if (uiprivGraphemesTakesUTF16())
|
||||
pos = s->u16tou8[pos];
|
||||
return pos;
|
||||
}
|
||||
|
||||
// helpers for platform-specific code
|
||||
|
||||
const uint16_t *uiprivAttributedStringUTF16String(const uiAttributedString *s)
|
||||
{
|
||||
return s->u16;
|
||||
}
|
||||
|
||||
size_t uiprivAttributedStringUTF16Len(const uiAttributedString *s)
|
||||
{
|
||||
return s->u16len;
|
||||
}
|
||||
|
||||
// TODO is this still needed given the below?
|
||||
size_t uiprivAttributedStringUTF8ToUTF16(const uiAttributedString *s, size_t n)
|
||||
{
|
||||
return s->u8tou16[n];
|
||||
}
|
||||
|
||||
size_t *uiprivAttributedStringCopyUTF8ToUTF16Table(const uiAttributedString *s, size_t *n)
|
||||
{
|
||||
size_t *out;
|
||||
size_t nbytes;
|
||||
|
||||
nbytes = (s->len + 1) * sizeof (size_t);
|
||||
*n = s->len;
|
||||
out = (size_t *) uiprivAlloc(nbytes, "size_t[] (uiAttributedString)");
|
||||
memmove(out, s->u8tou16, nbytes);
|
||||
return out;
|
||||
}
|
||||
|
||||
size_t *uiprivAttributedStringCopyUTF16ToUTF8Table(const uiAttributedString *s, size_t *n)
|
||||
{
|
||||
size_t *out;
|
||||
size_t nbytes;
|
||||
|
||||
nbytes = (s->u16len + 1) * sizeof (size_t);
|
||||
*n = s->u16len;
|
||||
out = (size_t *) uiprivAlloc(nbytes, "size_t[] (uiAttributedString)");
|
||||
memmove(out, s->u16tou8, nbytes);
|
||||
return out;
|
||||
}
|
||||
46
dep/libui/common/attrstr.h
Normal file
46
dep/libui/common/attrstr.h
Normal file
@@ -0,0 +1,46 @@
|
||||
// 19 february 2018
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// attribute.c
|
||||
extern uiAttribute *uiprivAttributeRetain(uiAttribute *a);
|
||||
extern void uiprivAttributeRelease(uiAttribute *a);
|
||||
extern int uiprivAttributeEqual(const uiAttribute *a, const uiAttribute *b);
|
||||
|
||||
// opentype.c
|
||||
extern int uiprivOpenTypeFeaturesEqual(const uiOpenTypeFeatures *a, const uiOpenTypeFeatures *b);
|
||||
|
||||
// attrlist.c
|
||||
typedef struct uiprivAttrList uiprivAttrList;
|
||||
extern uiprivAttrList *uiprivNewAttrList(void);
|
||||
extern void uiprivFreeAttrList(uiprivAttrList *alist);
|
||||
extern void uiprivAttrListInsertAttribute(uiprivAttrList *alist, uiAttribute *val, size_t start, size_t end);
|
||||
extern void uiprivAttrListInsertCharactersUnattributed(uiprivAttrList *alist, size_t start, size_t count);
|
||||
extern void uiprivAttrListInsertCharactersExtendingAttributes(uiprivAttrList *alist, size_t start, size_t count);
|
||||
extern void uiprivAttrListRemoveAttribute(uiprivAttrList *alist, uiAttributeType type, size_t start, size_t end);
|
||||
extern void uiprivAttrListRemoveAttributes(uiprivAttrList *alist, size_t start, size_t end);
|
||||
extern void uiprivAttrListRemoveCharacters(uiprivAttrList *alist, size_t start, size_t end);
|
||||
extern void uiprivAttrListForEach(const uiprivAttrList *alist, const uiAttributedString *s, uiAttributedStringForEachAttributeFunc f, void *data);
|
||||
|
||||
// attrstr.c
|
||||
extern const uint16_t *uiprivAttributedStringUTF16String(const uiAttributedString *s);
|
||||
extern size_t uiprivAttributedStringUTF16Len(const uiAttributedString *s);
|
||||
extern size_t uiprivAttributedStringUTF8ToUTF16(const uiAttributedString *s, size_t n);
|
||||
extern size_t *uiprivAttributedStringCopyUTF8ToUTF16Table(const uiAttributedString *s, size_t *n);
|
||||
extern size_t *uiprivAttributedStringCopyUTF16ToUTF8Table(const uiAttributedString *s, size_t *n);
|
||||
|
||||
// per-OS graphemes.c/graphemes.cpp/graphemes.m/etc.
|
||||
typedef struct uiprivGraphemes uiprivGraphemes;
|
||||
struct uiprivGraphemes {
|
||||
size_t len;
|
||||
size_t *pointsToGraphemes;
|
||||
size_t *graphemesToPoints;
|
||||
};
|
||||
extern int uiprivGraphemesTakesUTF16(void);
|
||||
extern uiprivGraphemes *uiprivNewGraphemes(void *s, size_t len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
101
dep/libui/common/control.c
Normal file
101
dep/libui/common/control.c
Normal file
@@ -0,0 +1,101 @@
|
||||
// 26 may 2015
|
||||
#include "../ui.h"
|
||||
#include "uipriv.h"
|
||||
|
||||
void uiControlDestroy(uiControl *c)
|
||||
{
|
||||
(*(c->Destroy))(c);
|
||||
}
|
||||
|
||||
uintptr_t uiControlHandle(uiControl *c)
|
||||
{
|
||||
return (*(c->Handle))(c);
|
||||
}
|
||||
|
||||
uiControl *uiControlParent(uiControl *c)
|
||||
{
|
||||
return (*(c->Parent))(c);
|
||||
}
|
||||
|
||||
void uiControlSetParent(uiControl *c, uiControl *parent)
|
||||
{
|
||||
(*(c->SetParent))(c, parent);
|
||||
}
|
||||
|
||||
int uiControlToplevel(uiControl *c)
|
||||
{
|
||||
return (*(c->Toplevel))(c);
|
||||
}
|
||||
|
||||
int uiControlVisible(uiControl *c)
|
||||
{
|
||||
return (*(c->Visible))(c);
|
||||
}
|
||||
|
||||
void uiControlShow(uiControl *c)
|
||||
{
|
||||
(*(c->Show))(c);
|
||||
}
|
||||
|
||||
void uiControlHide(uiControl *c)
|
||||
{
|
||||
(*(c->Hide))(c);
|
||||
}
|
||||
|
||||
int uiControlEnabled(uiControl *c)
|
||||
{
|
||||
return (*(c->Enabled))(c);
|
||||
}
|
||||
|
||||
void uiControlEnable(uiControl *c)
|
||||
{
|
||||
(*(c->Enable))(c);
|
||||
}
|
||||
|
||||
void uiControlDisable(uiControl *c)
|
||||
{
|
||||
(*(c->Disable))(c);
|
||||
}
|
||||
|
||||
#define uiprivControlSignature 0x7569436F
|
||||
|
||||
uiControl *uiAllocControl(size_t size, uint32_t OSsig, uint32_t typesig, const char *typenamestr)
|
||||
{
|
||||
uiControl *c;
|
||||
|
||||
c = (uiControl *) uiprivAlloc(size, typenamestr);
|
||||
c->Signature = uiprivControlSignature;
|
||||
c->OSSignature = OSsig;
|
||||
c->TypeSignature = typesig;
|
||||
return c;
|
||||
}
|
||||
|
||||
void uiFreeControl(uiControl *c)
|
||||
{
|
||||
if (uiControlParent(c) != NULL)
|
||||
uiprivUserBug("You cannot destroy a uiControl while it still has a parent. (control: %p)", c);
|
||||
uiprivFree(c);
|
||||
}
|
||||
|
||||
void uiControlVerifySetParent(uiControl *c, uiControl *parent)
|
||||
{
|
||||
uiControl *curParent;
|
||||
|
||||
if (uiControlToplevel(c))
|
||||
uiprivUserBug("You cannot give a toplevel uiControl a parent. (control: %p)", c);
|
||||
curParent = uiControlParent(c);
|
||||
if (parent != NULL && curParent != NULL)
|
||||
uiprivUserBug("You cannot give a uiControl a parent while it already has one. (control: %p; current parent: %p; new parent: %p)", c, curParent, parent);
|
||||
if (parent == NULL && curParent == NULL)
|
||||
uiprivImplBug("attempt to double unparent uiControl %p", c);
|
||||
}
|
||||
|
||||
int uiControlEnabledToUser(uiControl *c)
|
||||
{
|
||||
while (c != NULL) {
|
||||
if (!uiControlEnabled(c))
|
||||
return 0;
|
||||
c = uiControlParent(c);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
27
dep/libui/common/controlsigs.h
Normal file
27
dep/libui/common/controlsigs.h
Normal file
@@ -0,0 +1,27 @@
|
||||
// 24 april 2016
|
||||
|
||||
// LONGTERM if I don't decide to remove these outright, should they be renamed uiprivTypeNameSignature? these aren't real symbols, so...
|
||||
|
||||
#define uiAreaSignature 0x41726561
|
||||
#define uiBoxSignature 0x426F784C
|
||||
#define uiButtonSignature 0x42746F6E
|
||||
#define uiCheckboxSignature 0x43686B62
|
||||
#define uiColorButtonSignature 0x436F6C42
|
||||
#define uiComboboxSignature 0x436F6D62
|
||||
#define uiDateTimePickerSignature 0x44545069
|
||||
#define uiEditableComboboxSignature 0x45644362
|
||||
#define uiEntrySignature 0x456E7472
|
||||
#define uiFontButtonSignature 0x466F6E42
|
||||
#define uiFormSignature 0x466F726D
|
||||
#define uiGridSignature 0x47726964
|
||||
#define uiGroupSignature 0x47727062
|
||||
#define uiLabelSignature 0x4C61626C
|
||||
#define uiMultilineEntrySignature 0x4D6C6E45
|
||||
#define uiProgressBarSignature 0x50426172
|
||||
#define uiRadioButtonsSignature 0x5264696F
|
||||
#define uiSeparatorSignature 0x53657061
|
||||
#define uiSliderSignature 0x536C6964
|
||||
#define uiSpinboxSignature 0x5370696E
|
||||
#define uiTabSignature 0x54616273
|
||||
#define uiTableSignature 0x5461626C
|
||||
#define uiWindowSignature 0x57696E64
|
||||
21
dep/libui/common/debug.c
Normal file
21
dep/libui/common/debug.c
Normal file
@@ -0,0 +1,21 @@
|
||||
// 13 may 2016
|
||||
#include "../ui.h"
|
||||
#include "uipriv.h"
|
||||
|
||||
void uiprivDoImplBug(const char *file, const char *line, const char *func, const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
uiprivRealBug(file, line, func, "POSSIBLE IMPLEMENTATION BUG; CONTACT ANDLABS:\n", format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void uiprivDoUserBug(const char *file, const char *line, const char *func, const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
uiprivRealBug(file, line, func, "You have a bug: ", format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
50
dep/libui/common/matrix.c
Normal file
50
dep/libui/common/matrix.c
Normal file
@@ -0,0 +1,50 @@
|
||||
// 11 october 2015
|
||||
#include <math.h>
|
||||
#include "../ui.h"
|
||||
#include "uipriv.h"
|
||||
|
||||
void uiDrawMatrixSetIdentity(uiDrawMatrix *m)
|
||||
{
|
||||
m->M11 = 1;
|
||||
m->M12 = 0;
|
||||
m->M21 = 0;
|
||||
m->M22 = 1;
|
||||
m->M31 = 0;
|
||||
m->M32 = 0;
|
||||
}
|
||||
|
||||
// The rest of this file provides basic utilities in case the platform doesn't provide any of its own for these tasks.
|
||||
// Keep these as minimal as possible. They should generally not call other fallbacks.
|
||||
|
||||
// see https://msdn.microsoft.com/en-us/library/windows/desktop/ff684171%28v=vs.85%29.aspx#skew_transform
|
||||
// TODO see if there's a way we can avoid the multiplication
|
||||
void uiprivFallbackSkew(uiDrawMatrix *m, double x, double y, double xamount, double yamount)
|
||||
{
|
||||
uiDrawMatrix n;
|
||||
|
||||
uiDrawMatrixSetIdentity(&n);
|
||||
// TODO explain this
|
||||
n.M12 = tan(yamount);
|
||||
n.M21 = tan(xamount);
|
||||
n.M31 = -y * tan(xamount);
|
||||
n.M32 = -x * tan(yamount);
|
||||
uiDrawMatrixMultiply(m, &n);
|
||||
}
|
||||
|
||||
void uiprivScaleCenter(double xCenter, double yCenter, double *x, double *y)
|
||||
{
|
||||
*x = xCenter - (*x * xCenter);
|
||||
*y = yCenter - (*y * yCenter);
|
||||
}
|
||||
|
||||
// the basic algorithm is from cairo
|
||||
// but it's the same algorithm as the transform point, just without M31 and M32 taken into account, so let's just do that instead
|
||||
void uiprivFallbackTransformSize(uiDrawMatrix *m, double *x, double *y)
|
||||
{
|
||||
uiDrawMatrix m2;
|
||||
|
||||
m2 = *m;
|
||||
m2.M31 = 0;
|
||||
m2.M32 = 0;
|
||||
uiDrawMatrixTransformPoint(&m2, x, y);
|
||||
}
|
||||
17
dep/libui/common/meson.build
Normal file
17
dep/libui/common/meson.build
Normal file
@@ -0,0 +1,17 @@
|
||||
# 23 march 2019
|
||||
|
||||
libui_sources += [
|
||||
'common/attribute.c',
|
||||
'common/attrlist.c',
|
||||
'common/attrstr.c',
|
||||
'common/areaevents.c',
|
||||
'common/control.c',
|
||||
'common/debug.c',
|
||||
'common/matrix.c',
|
||||
'common/opentype.c',
|
||||
'common/shouldquit.c',
|
||||
'common/tablemodel.c',
|
||||
'common/tablevalue.c',
|
||||
'common/userbugs.c',
|
||||
'common/utf.c',
|
||||
]
|
||||
165
dep/libui/common/opentype.c
Normal file
165
dep/libui/common/opentype.c
Normal file
@@ -0,0 +1,165 @@
|
||||
// 25 february 2018
|
||||
#include <stdlib.h>
|
||||
#include "../ui.h"
|
||||
#include "uipriv.h"
|
||||
#include "attrstr.h"
|
||||
|
||||
struct feature {
|
||||
char a;
|
||||
char b;
|
||||
char c;
|
||||
char d;
|
||||
uint32_t value;
|
||||
};
|
||||
|
||||
struct uiOpenTypeFeatures {
|
||||
struct feature *data;
|
||||
size_t len;
|
||||
size_t cap;
|
||||
};
|
||||
|
||||
#define bytecount(n) ((n) * sizeof (struct feature))
|
||||
|
||||
uiOpenTypeFeatures *uiNewOpenTypeFeatures(void)
|
||||
{
|
||||
uiOpenTypeFeatures *otf;
|
||||
|
||||
otf = uiprivNew(uiOpenTypeFeatures);
|
||||
otf->cap = 16;
|
||||
otf->data = (struct feature *) uiprivAlloc(bytecount(otf->cap), "struct feature[]");
|
||||
otf->len = 0;
|
||||
return otf;
|
||||
}
|
||||
|
||||
void uiFreeOpenTypeFeatures(uiOpenTypeFeatures *otf)
|
||||
{
|
||||
uiprivFree(otf->data);
|
||||
uiprivFree(otf);
|
||||
}
|
||||
|
||||
uiOpenTypeFeatures *uiOpenTypeFeaturesClone(const uiOpenTypeFeatures *otf)
|
||||
{
|
||||
uiOpenTypeFeatures *ret;
|
||||
|
||||
ret = uiprivNew(uiOpenTypeFeatures);
|
||||
ret->len = otf->len;
|
||||
ret->cap = otf->cap;
|
||||
ret->data = (struct feature *) uiprivAlloc(bytecount(ret->cap), "struct feature[]");
|
||||
memset(ret->data, 0, bytecount(ret->cap));
|
||||
memmove(ret->data, otf->data, bytecount(ret->len));
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define intdiff(a, b) (((int) (a)) - ((int) (b)))
|
||||
|
||||
static int featurecmp(const void *a, const void *b)
|
||||
{
|
||||
const struct feature *f = (const struct feature *) a;
|
||||
const struct feature *g = (const struct feature *) b;
|
||||
|
||||
if (f->a != g->a)
|
||||
return intdiff(f->a, g->a);
|
||||
if (f->b != g->b)
|
||||
return intdiff(f->b, g->b);
|
||||
if (f->c != g->c)
|
||||
return intdiff(f->c, g->c);
|
||||
return intdiff(f->d, g->d);
|
||||
}
|
||||
|
||||
static struct feature mkkey(char a, char b, char c, char d)
|
||||
{
|
||||
struct feature f;
|
||||
|
||||
f.a = a;
|
||||
f.b = b;
|
||||
f.c = c;
|
||||
f.d = d;
|
||||
return f;
|
||||
}
|
||||
|
||||
#define find(pkey, otf) bsearch(pkey, otf->data, otf->len, sizeof (struct feature), featurecmp)
|
||||
|
||||
void uiOpenTypeFeaturesAdd(uiOpenTypeFeatures *otf, char a, char b, char c, char d, uint32_t value)
|
||||
{
|
||||
struct feature *f;
|
||||
struct feature key;
|
||||
|
||||
// replace existing value if any
|
||||
key = mkkey(a, b, c, d);
|
||||
f = (struct feature *) find(&key, otf);
|
||||
if (f != NULL) {
|
||||
f->value = value;
|
||||
return;
|
||||
}
|
||||
|
||||
// if we got here, the tag is new
|
||||
if (otf->len == otf->cap) {
|
||||
otf->cap *= 2;
|
||||
otf->data = (struct feature *) uiprivRealloc(otf->data, bytecount(otf->cap), "struct feature[]");
|
||||
}
|
||||
f = otf->data + otf->len;
|
||||
f->a = a;
|
||||
f->b = b;
|
||||
f->c = c;
|
||||
f->d = d;
|
||||
f->value = value;
|
||||
// LONGTERM qsort here is overkill
|
||||
otf->len++;
|
||||
qsort(otf->data, otf->len, sizeof (struct feature), featurecmp);
|
||||
}
|
||||
|
||||
void uiOpenTypeFeaturesRemove(uiOpenTypeFeatures *otf, char a, char b, char c, char d)
|
||||
{
|
||||
struct feature *f;
|
||||
struct feature key;
|
||||
ptrdiff_t index;
|
||||
size_t count;
|
||||
|
||||
key = mkkey(a, b, c, d);
|
||||
f = (struct feature *) find(&key, otf);
|
||||
if (f == NULL)
|
||||
return;
|
||||
|
||||
index = f - otf->data;
|
||||
count = otf->len - index - 1;
|
||||
memmove(f + 1, f, bytecount(count));
|
||||
otf->len--;
|
||||
}
|
||||
|
||||
int uiOpenTypeFeaturesGet(const uiOpenTypeFeatures *otf, char a, char b, char c, char d, uint32_t *value)
|
||||
{
|
||||
const struct feature *f;
|
||||
struct feature key;
|
||||
|
||||
key = mkkey(a, b, c, d);
|
||||
f = (const struct feature *) find(&key, otf);
|
||||
if (f == NULL)
|
||||
return 0;
|
||||
*value = f->value;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void uiOpenTypeFeaturesForEach(const uiOpenTypeFeatures *otf, uiOpenTypeFeaturesForEachFunc f, void *data)
|
||||
{
|
||||
size_t n;
|
||||
const struct feature *p;
|
||||
uiForEach ret;
|
||||
|
||||
p = otf->data;
|
||||
for (n = 0; n < otf->len; n++) {
|
||||
ret = (*f)(otf, p->a, p->b, p->c, p->d, p->value, data);
|
||||
// TODO for all: require exact match?
|
||||
if (ret == uiForEachStop)
|
||||
return;
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
int uiprivOpenTypeFeaturesEqual(const uiOpenTypeFeatures *a, const uiOpenTypeFeatures *b)
|
||||
{
|
||||
if (a == b)
|
||||
return 1;
|
||||
if (a->len != b->len)
|
||||
return 0;
|
||||
return memcmp(a->data, b->data, bytecount(a->len)) == 0;
|
||||
}
|
||||
22
dep/libui/common/shouldquit.c
Normal file
22
dep/libui/common/shouldquit.c
Normal file
@@ -0,0 +1,22 @@
|
||||
// 9 may 2015
|
||||
#include "../ui.h"
|
||||
#include "uipriv.h"
|
||||
|
||||
static int defaultOnShouldQuit(void *data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int (*onShouldQuit)(void *) = defaultOnShouldQuit;
|
||||
static void *onShouldQuitData = NULL;
|
||||
|
||||
void uiOnShouldQuit(int (*f)(void *), void *data)
|
||||
{
|
||||
onShouldQuit = f;
|
||||
onShouldQuitData = data;
|
||||
}
|
||||
|
||||
int uiprivShouldQuit(void)
|
||||
{
|
||||
return (*onShouldQuit)(onShouldQuitData);
|
||||
}
|
||||
20
dep/libui/common/table.h
Normal file
20
dep/libui/common/table.h
Normal file
@@ -0,0 +1,20 @@
|
||||
// 23 june 2018
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// tablemodel.c
|
||||
extern uiTableModelHandler *uiprivTableModelHandler(uiTableModel *m);
|
||||
extern int uiprivTableModelNumColumns(uiTableModel *m);
|
||||
extern uiTableValueType uiprivTableModelColumnType(uiTableModel *m, int column);
|
||||
extern int uiprivTableModelNumRows(uiTableModel *m);
|
||||
extern uiTableValue *uiprivTableModelCellValue(uiTableModel *m, int row, int column);
|
||||
extern void uiprivTableModelSetCellValue(uiTableModel *m, int row, int column, const uiTableValue *value);
|
||||
extern const uiTableTextColumnOptionalParams uiprivDefaultTextColumnOptionalParams;
|
||||
extern int uiprivTableModelCellEditable(uiTableModel *m, int row, int column);
|
||||
extern int uiprivTableModelColorIfProvided(uiTableModel *m, int row, int column, double *r, double *g, double *b, double *a);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
79
dep/libui/common/tablemodel.c
Normal file
79
dep/libui/common/tablemodel.c
Normal file
@@ -0,0 +1,79 @@
|
||||
// 23 june 2018
|
||||
#include "../ui.h"
|
||||
#include "uipriv.h"
|
||||
#include "table.h"
|
||||
|
||||
int uiprivTableModelNumColumns(uiTableModel *m)
|
||||
{
|
||||
uiTableModelHandler *mh;
|
||||
|
||||
mh = uiprivTableModelHandler(m);
|
||||
return (*(mh->NumColumns))(mh, m);
|
||||
}
|
||||
|
||||
uiTableValueType uiprivTableModelColumnType(uiTableModel *m, int column)
|
||||
{
|
||||
uiTableModelHandler *mh;
|
||||
|
||||
mh = uiprivTableModelHandler(m);
|
||||
return (*(mh->ColumnType))(mh, m, column);
|
||||
}
|
||||
|
||||
int uiprivTableModelNumRows(uiTableModel *m)
|
||||
{
|
||||
uiTableModelHandler *mh;
|
||||
|
||||
mh = uiprivTableModelHandler(m);
|
||||
return (*(mh->NumRows))(mh, m);
|
||||
}
|
||||
|
||||
uiTableValue *uiprivTableModelCellValue(uiTableModel *m, int row, int column)
|
||||
{
|
||||
uiTableModelHandler *mh;
|
||||
|
||||
mh = uiprivTableModelHandler(m);
|
||||
return (*(mh->CellValue))(mh, m, row, column);
|
||||
}
|
||||
|
||||
void uiprivTableModelSetCellValue(uiTableModel *m, int row, int column, const uiTableValue *value)
|
||||
{
|
||||
uiTableModelHandler *mh;
|
||||
|
||||
mh = uiprivTableModelHandler(m);
|
||||
(*(mh->SetCellValue))(mh, m, row, column, value);
|
||||
}
|
||||
|
||||
const uiTableTextColumnOptionalParams uiprivDefaultTextColumnOptionalParams = {
|
||||
.ColorModelColumn = -1,
|
||||
};
|
||||
|
||||
int uiprivTableModelCellEditable(uiTableModel *m, int row, int column)
|
||||
{
|
||||
uiTableValue *value;
|
||||
int editable;
|
||||
|
||||
switch (column) {
|
||||
case uiTableModelColumnNeverEditable:
|
||||
return 0;
|
||||
case uiTableModelColumnAlwaysEditable:
|
||||
return 1;
|
||||
}
|
||||
value = uiprivTableModelCellValue(m, row, column);
|
||||
editable = uiTableValueInt(value);
|
||||
uiFreeTableValue(value);
|
||||
return editable;
|
||||
}
|
||||
|
||||
int uiprivTableModelColorIfProvided(uiTableModel *m, int row, int column, double *r, double *g, double *b, double *a)
|
||||
{
|
||||
uiTableValue *value;
|
||||
|
||||
if (column == -1)
|
||||
return 0;
|
||||
value = uiprivTableModelCellValue(m, row, column);
|
||||
if (value == NULL)
|
||||
return 0;
|
||||
uiTableValueColor(value, r, g, b, a);
|
||||
uiFreeTableValue(value);
|
||||
return 1;
|
||||
}
|
||||
106
dep/libui/common/tablevalue.c
Normal file
106
dep/libui/common/tablevalue.c
Normal file
@@ -0,0 +1,106 @@
|
||||
// 3 june 2018
|
||||
#include "../ui.h"
|
||||
#include "uipriv.h"
|
||||
#include "table.h"
|
||||
|
||||
struct uiTableValue {
|
||||
uiTableValueType type;
|
||||
union {
|
||||
char *str;
|
||||
uiImage *img;
|
||||
int i;
|
||||
struct {
|
||||
double r;
|
||||
double g;
|
||||
double b;
|
||||
double a;
|
||||
} color;
|
||||
} u;
|
||||
};
|
||||
|
||||
static uiTableValue *newTableValue(uiTableValueType type)
|
||||
{
|
||||
uiTableValue *v;
|
||||
|
||||
v = uiprivNew(uiTableValue);
|
||||
v->type = type;
|
||||
return v;
|
||||
}
|
||||
|
||||
void uiFreeTableValue(uiTableValue *v)
|
||||
{
|
||||
switch (v->type) {
|
||||
case uiTableValueTypeString:
|
||||
uiprivFree(v->u.str);
|
||||
break;
|
||||
}
|
||||
uiprivFree(v);
|
||||
}
|
||||
|
||||
uiTableValueType uiTableValueGetType(const uiTableValue *v)
|
||||
{
|
||||
return v->type;
|
||||
}
|
||||
|
||||
uiTableValue *uiNewTableValueString(const char *str)
|
||||
{
|
||||
uiTableValue *v;
|
||||
|
||||
v = newTableValue(uiTableValueTypeString);
|
||||
v->u.str = (char *) uiprivAlloc((strlen(str) + 1) * sizeof (char), "char[] (uiTableValue)");
|
||||
strcpy(v->u.str, str);
|
||||
return v;
|
||||
}
|
||||
|
||||
const char *uiTableValueString(const uiTableValue *v)
|
||||
{
|
||||
return v->u.str;
|
||||
}
|
||||
|
||||
uiTableValue *uiNewTableValueImage(uiImage *img)
|
||||
{
|
||||
uiTableValue *v;
|
||||
|
||||
v = newTableValue(uiTableValueTypeImage);
|
||||
v->u.img = img;
|
||||
return v;
|
||||
}
|
||||
|
||||
uiImage *uiTableValueImage(const uiTableValue *v)
|
||||
{
|
||||
return v->u.img;
|
||||
}
|
||||
|
||||
uiTableValue *uiNewTableValueInt(int i)
|
||||
{
|
||||
uiTableValue *v;
|
||||
|
||||
v = newTableValue(uiTableValueTypeInt);
|
||||
v->u.i = i;
|
||||
return v;
|
||||
}
|
||||
|
||||
int uiTableValueInt(const uiTableValue *v)
|
||||
{
|
||||
return v->u.i;
|
||||
}
|
||||
|
||||
uiTableValue *uiNewTableValueColor(double r, double g, double b, double a)
|
||||
{
|
||||
uiTableValue *v;
|
||||
|
||||
v = newTableValue(uiTableValueTypeColor);
|
||||
v->u.color.r = r;
|
||||
v->u.color.g = g;
|
||||
v->u.color.b = b;
|
||||
v->u.color.a = a;
|
||||
return v;
|
||||
}
|
||||
|
||||
void uiTableValueColor(const uiTableValue *v, double *r, double *g, double *b, double *a)
|
||||
{
|
||||
*r = v->u.color.r;
|
||||
*g = v->u.color.g;
|
||||
*b = v->u.color.b;
|
||||
*a = v->u.color.a;
|
||||
}
|
||||
67
dep/libui/common/uipriv.h
Normal file
67
dep/libui/common/uipriv.h
Normal file
@@ -0,0 +1,67 @@
|
||||
// 6 april 2015
|
||||
// note: this file should not include ui.h, as the OS-specific ui_*.h files are included between that one and this one in the OS-specific uipriv_*.h* files
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include "controlsigs.h"
|
||||
#include "utf.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// OS-specific init.* or main.* files
|
||||
extern uiInitOptions uiprivOptions;
|
||||
|
||||
// OS-specific alloc.* files
|
||||
extern void *uiprivAlloc(size_t, const char *);
|
||||
#define uiprivNew(T) ((T *) uiprivAlloc(sizeof (T), #T))
|
||||
extern void *uiprivRealloc(void *, size_t, const char *);
|
||||
extern void uiprivFree(void *);
|
||||
|
||||
// debug.c and OS-specific debug.* files
|
||||
// TODO get rid of this mess...
|
||||
// ugh, __func__ was only introduced in MSVC 2015...
|
||||
#ifdef _MSC_VER
|
||||
#define uiprivMacro__func__ __FUNCTION__
|
||||
#else
|
||||
#define uiprivMacro__func__ __func__
|
||||
#endif
|
||||
extern void uiprivRealBug(const char *file, const char *line, const char *func, const char *prefix, const char *format, va_list ap);
|
||||
#define uiprivMacro_ns2(s) #s
|
||||
#define uiprivMacro_ns(s) uiprivMacro_ns2(s)
|
||||
extern void uiprivDoImplBug(const char *file, const char *line, const char *func, const char *format, ...);
|
||||
#define uiprivImplBug(...) uiprivDoImplBug(__FILE__, uiprivMacro_ns(__LINE__), uiprivMacro__func__, __VA_ARGS__)
|
||||
extern void uiprivDoUserBug(const char *file, const char *line, const char *func, const char *format, ...);
|
||||
#define uiprivUserBug(...) uiprivDoUserBug(__FILE__, uiprivMacro_ns(__LINE__), uiprivMacro__func__, __VA_ARGS__)
|
||||
|
||||
// shouldquit.c
|
||||
extern int uiprivShouldQuit(void);
|
||||
|
||||
// areaevents.c
|
||||
typedef struct uiprivClickCounter uiprivClickCounter;
|
||||
// you should call Reset() to zero-initialize a new instance
|
||||
// it doesn't matter that all the non-count fields are zero: the first click will fail the curButton test straightaway, so it'll return 1 and set the rest of the structure accordingly
|
||||
struct uiprivClickCounter {
|
||||
int curButton;
|
||||
int rectX0;
|
||||
int rectY0;
|
||||
int rectX1;
|
||||
int rectY1;
|
||||
uintptr_t prevTime;
|
||||
int count;
|
||||
};
|
||||
extern int uiprivClickCounterClick(uiprivClickCounter *c, int button, int x, int y, uintptr_t time, uintptr_t maxTime, int32_t xdist, int32_t ydist);
|
||||
extern void uiprivClickCounterReset(uiprivClickCounter *);
|
||||
extern int uiprivFromScancode(uintptr_t, uiAreaKeyEvent *);
|
||||
|
||||
// matrix.c
|
||||
extern void uiprivFallbackSkew(uiDrawMatrix *, double, double, double, double);
|
||||
extern void uiprivScaleCenter(double, double, double *, double *);
|
||||
extern void uiprivFallbackTransformSize(uiDrawMatrix *, double *, double *);
|
||||
|
||||
// OS-specific text.* files
|
||||
extern int uiprivStricmp(const char *a, const char *b);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
8
dep/libui/common/userbugs.c
Normal file
8
dep/libui/common/userbugs.c
Normal file
@@ -0,0 +1,8 @@
|
||||
// 22 may 2016
|
||||
#include "../ui.h"
|
||||
#include "uipriv.h"
|
||||
|
||||
void uiUserBugCannotSetParentOnToplevel(const char *type)
|
||||
{
|
||||
uiprivUserBug("You cannot make a %s a child of another uiControl,", type);
|
||||
}
|
||||
348
dep/libui/common/utf.c
Normal file
348
dep/libui/common/utf.c
Normal file
@@ -0,0 +1,348 @@
|
||||
// utf by pietro gagliardi (andlabs) — https://github.com/andlabs/utf/
|
||||
// 10 november 2016
|
||||
// function names have been altered to avoid namespace collisions in libui static builds (see utf.h)
|
||||
#include "utf.h"
|
||||
|
||||
// this code imitates Go's unicode/utf8 and unicode/utf16
|
||||
// the biggest difference is that a rune is unsigned instead of signed (because Go guarantees what a right shift on a signed number will do, whereas C does not)
|
||||
// it is also an imitation so we can license it under looser terms than the Go source
|
||||
#define badrune 0xFFFD
|
||||
|
||||
// encoded must be at most 4 bytes
|
||||
// TODO clean this code up somehow
|
||||
size_t uiprivUTF8EncodeRune(uint32_t rune, char *encoded)
|
||||
{
|
||||
uint8_t b, c, d, e;
|
||||
size_t n;
|
||||
|
||||
// not in the valid range for Unicode
|
||||
if (rune > 0x10FFFF)
|
||||
rune = badrune;
|
||||
// surrogate runes cannot be encoded
|
||||
if (rune >= 0xD800 && rune < 0xE000)
|
||||
rune = badrune;
|
||||
|
||||
if (rune < 0x80) { // ASCII bytes represent themselves
|
||||
b = (uint8_t) (rune & 0xFF);
|
||||
n = 1;
|
||||
goto done;
|
||||
}
|
||||
if (rune < 0x800) { // two-byte encoding
|
||||
c = (uint8_t) (rune & 0x3F);
|
||||
c |= 0x80;
|
||||
rune >>= 6;
|
||||
b = (uint8_t) (rune & 0x1F);
|
||||
b |= 0xC0;
|
||||
n = 2;
|
||||
goto done;
|
||||
}
|
||||
if (rune < 0x10000) { // three-byte encoding
|
||||
d = (uint8_t) (rune & 0x3F);
|
||||
d |= 0x80;
|
||||
rune >>= 6;
|
||||
c = (uint8_t) (rune & 0x3F);
|
||||
c |= 0x80;
|
||||
rune >>= 6;
|
||||
b = (uint8_t) (rune & 0x0F);
|
||||
b |= 0xE0;
|
||||
n = 3;
|
||||
goto done;
|
||||
}
|
||||
// otherwise use a four-byte encoding
|
||||
e = (uint8_t) (rune & 0x3F);
|
||||
e |= 0x80;
|
||||
rune >>= 6;
|
||||
d = (uint8_t) (rune & 0x3F);
|
||||
d |= 0x80;
|
||||
rune >>= 6;
|
||||
c = (uint8_t) (rune & 0x3F);
|
||||
c |= 0x80;
|
||||
rune >>= 6;
|
||||
b = (uint8_t) (rune & 0x07);
|
||||
b |= 0xF0;
|
||||
n = 4;
|
||||
|
||||
done:
|
||||
encoded[0] = b;
|
||||
if (n > 1)
|
||||
encoded[1] = c;
|
||||
if (n > 2)
|
||||
encoded[2] = d;
|
||||
if (n > 3)
|
||||
encoded[3] = e;
|
||||
return n;
|
||||
}
|
||||
|
||||
const char *uiprivUTF8DecodeRune(const char *s, size_t nElem, uint32_t *rune)
|
||||
{
|
||||
uint8_t b, c;
|
||||
uint8_t lowestAllowed, highestAllowed;
|
||||
size_t i, expected;
|
||||
int bad;
|
||||
|
||||
b = (uint8_t) (*s);
|
||||
if (b < 0x80) { // ASCII bytes represent themselves
|
||||
*rune = b;
|
||||
s++;
|
||||
return s;
|
||||
}
|
||||
// 0xC0 and 0xC1 cover 2-byte overlong equivalents
|
||||
// 0xF5 to 0xFD cover values > 0x10FFFF
|
||||
// 0xFE and 0xFF were never defined (always illegal)
|
||||
if (b < 0xC2 || b > 0xF4) { // invalid
|
||||
*rune = badrune;
|
||||
s++;
|
||||
return s;
|
||||
}
|
||||
|
||||
// this determines the range of allowed first continuation bytes
|
||||
lowestAllowed = 0x80;
|
||||
highestAllowed = 0xBF;
|
||||
switch (b) {
|
||||
case 0xE0:
|
||||
// disallow 3-byte overlong equivalents
|
||||
lowestAllowed = 0xA0;
|
||||
break;
|
||||
case 0xED:
|
||||
// disallow surrogate characters
|
||||
highestAllowed = 0x9F;
|
||||
break;
|
||||
case 0xF0:
|
||||
// disallow 4-byte overlong equivalents
|
||||
lowestAllowed = 0x90;
|
||||
break;
|
||||
case 0xF4:
|
||||
// disallow values > 0x10FFFF
|
||||
highestAllowed = 0x8F;
|
||||
break;
|
||||
}
|
||||
|
||||
// and this determines how many continuation bytes are expected
|
||||
expected = 1;
|
||||
if (b >= 0xE0)
|
||||
expected++;
|
||||
if (b >= 0xF0)
|
||||
expected++;
|
||||
if (nElem != 0) { // are there enough bytes?
|
||||
nElem--;
|
||||
if (nElem < expected) { // nope
|
||||
*rune = badrune;
|
||||
s++;
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
// ensure that everything is correct
|
||||
// if not, **only** consume the initial byte
|
||||
bad = 0;
|
||||
for (i = 0; i < expected; i++) {
|
||||
c = (uint8_t) (s[1 + i]);
|
||||
if (c < lowestAllowed || c > highestAllowed) {
|
||||
bad = 1;
|
||||
break;
|
||||
}
|
||||
// the old lowestAllowed and highestAllowed is only for the first continuation byte
|
||||
lowestAllowed = 0x80;
|
||||
highestAllowed = 0xBF;
|
||||
}
|
||||
if (bad) {
|
||||
*rune = badrune;
|
||||
s++;
|
||||
return s;
|
||||
}
|
||||
|
||||
// now do the topmost bits
|
||||
if (b < 0xE0)
|
||||
*rune = b & 0x1F;
|
||||
else if (b < 0xF0)
|
||||
*rune = b & 0x0F;
|
||||
else
|
||||
*rune = b & 0x07;
|
||||
s++; // we can finally move on
|
||||
|
||||
// now do the continuation bytes
|
||||
for (; expected; expected--) {
|
||||
c = (uint8_t) (*s);
|
||||
s++;
|
||||
c &= 0x3F; // strip continuation bits
|
||||
*rune <<= 6;
|
||||
*rune |= c;
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
// encoded must have at most 2 elements
|
||||
size_t uiprivUTF16EncodeRune(uint32_t rune, uint16_t *encoded)
|
||||
{
|
||||
uint16_t low, high;
|
||||
|
||||
// not in the valid range for Unicode
|
||||
if (rune > 0x10FFFF)
|
||||
rune = badrune;
|
||||
// surrogate runes cannot be encoded
|
||||
if (rune >= 0xD800 && rune < 0xE000)
|
||||
rune = badrune;
|
||||
|
||||
if (rune < 0x10000) {
|
||||
encoded[0] = (uint16_t) rune;
|
||||
return 1;
|
||||
}
|
||||
|
||||
rune -= 0x10000;
|
||||
low = (uint16_t) (rune & 0x3FF);
|
||||
rune >>= 10;
|
||||
high = (uint16_t) (rune & 0x3FF);
|
||||
encoded[0] = high | 0xD800;
|
||||
encoded[1] = low | 0xDC00;
|
||||
return 2;
|
||||
}
|
||||
|
||||
// TODO see if this can be cleaned up somehow
|
||||
const uint16_t *uiprivUTF16DecodeRune(const uint16_t *s, size_t nElem, uint32_t *rune)
|
||||
{
|
||||
uint16_t high, low;
|
||||
|
||||
if (*s < 0xD800 || *s >= 0xE000) {
|
||||
// self-representing character
|
||||
*rune = *s;
|
||||
s++;
|
||||
return s;
|
||||
}
|
||||
if (*s >= 0xDC00) {
|
||||
// out-of-order surrogates
|
||||
*rune = badrune;
|
||||
s++;
|
||||
return s;
|
||||
}
|
||||
if (nElem == 1) { // not enough elements
|
||||
*rune = badrune;
|
||||
s++;
|
||||
return s;
|
||||
}
|
||||
high = *s;
|
||||
high &= 0x3FF;
|
||||
if (s[1] < 0xDC00 || s[1] >= 0xE000) {
|
||||
// bad surrogate pair
|
||||
*rune = badrune;
|
||||
s++;
|
||||
return s;
|
||||
}
|
||||
s++;
|
||||
low = *s;
|
||||
s++;
|
||||
low &= 0x3FF;
|
||||
*rune = high;
|
||||
*rune <<= 10;
|
||||
*rune |= low;
|
||||
*rune += 0x10000;
|
||||
return s;
|
||||
}
|
||||
|
||||
// TODO find a way to reduce the code in all of these somehow
|
||||
// TODO find a way to remove u as well
|
||||
size_t uiprivUTF8RuneCount(const char *s, size_t nElem)
|
||||
{
|
||||
size_t len;
|
||||
uint32_t rune;
|
||||
|
||||
if (nElem != 0) {
|
||||
const char *t, *u;
|
||||
|
||||
len = 0;
|
||||
t = s;
|
||||
while (nElem != 0) {
|
||||
u = uiprivUTF8DecodeRune(t, nElem, &rune);
|
||||
len++;
|
||||
nElem -= u - t;
|
||||
t = u;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
len = 0;
|
||||
while (*s) {
|
||||
s = uiprivUTF8DecodeRune(s, nElem, &rune);
|
||||
len++;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
size_t uiprivUTF8UTF16Count(const char *s, size_t nElem)
|
||||
{
|
||||
size_t len;
|
||||
uint32_t rune;
|
||||
uint16_t encoded[2];
|
||||
|
||||
if (nElem != 0) {
|
||||
const char *t, *u;
|
||||
|
||||
len = 0;
|
||||
t = s;
|
||||
while (nElem != 0) {
|
||||
u = uiprivUTF8DecodeRune(t, nElem, &rune);
|
||||
len += uiprivUTF16EncodeRune(rune, encoded);
|
||||
nElem -= u - t;
|
||||
t = u;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
len = 0;
|
||||
while (*s) {
|
||||
s = uiprivUTF8DecodeRune(s, nElem, &rune);
|
||||
len += uiprivUTF16EncodeRune(rune, encoded);
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
size_t uiprivUTF16RuneCount(const uint16_t *s, size_t nElem)
|
||||
{
|
||||
size_t len;
|
||||
uint32_t rune;
|
||||
|
||||
if (nElem != 0) {
|
||||
const uint16_t *t, *u;
|
||||
|
||||
len = 0;
|
||||
t = s;
|
||||
while (nElem != 0) {
|
||||
u = uiprivUTF16DecodeRune(t, nElem, &rune);
|
||||
len++;
|
||||
nElem -= u - t;
|
||||
t = u;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
len = 0;
|
||||
while (*s) {
|
||||
s = uiprivUTF16DecodeRune(s, nElem, &rune);
|
||||
len++;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
size_t uiprivUTF16UTF8Count(const uint16_t *s, size_t nElem)
|
||||
{
|
||||
size_t len;
|
||||
uint32_t rune;
|
||||
char encoded[4];
|
||||
|
||||
if (nElem != 0) {
|
||||
const uint16_t *t, *u;
|
||||
|
||||
len = 0;
|
||||
t = s;
|
||||
while (nElem != 0) {
|
||||
u = uiprivUTF16DecodeRune(t, nElem, &rune);
|
||||
len += uiprivUTF8EncodeRune(rune, encoded);
|
||||
nElem -= u - t;
|
||||
t = u;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
len = 0;
|
||||
while (*s) {
|
||||
s = uiprivUTF16DecodeRune(s, nElem, &rune);
|
||||
len += uiprivUTF8EncodeRune(rune, encoded);
|
||||
}
|
||||
return len;
|
||||
}
|
||||
105
dep/libui/common/utf.h
Normal file
105
dep/libui/common/utf.h
Normal file
@@ -0,0 +1,105 @@
|
||||
// utf by pietro gagliardi (andlabs) — https://github.com/andlabs/utf/
|
||||
// 10 november 2016
|
||||
|
||||
// note the overridden names with uipriv at the beginning; this avoids potential symbol clashes when building libui as a static library
|
||||
// LONGTERM find a way to encode the name overrides directly into the utf library
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// TODO (for utf itself as well) should this go outside the extern "C" block or not
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
// if nElem == 0, assume the buffer has no upper limit and is '\0' terminated
|
||||
// otherwise, assume buffer is NOT '\0' terminated but is bounded by nElem *elements*
|
||||
|
||||
extern size_t uiprivUTF8EncodeRune(uint32_t rune, char *encoded);
|
||||
extern const char *uiprivUTF8DecodeRune(const char *s, size_t nElem, uint32_t *rune);
|
||||
extern size_t uiprivUTF16EncodeRune(uint32_t rune, uint16_t *encoded);
|
||||
extern const uint16_t *uiprivUTF16DecodeRune(const uint16_t *s, size_t nElem, uint32_t *rune);
|
||||
|
||||
extern size_t uiprivUTF8RuneCount(const char *s, size_t nElem);
|
||||
extern size_t uiprivUTF8UTF16Count(const char *s, size_t nElem);
|
||||
extern size_t uiprivUTF16RuneCount(const uint16_t *s, size_t nElem);
|
||||
extern size_t uiprivUTF16UTF8Count(const uint16_t *s, size_t nElem);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
// TODO sync this back to upstream (need copyright clearance first)
|
||||
|
||||
// On Windows, wchar_t is equivalent to uint16_t, but C++ requires
|
||||
// wchar_t to be a completely distinct type. These overloads allow
|
||||
// passing wchar_t pointers directly into these functions from C++
|
||||
// on Windows. Otherwise, you'd need to cast to pass a wchar_t
|
||||
// pointer, WCHAR pointer, or equivalent to these functions.
|
||||
//
|
||||
// This does not apply to MSVC because the situation there is
|
||||
// slightly more complicated; see below.
|
||||
#if defined(_WIN32) && !defined(_MSC_VER)
|
||||
|
||||
inline size_t uiprivUTF16EncodeRune(uint32_t rune, wchar_t *encoded)
|
||||
{
|
||||
return uiprivUTF16EncodeRune(rune, reinterpret_cast<uint16_t *>(encoded));
|
||||
}
|
||||
|
||||
inline const wchar_t *uiprivUTF16DecodeRune(const wchar_t *s, size_t nElem, uint32_t *rune)
|
||||
{
|
||||
const uint16_t *ret;
|
||||
|
||||
ret = uiprivUTF16DecodeRune(reinterpret_cast<const uint16_t *>(s), nElem, rune);
|
||||
return reinterpret_cast<const wchar_t *>(ret);
|
||||
}
|
||||
|
||||
inline size_t uiprivUTF16RuneCount(const wchar_t *s, size_t nElem)
|
||||
{
|
||||
return uiprivUTF16RuneCount(reinterpret_cast<const uint16_t *>(s), nElem);
|
||||
}
|
||||
|
||||
inline size_t uiprivUTF16UTF8Count(const wchar_t *s, size_t nElem)
|
||||
{
|
||||
return uiprivUTF16UTF8Count(reinterpret_cast<const uint16_t *>(s), nElem);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// This is the same as the above, except that with MSVC, whether
|
||||
// wchar_t is a keyword or not is controlled by a compiler option!
|
||||
// (At least with gcc, this is not the case; thanks redi in
|
||||
// irc.freenode.net/#gcc.) We use __wchar_t to be independent of
|
||||
// the option; see https://blogs.msdn.microsoft.com/oldnewthing/20161201-00/?p=94836
|
||||
// (ironically posted one day after I initially wrote this code!).
|
||||
// TODO should defined(_WIN32) be used too?
|
||||
// TODO check this under /Wall
|
||||
// TODO are C-style casts enough? or will that fail in /Wall?
|
||||
// TODO same for UniChar/unichar on Mac? if both are unsigned then we have nothing to worry about
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
inline size_t uiprivUTF16EncodeRune(uint32_t rune, __wchar_t *encoded)
|
||||
{
|
||||
return uiprivUTF16EncodeRune(rune, reinterpret_cast<uint16_t *>(encoded));
|
||||
}
|
||||
|
||||
inline const __wchar_t *uiprivUTF16DecodeRune(const __wchar_t *s, size_t nElem, uint32_t *rune)
|
||||
{
|
||||
const uint16_t *ret;
|
||||
|
||||
ret = uiprivUTF16DecodeRune(reinterpret_cast<const uint16_t *>(s), nElem, rune);
|
||||
return reinterpret_cast<const __wchar_t *>(ret);
|
||||
}
|
||||
|
||||
inline size_t uiprivUTF16RuneCount(const __wchar_t *s, size_t nElem)
|
||||
{
|
||||
return uiprivUTF16RuneCount(reinterpret_cast<const uint16_t *>(s), nElem);
|
||||
}
|
||||
|
||||
inline size_t uiprivUTF16UTF8Count(const __wchar_t *s, size_t nElem)
|
||||
{
|
||||
return uiprivUTF16UTF8Count(reinterpret_cast<const uint16_t *>(s), nElem);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
39
dep/libui/darwin/OLD_table.m
Normal file
39
dep/libui/darwin/OLD_table.m
Normal file
@@ -0,0 +1,39 @@
|
||||
// 21 june 2016
|
||||
#import "uipriv_darwin.h"
|
||||
|
||||
// TODOs
|
||||
// - header cell seems off
|
||||
// - background color shows up for a line or two below selection
|
||||
// - editable NSTextFields have no intrinsic width
|
||||
// - is the Y position of checkbox cells correct?
|
||||
|
||||
@implementation tablePart
|
||||
|
||||
- (NSView *)mkView:(uiTableModel *)m row:(int)row
|
||||
{
|
||||
// if stretchy, don't hug, otherwise hug forcibly
|
||||
if (self.expand)
|
||||
[view setContentHuggingPriority:NSLayoutPriorityDefaultLow forOrientation:NSLayoutConstraintOrientationHorizontal];
|
||||
else
|
||||
[view setContentHuggingPriority:NSLayoutPriorityRequired forOrientation:NSLayoutConstraintOrientationHorizontal];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
uiTableColumn *uiTableAppendColumn(uiTable *t, const char *name)
|
||||
{
|
||||
uiTableColumn *c;
|
||||
|
||||
c = uiprivNew(uiTableColumn);
|
||||
c->c = [[tableColumn alloc] initWithIdentifier:@""];
|
||||
c->c.libui_col = c;
|
||||
// via Interface Builder
|
||||
[c->c setResizingMask:(NSTableColumnAutoresizingMask | NSTableColumnUserResizingMask)];
|
||||
// 10.10 adds -[NSTableColumn setTitle:]; before then we have to do this
|
||||
[[c->c headerCell] setStringValue:uiprivToNSString(name)];
|
||||
// TODO is this sufficient?
|
||||
[[c->c headerCell] setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]]];
|
||||
c->parts = [NSMutableArray new];
|
||||
[t->tv addTableColumn:c->c];
|
||||
return c;
|
||||
}
|
||||
403
dep/libui/darwin/aat.m
Normal file
403
dep/libui/darwin/aat.m
Normal file
@@ -0,0 +1,403 @@
|
||||
// 14 february 2017
|
||||
#import "uipriv_darwin.h"
|
||||
#import "attrstr.h"
|
||||
|
||||
// TODO explain the purpose of this file
|
||||
|
||||
static void boolspec(uint32_t value, uint16_t type, uint16_t ifTrue, uint16_t ifFalse, uiprivAATBlock f)
|
||||
{
|
||||
// TODO are values other than 1 accepted for true by OpenType itself? (same for the rest of the file)
|
||||
if (value != 0) {
|
||||
f(type, ifTrue);
|
||||
return;
|
||||
}
|
||||
f(type, ifFalse);
|
||||
}
|
||||
|
||||
// TODO remove the need for this
|
||||
// TODO remove x8tox32()
|
||||
#define x8tox32(x) ((uint32_t) (((uint8_t) (x)) & 0xFF))
|
||||
#define mkTag(a, b, c, d) \
|
||||
((x8tox32(a) << 24) | \
|
||||
(x8tox32(b) << 16) | \
|
||||
(x8tox32(c) << 8) | \
|
||||
x8tox32(d))
|
||||
|
||||
// TODO double-check drawtext example to make sure all of these are used properly (I already screwed dlig up by putting clig twice instead)
|
||||
void uiprivOpenTypeToAAT(char a, char b, char c, char d, uint32_t value, uiprivAATBlock f)
|
||||
{
|
||||
switch (mkTag(a, b, c, d)) {
|
||||
case mkTag('l', 'i', 'g', 'a'):
|
||||
boolspec(value, kLigaturesType,
|
||||
kCommonLigaturesOnSelector,
|
||||
kCommonLigaturesOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('r', 'l', 'i', 'g'):
|
||||
boolspec(value, kLigaturesType,
|
||||
kRequiredLigaturesOnSelector,
|
||||
kRequiredLigaturesOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('d', 'l', 'i', 'g'):
|
||||
boolspec(value, kLigaturesType,
|
||||
kRareLigaturesOnSelector,
|
||||
kRareLigaturesOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('c', 'l', 'i', 'g'):
|
||||
boolspec(value, kLigaturesType,
|
||||
kContextualLigaturesOnSelector,
|
||||
kContextualLigaturesOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('h', 'l', 'i', 'g'):
|
||||
// This technically isn't what is meant by "historical ligatures", but Core Text's internal AAT-to-OpenType mapping says to include it, so we include it too
|
||||
case mkTag('h', 'i', 's', 't'):
|
||||
boolspec(value, kLigaturesType,
|
||||
kHistoricalLigaturesOnSelector,
|
||||
kHistoricalLigaturesOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('u', 'n', 'i', 'c'):
|
||||
// TODO is this correct, or should we provide an else case?
|
||||
if (value != 0)
|
||||
// this is undocumented; it comes from Core Text's internal AAT-to-OpenType conversion table
|
||||
f(kLetterCaseType, 14);
|
||||
break;
|
||||
|
||||
// TODO will the following handle all cases properly, or are elses going to be needed?
|
||||
case mkTag('p', 'n', 'u', 'm'):
|
||||
if (value != 0)
|
||||
f(kNumberSpacingType, kProportionalNumbersSelector);
|
||||
break;
|
||||
case mkTag('t', 'n', 'u', 'm'):
|
||||
if (value != 0)
|
||||
f(kNumberSpacingType, kMonospacedNumbersSelector);
|
||||
break;
|
||||
|
||||
// TODO will the following handle all cases properly, or are elses going to be needed?
|
||||
case mkTag('s', 'u', 'p', 's'):
|
||||
if (value != 0)
|
||||
f(kVerticalPositionType, kSuperiorsSelector);
|
||||
break;
|
||||
case mkTag('s', 'u', 'b', 's'):
|
||||
if (value != 0)
|
||||
f(kVerticalPositionType, kInferiorsSelector);
|
||||
break;
|
||||
case mkTag('o', 'r', 'd', 'n'):
|
||||
if (value != 0)
|
||||
f(kVerticalPositionType, kOrdinalsSelector);
|
||||
break;
|
||||
case mkTag('s', 'i', 'n', 'f'):
|
||||
if (value != 0)
|
||||
f(kVerticalPositionType, kScientificInferiorsSelector);
|
||||
break;
|
||||
|
||||
// TODO will the following handle all cases properly, or are elses going to be needed?
|
||||
case mkTag('a', 'f', 'r', 'c'):
|
||||
if (value != 0)
|
||||
f(kFractionsType, kVerticalFractionsSelector);
|
||||
break;
|
||||
case mkTag('f', 'r', 'a', 'c'):
|
||||
if (value != 0)
|
||||
f(kFractionsType, kDiagonalFractionsSelector);
|
||||
break;
|
||||
|
||||
case mkTag('z', 'e', 'r', 'o'):
|
||||
boolspec(value, kTypographicExtrasType,
|
||||
kSlashedZeroOnSelector,
|
||||
kSlashedZeroOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('m', 'g', 'r', 'k'):
|
||||
boolspec(value, kMathematicalExtrasType,
|
||||
kMathematicalGreekOnSelector,
|
||||
kMathematicalGreekOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('o', 'r', 'n', 'm'):
|
||||
f(kOrnamentSetsType, (uint16_t) value);
|
||||
break;
|
||||
case mkTag('a', 'a', 'l', 't'):
|
||||
f(kCharacterAlternativesType, (uint16_t) value);
|
||||
break;
|
||||
case mkTag('t', 'i', 't', 'l'):
|
||||
// TODO is this correct, or should we provide an else case?
|
||||
if (value != 0)
|
||||
f(kStyleOptionsType, kTitlingCapsSelector);
|
||||
break;
|
||||
|
||||
// TODO will the following handle all cases properly, or are elses going to be needed?
|
||||
case mkTag('t', 'r', 'a', 'd'):
|
||||
if (value != 0)
|
||||
f(kCharacterShapeType, kTraditionalCharactersSelector);
|
||||
break;
|
||||
case mkTag('s', 'm', 'p', 'l'):
|
||||
if (value != 0)
|
||||
f(kCharacterShapeType, kSimplifiedCharactersSelector);
|
||||
break;
|
||||
case mkTag('j', 'p', '7', '8'):
|
||||
if (value != 0)
|
||||
f(kCharacterShapeType, kJIS1978CharactersSelector);
|
||||
break;
|
||||
case mkTag('j', 'p', '8', '3'):
|
||||
if (value != 0)
|
||||
f(kCharacterShapeType, kJIS1983CharactersSelector);
|
||||
break;
|
||||
case mkTag('j', 'p', '9', '0'):
|
||||
if (value != 0)
|
||||
f(kCharacterShapeType, kJIS1990CharactersSelector);
|
||||
break;
|
||||
case mkTag('e', 'x', 'p', 't'):
|
||||
if (value != 0)
|
||||
f(kCharacterShapeType, kExpertCharactersSelector);
|
||||
break;
|
||||
case mkTag('j', 'p', '0', '4'):
|
||||
if (value != 0)
|
||||
f(kCharacterShapeType, kJIS2004CharactersSelector);
|
||||
break;
|
||||
case mkTag('h', 'o', 'j', 'o'):
|
||||
if (value != 0)
|
||||
f(kCharacterShapeType, kHojoCharactersSelector);
|
||||
break;
|
||||
case mkTag('n', 'l', 'c', 'k'):
|
||||
if (value != 0)
|
||||
f(kCharacterShapeType, kNLCCharactersSelector);
|
||||
break;
|
||||
case mkTag('t', 'n', 'a', 'm'):
|
||||
if (value != 0)
|
||||
f(kCharacterShapeType, kTraditionalNamesCharactersSelector);
|
||||
break;
|
||||
|
||||
case mkTag('o', 'n', 'u', 'm'):
|
||||
// Core Text's internal AAT-to-OpenType mapping says to include this, so we include it too
|
||||
// TODO is it always set?
|
||||
case mkTag('l', 'n', 'u', 'm'):
|
||||
// TODO is this correct, or should we provide an else case?
|
||||
if (value != 0)
|
||||
f(kNumberCaseType, kLowerCaseNumbersSelector);
|
||||
break;
|
||||
case mkTag('h', 'n', 'g', 'l'):
|
||||
// TODO is this correct, or should we provide an else case?
|
||||
if (value != 0)
|
||||
f(kTransliterationType, kHanjaToHangulSelector);
|
||||
break;
|
||||
case mkTag('n', 'a', 'l', 't'):
|
||||
f(kAnnotationType, (uint16_t) value);
|
||||
break;
|
||||
case mkTag('r', 'u', 'b', 'y'):
|
||||
// include this for completeness
|
||||
boolspec(value, kRubyKanaType,
|
||||
kRubyKanaSelector,
|
||||
kNoRubyKanaSelector,
|
||||
f);
|
||||
// this is the current one
|
||||
boolspec(value, kRubyKanaType,
|
||||
kRubyKanaOnSelector,
|
||||
kRubyKanaOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('i', 't', 'a', 'l'):
|
||||
// include this for completeness
|
||||
boolspec(value, kItalicCJKRomanType,
|
||||
kCJKItalicRomanSelector,
|
||||
kNoCJKItalicRomanSelector,
|
||||
f);
|
||||
// this is the current one
|
||||
boolspec(value, kItalicCJKRomanType,
|
||||
kCJKItalicRomanOnSelector,
|
||||
kCJKItalicRomanOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('c', 'a', 's', 'e'):
|
||||
boolspec(value, kCaseSensitiveLayoutType,
|
||||
kCaseSensitiveLayoutOnSelector,
|
||||
kCaseSensitiveLayoutOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('c', 'p', 's', 'p'):
|
||||
boolspec(value, kCaseSensitiveLayoutType,
|
||||
kCaseSensitiveSpacingOnSelector,
|
||||
kCaseSensitiveSpacingOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('h', 'k', 'n', 'a'):
|
||||
boolspec(value, kAlternateKanaType,
|
||||
kAlternateHorizKanaOnSelector,
|
||||
kAlternateHorizKanaOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('v', 'k', 'n', 'a'):
|
||||
boolspec(value, kAlternateKanaType,
|
||||
kAlternateVertKanaOnSelector,
|
||||
kAlternateVertKanaOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('s', 's', '0', '1'):
|
||||
boolspec(value, kStylisticAlternativesType,
|
||||
kStylisticAltOneOnSelector,
|
||||
kStylisticAltOneOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('s', 's', '0', '2'):
|
||||
boolspec(value, kStylisticAlternativesType,
|
||||
kStylisticAltTwoOnSelector,
|
||||
kStylisticAltTwoOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('s', 's', '0', '3'):
|
||||
boolspec(value, kStylisticAlternativesType,
|
||||
kStylisticAltThreeOnSelector,
|
||||
kStylisticAltThreeOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('s', 's', '0', '4'):
|
||||
boolspec(value, kStylisticAlternativesType,
|
||||
kStylisticAltFourOnSelector,
|
||||
kStylisticAltFourOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('s', 's', '0', '5'):
|
||||
boolspec(value, kStylisticAlternativesType,
|
||||
kStylisticAltFiveOnSelector,
|
||||
kStylisticAltFiveOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('s', 's', '0', '6'):
|
||||
boolspec(value, kStylisticAlternativesType,
|
||||
kStylisticAltSixOnSelector,
|
||||
kStylisticAltSixOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('s', 's', '0', '7'):
|
||||
boolspec(value, kStylisticAlternativesType,
|
||||
kStylisticAltSevenOnSelector,
|
||||
kStylisticAltSevenOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('s', 's', '0', '8'):
|
||||
boolspec(value, kStylisticAlternativesType,
|
||||
kStylisticAltEightOnSelector,
|
||||
kStylisticAltEightOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('s', 's', '0', '9'):
|
||||
boolspec(value, kStylisticAlternativesType,
|
||||
kStylisticAltNineOnSelector,
|
||||
kStylisticAltNineOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('s', 's', '1', '0'):
|
||||
boolspec(value, kStylisticAlternativesType,
|
||||
kStylisticAltTenOnSelector,
|
||||
kStylisticAltTenOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('s', 's', '1', '1'):
|
||||
boolspec(value, kStylisticAlternativesType,
|
||||
kStylisticAltElevenOnSelector,
|
||||
kStylisticAltElevenOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('s', 's', '1', '2'):
|
||||
boolspec(value, kStylisticAlternativesType,
|
||||
kStylisticAltTwelveOnSelector,
|
||||
kStylisticAltTwelveOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('s', 's', '1', '3'):
|
||||
boolspec(value, kStylisticAlternativesType,
|
||||
kStylisticAltThirteenOnSelector,
|
||||
kStylisticAltThirteenOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('s', 's', '1', '4'):
|
||||
boolspec(value, kStylisticAlternativesType,
|
||||
kStylisticAltFourteenOnSelector,
|
||||
kStylisticAltFourteenOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('s', 's', '1', '5'):
|
||||
boolspec(value, kStylisticAlternativesType,
|
||||
kStylisticAltFifteenOnSelector,
|
||||
kStylisticAltFifteenOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('s', 's', '1', '6'):
|
||||
boolspec(value, kStylisticAlternativesType,
|
||||
kStylisticAltSixteenOnSelector,
|
||||
kStylisticAltSixteenOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('s', 's', '1', '7'):
|
||||
boolspec(value, kStylisticAlternativesType,
|
||||
kStylisticAltSeventeenOnSelector,
|
||||
kStylisticAltSeventeenOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('s', 's', '1', '8'):
|
||||
boolspec(value, kStylisticAlternativesType,
|
||||
kStylisticAltEighteenOnSelector,
|
||||
kStylisticAltEighteenOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('s', 's', '1', '9'):
|
||||
boolspec(value, kStylisticAlternativesType,
|
||||
kStylisticAltNineteenOnSelector,
|
||||
kStylisticAltNineteenOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('s', 's', '2', '0'):
|
||||
boolspec(value, kStylisticAlternativesType,
|
||||
kStylisticAltTwentyOnSelector,
|
||||
kStylisticAltTwentyOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('c', 'a', 'l', 't'):
|
||||
boolspec(value, kContextualAlternatesType,
|
||||
kContextualAlternatesOnSelector,
|
||||
kContextualAlternatesOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('s', 'w', 's', 'h'):
|
||||
boolspec(value, kContextualAlternatesType,
|
||||
kSwashAlternatesOnSelector,
|
||||
kSwashAlternatesOffSelector,
|
||||
f);
|
||||
break;
|
||||
case mkTag('c', 's', 'w', 'h'):
|
||||
boolspec(value, kContextualAlternatesType,
|
||||
kContextualSwashAlternatesOnSelector,
|
||||
kContextualSwashAlternatesOffSelector,
|
||||
f);
|
||||
break;
|
||||
|
||||
// TODO will the following handle all cases properly, or are elses going to be needed?
|
||||
case mkTag('s', 'm', 'c', 'p'):
|
||||
if (value != 0) {
|
||||
// include this for compatibility (some fonts that come with OS X still use this!)
|
||||
// TODO make it boolean?
|
||||
f(kLetterCaseType, kSmallCapsSelector);
|
||||
// this is the current one
|
||||
f(kLowerCaseType, kLowerCaseSmallCapsSelector);
|
||||
}
|
||||
break;
|
||||
case mkTag('p', 'c', 'a', 'p'):
|
||||
if (value != 0)
|
||||
f(kLowerCaseType, kLowerCasePetiteCapsSelector);
|
||||
break;
|
||||
|
||||
// TODO will the following handle all cases properly, or are elses going to be needed?
|
||||
case mkTag('c', '2', 's', 'c'):
|
||||
if (value != 0)
|
||||
f(kUpperCaseType, kUpperCaseSmallCapsSelector);
|
||||
break;
|
||||
case mkTag('c', '2', 'p', 'c'):
|
||||
if (value != 0)
|
||||
f(kUpperCaseType, kUpperCasePetiteCapsSelector);
|
||||
break;
|
||||
}
|
||||
// TODO handle this properly
|
||||
// (it used to return 0 when this still returned the number of selectors produced but IDK what properly is anymore)
|
||||
}
|
||||
89
dep/libui/darwin/alloc.m
Normal file
89
dep/libui/darwin/alloc.m
Normal file
@@ -0,0 +1,89 @@
|
||||
// 4 december 2014
|
||||
#import <stdlib.h>
|
||||
#import "uipriv_darwin.h"
|
||||
|
||||
static NSMutableArray *allocations;
|
||||
NSMutableArray *uiprivDelegates;
|
||||
|
||||
void uiprivInitAlloc(void)
|
||||
{
|
||||
allocations = [NSMutableArray new];
|
||||
uiprivDelegates = [NSMutableArray new];
|
||||
}
|
||||
|
||||
#define UINT8(p) ((uint8_t *) (p))
|
||||
#define PVOID(p) ((void *) (p))
|
||||
#define EXTRA (sizeof (size_t) + sizeof (const char **))
|
||||
#define DATA(p) PVOID(UINT8(p) + EXTRA)
|
||||
#define BASE(p) PVOID(UINT8(p) - EXTRA)
|
||||
#define SIZE(p) ((size_t *) (p))
|
||||
#define CCHAR(p) ((const char **) (p))
|
||||
#define TYPE(p) CCHAR(UINT8(p) + sizeof (size_t))
|
||||
|
||||
void uiprivUninitAlloc(void)
|
||||
{
|
||||
NSMutableString *str;
|
||||
NSValue *v;
|
||||
|
||||
[uiprivDelegates release];
|
||||
if ([allocations count] == 0) {
|
||||
[allocations release];
|
||||
return;
|
||||
}
|
||||
str = [NSMutableString new];
|
||||
for (v in allocations) {
|
||||
void *ptr;
|
||||
|
||||
ptr = [v pointerValue];
|
||||
[str appendString:[NSString stringWithFormat:@"%p %s\n", ptr, *TYPE(ptr)]];
|
||||
}
|
||||
uiprivUserBug("Some data was leaked; either you left a uiControl lying around or there's a bug in libui itself. Leaked data:\n%s", [str UTF8String]);
|
||||
[str release];
|
||||
}
|
||||
|
||||
void *uiprivAlloc(size_t size, const char *type)
|
||||
{
|
||||
void *out;
|
||||
|
||||
out = malloc(EXTRA + size);
|
||||
if (out == NULL) {
|
||||
fprintf(stderr, "memory exhausted in uiAlloc()\n");
|
||||
abort();
|
||||
}
|
||||
memset(DATA(out), 0, size);
|
||||
*SIZE(out) = size;
|
||||
*TYPE(out) = type;
|
||||
[allocations addObject:[NSValue valueWithPointer:out]];
|
||||
return DATA(out);
|
||||
}
|
||||
|
||||
void *uiprivRealloc(void *p, size_t new, const char *type)
|
||||
{
|
||||
void *out;
|
||||
size_t *s;
|
||||
|
||||
if (p == NULL)
|
||||
return uiprivAlloc(new, type);
|
||||
p = BASE(p);
|
||||
out = realloc(p, EXTRA + new);
|
||||
if (out == NULL) {
|
||||
fprintf(stderr, "memory exhausted in uiprivRealloc()\n");
|
||||
abort();
|
||||
}
|
||||
s = SIZE(out);
|
||||
if (new > *s)
|
||||
memset(((uint8_t *) DATA(out)) + *s, 0, new - *s);
|
||||
*s = new;
|
||||
[allocations removeObject:[NSValue valueWithPointer:p]];
|
||||
[allocations addObject:[NSValue valueWithPointer:out]];
|
||||
return DATA(out);
|
||||
}
|
||||
|
||||
void uiprivFree(void *p)
|
||||
{
|
||||
if (p == NULL)
|
||||
uiprivImplBug("attempt to uiprivFree(NULL)");
|
||||
p = BASE(p);
|
||||
free(p);
|
||||
[allocations removeObject:[NSValue valueWithPointer:p]];
|
||||
}
|
||||
474
dep/libui/darwin/area.m
Normal file
474
dep/libui/darwin/area.m
Normal file
@@ -0,0 +1,474 @@
|
||||
// 9 september 2015
|
||||
#import "uipriv_darwin.h"
|
||||
|
||||
// 10.8 fixups
|
||||
#define NSEventModifierFlags NSUInteger
|
||||
|
||||
@interface areaView : NSView {
|
||||
uiArea *libui_a;
|
||||
NSTrackingArea *libui_ta;
|
||||
NSSize libui_ss;
|
||||
BOOL libui_enabled;
|
||||
}
|
||||
- (id)initWithFrame:(NSRect)r area:(uiArea *)a;
|
||||
- (uiModifiers)parseModifiers:(NSEvent *)e;
|
||||
- (void)doMouseEvent:(NSEvent *)e;
|
||||
- (int)sendKeyEvent:(uiAreaKeyEvent *)ke;
|
||||
- (int)doKeyDownUp:(NSEvent *)e up:(int)up;
|
||||
- (int)doKeyDown:(NSEvent *)e;
|
||||
- (int)doKeyUp:(NSEvent *)e;
|
||||
- (int)doFlagsChanged:(NSEvent *)e;
|
||||
- (void)setupNewTrackingArea;
|
||||
- (void)setScrollingSize:(NSSize)s;
|
||||
- (BOOL)isEnabled;
|
||||
- (void)setEnabled:(BOOL)e;
|
||||
@end
|
||||
|
||||
struct uiArea {
|
||||
uiDarwinControl c;
|
||||
NSView *view; // either sv or area depending on whether it is scrolling
|
||||
NSScrollView *sv;
|
||||
areaView *area;
|
||||
uiprivScrollViewData *d;
|
||||
uiAreaHandler *ah;
|
||||
BOOL scrolling;
|
||||
NSEvent *dragevent;
|
||||
};
|
||||
|
||||
@implementation areaView
|
||||
|
||||
- (id)initWithFrame:(NSRect)r area:(uiArea *)a
|
||||
{
|
||||
self = [super initWithFrame:r];
|
||||
if (self) {
|
||||
self->libui_a = a;
|
||||
[self setupNewTrackingArea];
|
||||
self->libui_ss = r.size;
|
||||
self->libui_enabled = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)drawRect:(NSRect)r
|
||||
{
|
||||
uiArea *a = self->libui_a;
|
||||
CGContextRef c;
|
||||
uiAreaDrawParams dp;
|
||||
|
||||
c = (CGContextRef) [[NSGraphicsContext currentContext] graphicsPort];
|
||||
// see draw.m under text for why we need the height
|
||||
dp.Context = uiprivDrawNewContext(c, [self bounds].size.height);
|
||||
|
||||
dp.AreaWidth = 0;
|
||||
dp.AreaHeight = 0;
|
||||
if (!a->scrolling) {
|
||||
dp.AreaWidth = [self frame].size.width;
|
||||
dp.AreaHeight = [self frame].size.height;
|
||||
}
|
||||
|
||||
dp.ClipX = r.origin.x;
|
||||
dp.ClipY = r.origin.y;
|
||||
dp.ClipWidth = r.size.width;
|
||||
dp.ClipHeight = r.size.height;
|
||||
|
||||
// no need to save or restore the graphics state to reset transformations; Cocoa creates a brand-new context each time
|
||||
(*(a->ah->Draw))(a->ah, a, &dp);
|
||||
|
||||
uiprivDrawFreeContext(dp.Context);
|
||||
}
|
||||
|
||||
- (BOOL)isFlipped
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)acceptsFirstResponder
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (uiModifiers)parseModifiers:(NSEvent *)e
|
||||
{
|
||||
NSEventModifierFlags mods;
|
||||
uiModifiers m;
|
||||
|
||||
m = 0;
|
||||
mods = [e modifierFlags];
|
||||
if ((mods & NSControlKeyMask) != 0)
|
||||
m |= uiModifierCtrl;
|
||||
if ((mods & NSAlternateKeyMask) != 0)
|
||||
m |= uiModifierAlt;
|
||||
if ((mods & NSShiftKeyMask) != 0)
|
||||
m |= uiModifierShift;
|
||||
if ((mods & NSCommandKeyMask) != 0)
|
||||
m |= uiModifierSuper;
|
||||
return m;
|
||||
}
|
||||
|
||||
- (void)setupNewTrackingArea
|
||||
{
|
||||
self->libui_ta = [[NSTrackingArea alloc] initWithRect:[self bounds]
|
||||
options:(NSTrackingMouseEnteredAndExited |
|
||||
NSTrackingMouseMoved |
|
||||
NSTrackingActiveAlways |
|
||||
NSTrackingInVisibleRect |
|
||||
NSTrackingEnabledDuringMouseDrag)
|
||||
owner:self
|
||||
userInfo:nil];
|
||||
[self addTrackingArea:self->libui_ta];
|
||||
}
|
||||
|
||||
- (void)updateTrackingAreas
|
||||
{
|
||||
[self removeTrackingArea:self->libui_ta];
|
||||
[self->libui_ta release];
|
||||
[self setupNewTrackingArea];
|
||||
}
|
||||
|
||||
// capture on drag is done automatically on OS X
|
||||
- (void)doMouseEvent:(NSEvent *)e
|
||||
{
|
||||
uiArea *a = self->libui_a;
|
||||
uiAreaMouseEvent me;
|
||||
NSPoint point;
|
||||
int buttonNumber;
|
||||
NSUInteger pmb;
|
||||
unsigned int i, max;
|
||||
|
||||
// this will convert point to drawing space
|
||||
// thanks swillits in irc.freenode.net/#macdev
|
||||
point = [self convertPoint:[e locationInWindow] fromView:nil];
|
||||
me.X = point.x;
|
||||
me.Y = point.y;
|
||||
|
||||
me.AreaWidth = 0;
|
||||
me.AreaHeight = 0;
|
||||
if (!a->scrolling) {
|
||||
me.AreaWidth = [self frame].size.width;
|
||||
me.AreaHeight = [self frame].size.height;
|
||||
}
|
||||
|
||||
buttonNumber = [e buttonNumber] + 1;
|
||||
// swap button numbers 2 and 3 (right and middle)
|
||||
if (buttonNumber == 2)
|
||||
buttonNumber = 3;
|
||||
else if (buttonNumber == 3)
|
||||
buttonNumber = 2;
|
||||
|
||||
me.Down = 0;
|
||||
me.Up = 0;
|
||||
me.Count = 0;
|
||||
switch ([e type]) {
|
||||
case NSLeftMouseDown:
|
||||
case NSRightMouseDown:
|
||||
case NSOtherMouseDown:
|
||||
me.Down = buttonNumber;
|
||||
me.Count = [e clickCount];
|
||||
break;
|
||||
case NSLeftMouseUp:
|
||||
case NSRightMouseUp:
|
||||
case NSOtherMouseUp:
|
||||
me.Up = buttonNumber;
|
||||
break;
|
||||
case NSLeftMouseDragged:
|
||||
case NSRightMouseDragged:
|
||||
case NSOtherMouseDragged:
|
||||
// we include the button that triggered the dragged event in the Held fields
|
||||
buttonNumber = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
me.Modifiers = [self parseModifiers:e];
|
||||
|
||||
pmb = [NSEvent pressedMouseButtons];
|
||||
me.Held1To64 = 0;
|
||||
if (buttonNumber != 1 && (pmb & 1) != 0)
|
||||
me.Held1To64 |= 1;
|
||||
if (buttonNumber != 2 && (pmb & 4) != 0)
|
||||
me.Held1To64 |= 2;
|
||||
if (buttonNumber != 3 && (pmb & 2) != 0)
|
||||
me.Held1To64 |= 4;
|
||||
// buttons 4..32
|
||||
// https://developer.apple.com/library/mac/documentation/Carbon/Reference/QuartzEventServicesRef/index.html#//apple_ref/c/tdef/CGMouseButton says Quartz only supports up to 32 buttons
|
||||
max = 32;
|
||||
for (i = 4; i <= max; i++) {
|
||||
uint64_t j;
|
||||
|
||||
if (buttonNumber == i)
|
||||
continue;
|
||||
j = 1 << (i - 1);
|
||||
if ((pmb & j) != 0)
|
||||
me.Held1To64 |= j;
|
||||
}
|
||||
|
||||
if (self->libui_enabled) {
|
||||
// and allow dragging here
|
||||
a->dragevent = e;
|
||||
(*(a->ah->MouseEvent))(a->ah, a, &me);
|
||||
a->dragevent = nil;
|
||||
}
|
||||
}
|
||||
|
||||
#define mouseEvent(name) \
|
||||
- (void)name:(NSEvent *)e \
|
||||
{ \
|
||||
[self doMouseEvent:e]; \
|
||||
}
|
||||
mouseEvent(mouseMoved)
|
||||
mouseEvent(mouseDragged)
|
||||
mouseEvent(rightMouseDragged)
|
||||
mouseEvent(otherMouseDragged)
|
||||
mouseEvent(mouseDown)
|
||||
mouseEvent(rightMouseDown)
|
||||
mouseEvent(otherMouseDown)
|
||||
mouseEvent(mouseUp)
|
||||
mouseEvent(rightMouseUp)
|
||||
mouseEvent(otherMouseUp)
|
||||
|
||||
- (void)mouseEntered:(NSEvent *)e
|
||||
{
|
||||
uiArea *a = self->libui_a;
|
||||
|
||||
if (self->libui_enabled)
|
||||
(*(a->ah->MouseCrossed))(a->ah, a, 0);
|
||||
}
|
||||
|
||||
- (void)mouseExited:(NSEvent *)e
|
||||
{
|
||||
uiArea *a = self->libui_a;
|
||||
|
||||
if (self->libui_enabled)
|
||||
(*(a->ah->MouseCrossed))(a->ah, a, 1);
|
||||
}
|
||||
|
||||
// note: there is no equivalent to WM_CAPTURECHANGED on Mac OS X; there literally is no way to break a grab like that
|
||||
// even if I invoke the task switcher and switch processes, the mouse grab will still be held until I let go of all buttons
|
||||
// therefore, no DragBroken()
|
||||
|
||||
- (int)sendKeyEvent:(uiAreaKeyEvent *)ke
|
||||
{
|
||||
uiArea *a = self->libui_a;
|
||||
|
||||
return (*(a->ah->KeyEvent))(a->ah, a, ke);
|
||||
}
|
||||
|
||||
- (int)doKeyDownUp:(NSEvent *)e up:(int)up
|
||||
{
|
||||
uiAreaKeyEvent ke;
|
||||
|
||||
ke.Key = 0;
|
||||
ke.ExtKey = 0;
|
||||
ke.Modifier = 0;
|
||||
|
||||
ke.Modifiers = [self parseModifiers:e];
|
||||
|
||||
ke.Up = up;
|
||||
|
||||
if (!uiprivFromKeycode([e keyCode], &ke))
|
||||
return 0;
|
||||
return [self sendKeyEvent:&ke];
|
||||
}
|
||||
|
||||
- (int)doKeyDown:(NSEvent *)e
|
||||
{
|
||||
return [self doKeyDownUp:e up:0];
|
||||
}
|
||||
|
||||
- (int)doKeyUp:(NSEvent *)e
|
||||
{
|
||||
return [self doKeyDownUp:e up:1];
|
||||
}
|
||||
|
||||
- (int)doFlagsChanged:(NSEvent *)e
|
||||
{
|
||||
uiAreaKeyEvent ke;
|
||||
uiModifiers whichmod;
|
||||
|
||||
ke.Key = 0;
|
||||
ke.ExtKey = 0;
|
||||
|
||||
// Mac OS X sends this event on both key up and key down.
|
||||
// Fortunately -[e keyCode] IS valid here, so we can simply map from key code to Modifiers, get the value of [e modifierFlags], and check if the respective bit is set or not — that will give us the up/down state
|
||||
if (!uiprivKeycodeModifier([e keyCode], &whichmod))
|
||||
return 0;
|
||||
ke.Modifier = whichmod;
|
||||
ke.Modifiers = [self parseModifiers:e];
|
||||
ke.Up = (ke.Modifiers & ke.Modifier) == 0;
|
||||
// and then drop the current modifier from Modifiers
|
||||
ke.Modifiers &= ~ke.Modifier;
|
||||
return [self sendKeyEvent:&ke];
|
||||
}
|
||||
|
||||
- (void)setFrameSize:(NSSize)size
|
||||
{
|
||||
uiArea *a = self->libui_a;
|
||||
|
||||
[super setFrameSize:size];
|
||||
if (!a->scrolling)
|
||||
// we must redraw everything on resize because Windows requires it
|
||||
[self setNeedsDisplay:YES];
|
||||
}
|
||||
|
||||
- (void)setScrollingSize:(NSSize)s
|
||||
{
|
||||
self->libui_ss = s;
|
||||
[self setFrameSize:s];
|
||||
}
|
||||
|
||||
- (NSSize)intrinsicContentSize
|
||||
{
|
||||
if (!self->libui_a->scrolling)
|
||||
return [super intrinsicContentSize];
|
||||
return self->libui_ss;
|
||||
}
|
||||
|
||||
- (BOOL)becomeFirstResponder
|
||||
{
|
||||
return [self isEnabled];
|
||||
}
|
||||
|
||||
- (BOOL)isEnabled
|
||||
{
|
||||
return self->libui_enabled;
|
||||
}
|
||||
|
||||
- (void)setEnabled:(BOOL)e
|
||||
{
|
||||
self->libui_enabled = e;
|
||||
if (!self->libui_enabled && [self window] != nil)
|
||||
if ([[self window] firstResponder] == self)
|
||||
[[self window] makeFirstResponder:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
uiDarwinControlAllDefaultsExceptDestroy(uiArea, view)
|
||||
|
||||
static void uiAreaDestroy(uiControl *c)
|
||||
{
|
||||
uiArea *a = uiArea(c);
|
||||
|
||||
if (a->scrolling)
|
||||
uiprivScrollViewFreeData(a->sv, a->d);
|
||||
[a->area release];
|
||||
if (a->scrolling)
|
||||
[a->sv release];
|
||||
uiFreeControl(uiControl(a));
|
||||
}
|
||||
|
||||
// called by subclasses of -[NSApplication sendEvent:]
|
||||
// by default, NSApplication eats some key events
|
||||
// this prevents that from happening with uiArea
|
||||
// see http://stackoverflow.com/questions/24099063/how-do-i-detect-keyup-in-my-nsview-with-the-command-key-held and http://lists.apple.com/archives/cocoa-dev/2003/Oct/msg00442.html
|
||||
int uiprivSendAreaEvents(NSEvent *e)
|
||||
{
|
||||
NSEventType type;
|
||||
id focused;
|
||||
areaView *view;
|
||||
|
||||
type = [e type];
|
||||
if (type != NSKeyDown && type != NSKeyUp && type != NSFlagsChanged)
|
||||
return 0;
|
||||
focused = [[e window] firstResponder];
|
||||
if (focused == nil)
|
||||
return 0;
|
||||
if (![focused isKindOfClass:[areaView class]])
|
||||
return 0;
|
||||
view = (areaView *) focused;
|
||||
switch (type) {
|
||||
case NSKeyDown:
|
||||
return [view doKeyDown:e];
|
||||
case NSKeyUp:
|
||||
return [view doKeyUp:e];
|
||||
case NSFlagsChanged:
|
||||
return [view doFlagsChanged:e];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void uiAreaSetSize(uiArea *a, int width, int height)
|
||||
{
|
||||
if (!a->scrolling)
|
||||
uiprivUserBug("You cannot call uiAreaSetSize() on a non-scrolling uiArea. (area: %p)", a);
|
||||
[a->area setScrollingSize:NSMakeSize(width, height)];
|
||||
}
|
||||
|
||||
void uiAreaQueueRedrawAll(uiArea *a)
|
||||
{
|
||||
[a->area setNeedsDisplay:YES];
|
||||
}
|
||||
|
||||
void uiAreaScrollTo(uiArea *a, double x, double y, double width, double height)
|
||||
{
|
||||
if (!a->scrolling)
|
||||
uiprivUserBug("You cannot call uiAreaScrollTo() on a non-scrolling uiArea. (area: %p)", a);
|
||||
[a->area scrollRectToVisible:NSMakeRect(x, y, width, height)];
|
||||
// don't worry about the return value; it just says whether scrolling was needed
|
||||
}
|
||||
|
||||
void uiAreaBeginUserWindowMove(uiArea *a)
|
||||
{
|
||||
uiprivNSWindow *w;
|
||||
|
||||
w = (uiprivNSWindow *) [a->area window];
|
||||
if (w == nil)
|
||||
return; // TODO
|
||||
if (a->dragevent == nil)
|
||||
return; // TODO
|
||||
[w uiprivDoMove:a->dragevent];
|
||||
}
|
||||
|
||||
void uiAreaBeginUserWindowResize(uiArea *a, uiWindowResizeEdge edge)
|
||||
{
|
||||
uiprivNSWindow *w;
|
||||
|
||||
w = (uiprivNSWindow *) [a->area window];
|
||||
if (w == nil)
|
||||
return; // TODO
|
||||
if (a->dragevent == nil)
|
||||
return; // TODO
|
||||
[w uiprivDoResize:a->dragevent on:edge];
|
||||
}
|
||||
|
||||
uiArea *uiNewArea(uiAreaHandler *ah)
|
||||
{
|
||||
uiArea *a;
|
||||
|
||||
uiDarwinNewControl(uiArea, a);
|
||||
|
||||
a->ah = ah;
|
||||
a->scrolling = NO;
|
||||
|
||||
a->area = [[areaView alloc] initWithFrame:NSZeroRect area:a];
|
||||
|
||||
a->view = a->area;
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
uiArea *uiNewScrollingArea(uiAreaHandler *ah, int width, int height)
|
||||
{
|
||||
uiArea *a;
|
||||
uiprivScrollViewCreateParams p;
|
||||
|
||||
uiDarwinNewControl(uiArea, a);
|
||||
|
||||
a->ah = ah;
|
||||
a->scrolling = YES;
|
||||
|
||||
a->area = [[areaView alloc] initWithFrame:NSMakeRect(0, 0, width, height)
|
||||
area:a];
|
||||
|
||||
memset(&p, 0, sizeof (uiprivScrollViewCreateParams));
|
||||
p.DocumentView = a->area;
|
||||
p.BackgroundColor = [NSColor controlColor];
|
||||
p.DrawsBackground = 1;
|
||||
p.Bordered = NO;
|
||||
p.HScroll = YES;
|
||||
p.VScroll = YES;
|
||||
a->sv = uiprivMkScrollView(&p, &(a->d));
|
||||
|
||||
a->view = a->sv;
|
||||
|
||||
return a;
|
||||
}
|
||||
159
dep/libui/darwin/areaevents.m
Normal file
159
dep/libui/darwin/areaevents.m
Normal file
@@ -0,0 +1,159 @@
|
||||
// 30 march 2014
|
||||
#import "uipriv_darwin.h"
|
||||
|
||||
/*
|
||||
Mac OS X uses its own set of hardware key codes that are different from PC keyboard scancodes, but are positional (like PC keyboard scancodes). These are defined in <HIToolbox/Events.h>, a Carbon header. As far as I can tell, there's no way to include this header without either using an absolute path or linking Carbon into the program, so the constant values are used here instead.
|
||||
|
||||
The Cocoa docs do guarantee that -[NSEvent keyCode] results in key codes that are the same as those returned by Carbon; that is, these codes.
|
||||
*/
|
||||
|
||||
// use uintptr_t to be safe
|
||||
static const struct {
|
||||
uintptr_t keycode;
|
||||
char equiv;
|
||||
} keycodeKeys[] = {
|
||||
{ 0x00, 'a' },
|
||||
{ 0x01, 's' },
|
||||
{ 0x02, 'd' },
|
||||
{ 0x03, 'f' },
|
||||
{ 0x04, 'h' },
|
||||
{ 0x05, 'g' },
|
||||
{ 0x06, 'z' },
|
||||
{ 0x07, 'x' },
|
||||
{ 0x08, 'c' },
|
||||
{ 0x09, 'v' },
|
||||
{ 0x0B, 'b' },
|
||||
{ 0x0C, 'q' },
|
||||
{ 0x0D, 'w' },
|
||||
{ 0x0E, 'e' },
|
||||
{ 0x0F, 'r' },
|
||||
{ 0x10, 'y' },
|
||||
{ 0x11, 't' },
|
||||
{ 0x12, '1' },
|
||||
{ 0x13, '2' },
|
||||
{ 0x14, '3' },
|
||||
{ 0x15, '4' },
|
||||
{ 0x16, '6' },
|
||||
{ 0x17, '5' },
|
||||
{ 0x18, '=' },
|
||||
{ 0x19, '9' },
|
||||
{ 0x1A, '7' },
|
||||
{ 0x1B, '-' },
|
||||
{ 0x1C, '8' },
|
||||
{ 0x1D, '0' },
|
||||
{ 0x1E, ']' },
|
||||
{ 0x1F, 'o' },
|
||||
{ 0x20, 'u' },
|
||||
{ 0x21, '[' },
|
||||
{ 0x22, 'i' },
|
||||
{ 0x23, 'p' },
|
||||
{ 0x25, 'l' },
|
||||
{ 0x26, 'j' },
|
||||
{ 0x27, '\'' },
|
||||
{ 0x28, 'k' },
|
||||
{ 0x29, ';' },
|
||||
{ 0x2A, '\\' },
|
||||
{ 0x2B, ',' },
|
||||
{ 0x2C, '/' },
|
||||
{ 0x2D, 'n' },
|
||||
{ 0x2E, 'm' },
|
||||
{ 0x2F, '.' },
|
||||
{ 0x32, '`' },
|
||||
{ 0x24, '\n' },
|
||||
{ 0x30, '\t' },
|
||||
{ 0x31, ' ' },
|
||||
{ 0x33, '\b' },
|
||||
{ 0xFFFF, 0 },
|
||||
};
|
||||
|
||||
static const struct {
|
||||
uintptr_t keycode;
|
||||
uiExtKey equiv;
|
||||
} keycodeExtKeys[] = {
|
||||
{ 0x41, uiExtKeyNDot },
|
||||
{ 0x43, uiExtKeyNMultiply },
|
||||
{ 0x45, uiExtKeyNAdd },
|
||||
{ 0x4B, uiExtKeyNDivide },
|
||||
{ 0x4C, uiExtKeyNEnter },
|
||||
{ 0x4E, uiExtKeyNSubtract },
|
||||
{ 0x52, uiExtKeyN0 },
|
||||
{ 0x53, uiExtKeyN1 },
|
||||
{ 0x54, uiExtKeyN2 },
|
||||
{ 0x55, uiExtKeyN3 },
|
||||
{ 0x56, uiExtKeyN4 },
|
||||
{ 0x57, uiExtKeyN5 },
|
||||
{ 0x58, uiExtKeyN6 },
|
||||
{ 0x59, uiExtKeyN7 },
|
||||
{ 0x5B, uiExtKeyN8 },
|
||||
{ 0x5C, uiExtKeyN9 },
|
||||
{ 0x35, uiExtKeyEscape },
|
||||
{ 0x60, uiExtKeyF5 },
|
||||
{ 0x61, uiExtKeyF6 },
|
||||
{ 0x62, uiExtKeyF7 },
|
||||
{ 0x63, uiExtKeyF3 },
|
||||
{ 0x64, uiExtKeyF8 },
|
||||
{ 0x65, uiExtKeyF9 },
|
||||
{ 0x67, uiExtKeyF11 },
|
||||
{ 0x6D, uiExtKeyF10 },
|
||||
{ 0x6F, uiExtKeyF12 },
|
||||
{ 0x72, uiExtKeyInsert }, // listed as the Help key but it's in the same position on an Apple keyboard as the Insert key on a Windows keyboard; thanks to SeanieB from irc.badnik.net and Psy in irc.freenode.net/#macdev for confirming they have the same code
|
||||
{ 0x73, uiExtKeyHome },
|
||||
{ 0x74, uiExtKeyPageUp },
|
||||
{ 0x75, uiExtKeyDelete },
|
||||
{ 0x76, uiExtKeyF4 },
|
||||
{ 0x77, uiExtKeyEnd },
|
||||
{ 0x78, uiExtKeyF2 },
|
||||
{ 0x79, uiExtKeyPageDown },
|
||||
{ 0x7A, uiExtKeyF1 },
|
||||
{ 0x7B, uiExtKeyLeft },
|
||||
{ 0x7C, uiExtKeyRight },
|
||||
{ 0x7D, uiExtKeyDown },
|
||||
{ 0x7E, uiExtKeyUp },
|
||||
{ 0xFFFF, 0 },
|
||||
};
|
||||
|
||||
static const struct {
|
||||
uintptr_t keycode;
|
||||
uiModifiers equiv;
|
||||
} keycodeModifiers[] = {
|
||||
{ 0x37, uiModifierSuper }, // left command
|
||||
{ 0x38, uiModifierShift }, // left shift
|
||||
{ 0x3A, uiModifierAlt }, // left option
|
||||
{ 0x3B, uiModifierCtrl }, // left control
|
||||
{ 0x3C, uiModifierShift }, // right shift
|
||||
{ 0x3D, uiModifierAlt }, // right alt
|
||||
{ 0x3E, uiModifierCtrl }, // right control
|
||||
// the following is not in Events.h for some reason
|
||||
// thanks to Nicole and jedivulcan from irc.badnik.net
|
||||
{ 0x36, uiModifierSuper }, // right command
|
||||
{ 0xFFFF, 0 },
|
||||
};
|
||||
|
||||
BOOL uiprivFromKeycode(unsigned short keycode, uiAreaKeyEvent *ke)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; keycodeKeys[i].keycode != 0xFFFF; i++)
|
||||
if (keycodeKeys[i].keycode == keycode) {
|
||||
ke->Key = keycodeKeys[i].equiv;
|
||||
return YES;
|
||||
}
|
||||
for (i = 0; keycodeExtKeys[i].keycode != 0xFFFF; i++)
|
||||
if (keycodeExtKeys[i].keycode == keycode) {
|
||||
ke->ExtKey = keycodeExtKeys[i].equiv;
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
BOOL uiprivKeycodeModifier(unsigned short keycode, uiModifiers *mod)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; keycodeModifiers[i].keycode != 0xFFFF; i++)
|
||||
if (keycodeModifiers[i].keycode == keycode) {
|
||||
*mod = keycodeModifiers[i].equiv;
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
91
dep/libui/darwin/attrstr.h
Normal file
91
dep/libui/darwin/attrstr.h
Normal file
@@ -0,0 +1,91 @@
|
||||
// 4 march 2018
|
||||
#import "../common/attrstr.h"
|
||||
|
||||
// opentype.m
|
||||
extern CFArrayRef uiprivOpenTypeFeaturesToCTFeatures(const uiOpenTypeFeatures *otf);
|
||||
|
||||
// aat.m
|
||||
typedef void (^uiprivAATBlock)(uint16_t type, uint16_t selector);
|
||||
extern void uiprivOpenTypeToAAT(char a, char b, char c, char d, uint32_t value, uiprivAATBlock f);
|
||||
|
||||
// fontmatch.m
|
||||
@interface uiprivFontStyleData : NSObject {
|
||||
CTFontRef font;
|
||||
CTFontDescriptorRef desc;
|
||||
CFDictionaryRef traits;
|
||||
CTFontSymbolicTraits symbolic;
|
||||
double weight;
|
||||
double width;
|
||||
BOOL didStyleName;
|
||||
CFStringRef styleName;
|
||||
BOOL didVariation;
|
||||
CFDictionaryRef variation;
|
||||
BOOL hasRegistrationScope;
|
||||
CTFontManagerScope registrationScope;
|
||||
BOOL didPostScriptName;
|
||||
CFStringRef postScriptName;
|
||||
CTFontFormat fontFormat;
|
||||
BOOL didPreferredSubFamilyName;
|
||||
CFStringRef preferredSubFamilyName;
|
||||
BOOL didSubFamilyName;
|
||||
CFStringRef subFamilyName;
|
||||
BOOL didFullName;
|
||||
CFStringRef fullName;
|
||||
BOOL didPreferredFamilyName;
|
||||
CFStringRef preferredFamilyName;
|
||||
BOOL didFamilyName;
|
||||
CFStringRef familyName;
|
||||
BOOL didVariationAxes;
|
||||
CFArrayRef variationAxes;
|
||||
}
|
||||
- (id)initWithFont:(CTFontRef)f;
|
||||
- (id)initWithDescriptor:(CTFontDescriptorRef)d;
|
||||
- (BOOL)prepare;
|
||||
- (void)ensureFont;
|
||||
- (CTFontSymbolicTraits)symbolicTraits;
|
||||
- (double)weight;
|
||||
- (double)width;
|
||||
- (CFStringRef)styleName;
|
||||
- (CFDictionaryRef)variation;
|
||||
- (BOOL)hasRegistrationScope;
|
||||
- (CTFontManagerScope)registrationScope;
|
||||
- (CFStringRef)postScriptName;
|
||||
- (CFDataRef)table:(CTFontTableTag)tag;
|
||||
- (CTFontFormat)fontFormat;
|
||||
- (CFStringRef)fontName:(CFStringRef)key;
|
||||
- (CFStringRef)preferredSubFamilyName;
|
||||
- (CFStringRef)subFamilyName;
|
||||
- (CFStringRef)fullName;
|
||||
- (CFStringRef)preferredFamilyName;
|
||||
- (CFStringRef)familyName;
|
||||
- (CFArrayRef)variationAxes;
|
||||
@end
|
||||
extern CTFontDescriptorRef uiprivFontDescriptorToCTFontDescriptor(uiFontDescriptor *fd);
|
||||
extern CTFontDescriptorRef uiprivCTFontDescriptorAppendFeatures(CTFontDescriptorRef desc, const uiOpenTypeFeatures *otf);
|
||||
extern void uiprivFontDescriptorFromCTFontDescriptor(CTFontDescriptorRef ctdesc, uiFontDescriptor *uidesc);
|
||||
|
||||
// fonttraits.m
|
||||
extern void uiprivProcessFontTraits(uiprivFontStyleData *d, uiFontDescriptor *out);
|
||||
|
||||
// fontvariation.m
|
||||
extern NSDictionary *uiprivMakeVariationAxisDict(CFArrayRef axes, CFDataRef avarTable);
|
||||
extern void uiprivProcessFontVariation(uiprivFontStyleData *d, NSDictionary *axisDict, uiFontDescriptor *out);
|
||||
|
||||
// attrstr.m
|
||||
extern void uiprivInitUnderlineColors(void);
|
||||
extern void uiprivUninitUnderlineColors(void);
|
||||
extern CFAttributedStringRef uiprivAttributedStringToCFAttributedString(uiDrawTextLayoutParams *p, NSArray **backgroundParams);
|
||||
|
||||
// drawtext.m
|
||||
// TODO figure out where this type should *really* go in all the headers...
|
||||
@interface uiprivDrawTextBackgroundParams : NSObject {
|
||||
size_t start;
|
||||
size_t end;
|
||||
double r;
|
||||
double g;
|
||||
double b;
|
||||
double a;
|
||||
}
|
||||
- (id)initWithStart:(size_t)s end:(size_t)e r:(double)red g:(double)green b:(double)blue a:(double)alpha;
|
||||
- (void)draw:(CGContextRef)c layout:(uiDrawTextLayout *)layout at:(double)x y:(double)y utf8Mapping:(const size_t *)u16tou8;
|
||||
@end
|
||||
505
dep/libui/darwin/attrstr.m
Normal file
505
dep/libui/darwin/attrstr.m
Normal file
@@ -0,0 +1,505 @@
|
||||
// 12 february 2017
|
||||
#import "uipriv_darwin.h"
|
||||
#import "attrstr.h"
|
||||
|
||||
// this is what AppKit does internally
|
||||
// WebKit does this too; see https://github.com/adobe/webkit/blob/master/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm
|
||||
static NSColor *spellingColor = nil;
|
||||
static NSColor *grammarColor = nil;
|
||||
static NSColor *auxiliaryColor = nil;
|
||||
|
||||
static NSColor *tryColorNamed(NSString *name)
|
||||
{
|
||||
NSImage *img;
|
||||
|
||||
img = [NSImage imageNamed:name];
|
||||
if (img == nil)
|
||||
return nil;
|
||||
return [NSColor colorWithPatternImage:img];
|
||||
}
|
||||
|
||||
void uiprivInitUnderlineColors(void)
|
||||
{
|
||||
spellingColor = tryColorNamed(@"NSSpellingDot");
|
||||
if (spellingColor == nil) {
|
||||
// WebKit says this is needed for "older systems"; not sure how old, but 10.11 AppKit doesn't look for this
|
||||
spellingColor = tryColorNamed(@"SpellingDot");
|
||||
if (spellingColor == nil)
|
||||
spellingColor = [NSColor redColor];
|
||||
}
|
||||
[spellingColor retain]; // override autoreleasing
|
||||
|
||||
grammarColor = tryColorNamed(@"NSGrammarDot");
|
||||
if (grammarColor == nil) {
|
||||
// WebKit says this is needed for "older systems"; not sure how old, but 10.11 AppKit doesn't look for this
|
||||
grammarColor = tryColorNamed(@"GrammarDot");
|
||||
if (grammarColor == nil)
|
||||
grammarColor = [NSColor greenColor];
|
||||
}
|
||||
[grammarColor retain]; // override autoreleasing
|
||||
|
||||
auxiliaryColor = tryColorNamed(@"NSCorrectionDot");
|
||||
if (auxiliaryColor == nil) {
|
||||
// WebKit says this is needed for "older systems"; not sure how old, but 10.11 AppKit doesn't look for this
|
||||
auxiliaryColor = tryColorNamed(@"CorrectionDot");
|
||||
if (auxiliaryColor == nil)
|
||||
auxiliaryColor = [NSColor blueColor];
|
||||
}
|
||||
[auxiliaryColor retain]; // override autoreleasing
|
||||
}
|
||||
|
||||
void uiprivUninitUnderlineColors(void)
|
||||
{
|
||||
[auxiliaryColor release];
|
||||
auxiliaryColor = nil;
|
||||
[grammarColor release];
|
||||
grammarColor = nil;
|
||||
[spellingColor release];
|
||||
spellingColor = nil;
|
||||
}
|
||||
|
||||
// TODO opentype features are lost when using uiFontDescriptor, so a handful of fonts in the font panel ("Titling" variants of some fonts and possibly others but those are the examples I know about) cannot be represented by uiFontDescriptor; what *can* we do about this since this info is NOT part of the font on other platforms?
|
||||
// TODO see if we could use NSAttributedString?
|
||||
// TODO consider renaming this struct and the fep variable(s)
|
||||
// TODO restructure all this so the important details at the top are below with the combined font attributes type?
|
||||
// TODO in fact I should just write something to explain everything in this file...
|
||||
struct foreachParams {
|
||||
CFMutableAttributedStringRef mas;
|
||||
NSMutableArray *backgroundParams;
|
||||
};
|
||||
|
||||
// unlike the other systems, Core Text rolls family, size, weight, italic, width, AND opentype features into the "font" attribute
|
||||
// instead of incrementally adjusting CTFontRefs (which, judging from NSFontManager, seems finicky and UI-centric), we use a custom class to incrementally store attributes that go into a CTFontRef, and then convert everything to CTFonts en masse later
|
||||
// https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/AttributedStrings/Tasks/ChangingAttrStrings.html#//apple_ref/doc/uid/20000162-BBCBGCDG says we must have -hash and -isEqual: workign properly for this to work, so we must do that too, using a basic xor-based hash and leveraging Cocoa -hash implementations where useful and feasible (if not necessary)
|
||||
// TODO structure and rewrite this part
|
||||
// TODO re-find sources proving support of custom attributes
|
||||
// TODO what if this is NULL?
|
||||
static const CFStringRef combinedFontAttrName = CFSTR("libuiCombinedFontAttribute");
|
||||
|
||||
enum {
|
||||
cFamily,
|
||||
cSize,
|
||||
cWeight,
|
||||
cItalic,
|
||||
cStretch,
|
||||
cFeatures,
|
||||
nc,
|
||||
};
|
||||
|
||||
static const int toc[] = {
|
||||
[uiAttributeTypeFamily] = cFamily,
|
||||
[uiAttributeTypeSize] = cSize,
|
||||
[uiAttributeTypeWeight] = cWeight,
|
||||
[uiAttributeTypeItalic] = cItalic,
|
||||
[uiAttributeTypeStretch] = cStretch,
|
||||
[uiAttributeTypeFeatures] = cFeatures,
|
||||
};
|
||||
|
||||
static uiForEach featuresHash(const uiOpenTypeFeatures *otf, char a, char b, char c, char d, uint32_t value, void *data)
|
||||
{
|
||||
NSUInteger *hash = (NSUInteger *) data;
|
||||
uint32_t tag;
|
||||
|
||||
tag = (((uint32_t) a) & 0xFF) << 24;
|
||||
tag |= (((uint32_t) b) & 0xFF) << 16;
|
||||
tag |= (((uint32_t) c) & 0xFF) << 8;
|
||||
tag |= ((uint32_t) d) & 0xFF;
|
||||
*hash ^= tag;
|
||||
*hash ^= value;
|
||||
return uiForEachContinue;
|
||||
}
|
||||
|
||||
@interface uiprivCombinedFontAttr : NSObject<NSCopying> {
|
||||
uiAttribute *attrs[nc];
|
||||
BOOL hasHash;
|
||||
NSUInteger hash;
|
||||
}
|
||||
- (void)addAttribute:(uiAttribute *)attr;
|
||||
- (CTFontRef)toCTFontWithDefaultFont:(uiFontDescriptor *)defaultFont;
|
||||
@end
|
||||
|
||||
@implementation uiprivCombinedFontAttr
|
||||
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
memset(self->attrs, 0, nc * sizeof (uiAttribute *));
|
||||
self->hasHash = NO;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nc; i++)
|
||||
if (self->attrs[i] != NULL) {
|
||||
uiprivAttributeRelease(self->attrs[i]);
|
||||
self->attrs[i] = NULL;
|
||||
}
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
uiprivCombinedFontAttr *ret;
|
||||
int i;
|
||||
|
||||
ret = [[uiprivCombinedFontAttr allocWithZone:zone] init];
|
||||
for (i = 0; i < nc; i++)
|
||||
if (self->attrs[i] != NULL)
|
||||
ret->attrs[i] = uiprivAttributeRetain(self->attrs[i]);
|
||||
ret->hasHash = self->hasHash;
|
||||
ret->hash = self->hash;
|
||||
return ret;
|
||||
}
|
||||
|
||||
- (void)addAttribute:(uiAttribute *)attr
|
||||
{
|
||||
int index;
|
||||
|
||||
index = toc[uiAttributeGetType(attr)];
|
||||
if (self->attrs[index] != NULL)
|
||||
uiprivAttributeRelease(self->attrs[index]);
|
||||
self->attrs[index] = uiprivAttributeRetain(attr);
|
||||
self->hasHash = NO;
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(id)bb
|
||||
{
|
||||
uiprivCombinedFontAttr *b = (uiprivCombinedFontAttr *) bb;
|
||||
int i;
|
||||
|
||||
if (b == nil)
|
||||
return NO;
|
||||
for (i = 0; i < nc; i++) {
|
||||
if (self->attrs[i] == NULL && b->attrs[i] == NULL)
|
||||
continue;
|
||||
if (self->attrs[i] == NULL || b->attrs[i] == NULL)
|
||||
return NO;
|
||||
if (!uiprivAttributeEqual(self->attrs[i], b->attrs[i]))
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSUInteger)hash
|
||||
{
|
||||
if (self->hasHash)
|
||||
return self->hash;
|
||||
@autoreleasepool {
|
||||
NSString *family;
|
||||
NSNumber *size;
|
||||
|
||||
self->hash = 0;
|
||||
if (self->attrs[cFamily] != NULL) {
|
||||
family = [NSString stringWithUTF8String:uiAttributeFamily(self->attrs[cFamily])];
|
||||
// TODO make sure this aligns with case-insensitive compares when those are done in common/attribute.c
|
||||
self->hash ^= [[family uppercaseString] hash];
|
||||
}
|
||||
if (self->attrs[cSize] != NULL) {
|
||||
size = [NSNumber numberWithDouble:uiAttributeSize(self->attrs[cSize])];
|
||||
self->hash ^= [size hash];
|
||||
}
|
||||
if (self->attrs[cWeight] != NULL)
|
||||
self->hash ^= (NSUInteger) uiAttributeWeight(self->attrs[cWeight]);
|
||||
if (self->attrs[cItalic] != NULL)
|
||||
self->hash ^= (NSUInteger) uiAttributeItalic(self->attrs[cItalic]);
|
||||
if (self->attrs[cStretch] != NULL)
|
||||
self->hash ^= (NSUInteger) uiAttributeStretch(self->attrs[cStretch]);
|
||||
if (self->attrs[cFeatures] != NULL)
|
||||
uiOpenTypeFeaturesForEach(uiAttributeFeatures(self->attrs[cFeatures]), featuresHash, &(self->hash));
|
||||
self->hasHash = YES;
|
||||
}
|
||||
return self->hash;
|
||||
}
|
||||
|
||||
- (CTFontRef)toCTFontWithDefaultFont:(uiFontDescriptor *)defaultFont
|
||||
{
|
||||
uiFontDescriptor uidesc;
|
||||
CTFontDescriptorRef desc;
|
||||
CTFontRef font;
|
||||
|
||||
uidesc = *defaultFont;
|
||||
if (self->attrs[cFamily] != NULL)
|
||||
// TODO const-correct uiFontDescriptor or change this function below
|
||||
uidesc.Family = (char *) uiAttributeFamily(self->attrs[cFamily]);
|
||||
if (self->attrs[cSize] != NULL)
|
||||
uidesc.Size = uiAttributeSize(self->attrs[cSize]);
|
||||
if (self->attrs[cWeight] != NULL)
|
||||
uidesc.Weight = uiAttributeWeight(self->attrs[cWeight]);
|
||||
if (self->attrs[cItalic] != NULL)
|
||||
uidesc.Italic = uiAttributeItalic(self->attrs[cItalic]);
|
||||
if (self->attrs[cStretch] != NULL)
|
||||
uidesc.Stretch = uiAttributeStretch(self->attrs[cStretch]);
|
||||
desc = uiprivFontDescriptorToCTFontDescriptor(&uidesc);
|
||||
if (self->attrs[cFeatures] != NULL)
|
||||
desc = uiprivCTFontDescriptorAppendFeatures(desc, uiAttributeFeatures(self->attrs[cFeatures]));
|
||||
font = CTFontCreateWithFontDescriptor(desc, uidesc.Size, NULL);
|
||||
CFRelease(desc); // TODO correct?
|
||||
return font;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
static void addFontAttributeToRange(struct foreachParams *p, size_t start, size_t end, uiAttribute *attr)
|
||||
{
|
||||
uiprivCombinedFontAttr *cfa;
|
||||
CFRange range;
|
||||
size_t diff;
|
||||
|
||||
while (start < end) {
|
||||
cfa = (uiprivCombinedFontAttr *) CFAttributedStringGetAttribute(p->mas, start, combinedFontAttrName, &range);
|
||||
if (cfa == nil)
|
||||
cfa = [uiprivCombinedFontAttr new];
|
||||
else
|
||||
cfa = [cfa copy];
|
||||
[cfa addAttribute:attr];
|
||||
// clamp range within [start, end)
|
||||
if (range.location < start) {
|
||||
diff = start - range.location;
|
||||
range.location = start;
|
||||
range.length -= diff;
|
||||
}
|
||||
if ((range.location + range.length) > end)
|
||||
range.length = end - range.location;
|
||||
CFAttributedStringSetAttribute(p->mas, range, combinedFontAttrName, cfa);
|
||||
[cfa release];
|
||||
start += range.length;
|
||||
}
|
||||
}
|
||||
|
||||
static CGColorRef mkcolor(double r, double g, double b, double a)
|
||||
{
|
||||
CGColorSpaceRef colorspace;
|
||||
CGColorRef color;
|
||||
CGFloat components[4];
|
||||
|
||||
// TODO we should probably just create this once and recycle it throughout program execution...
|
||||
colorspace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
|
||||
if (colorspace == NULL) {
|
||||
// TODO
|
||||
}
|
||||
components[0] = r;
|
||||
components[1] = g;
|
||||
components[2] = b;
|
||||
components[3] = a;
|
||||
color = CGColorCreate(colorspace, components);
|
||||
CFRelease(colorspace);
|
||||
return color;
|
||||
}
|
||||
|
||||
static void addBackgroundAttribute(struct foreachParams *p, size_t start, size_t end, double r, double g, double b, double a)
|
||||
{
|
||||
uiprivDrawTextBackgroundParams *dtb;
|
||||
|
||||
// TODO make sure this works properly with line paragraph spacings (after figuring out what that means, of course)
|
||||
if (uiprivFUTURE_kCTBackgroundColorAttributeName != NULL) {
|
||||
CGColorRef color;
|
||||
CFRange range;
|
||||
|
||||
color = mkcolor(r, g, b, a);
|
||||
range.location = start;
|
||||
range.length = end - start;
|
||||
CFAttributedStringSetAttribute(p->mas, range, *uiprivFUTURE_kCTBackgroundColorAttributeName, color);
|
||||
CFRelease(color);
|
||||
return;
|
||||
}
|
||||
|
||||
dtb = [[uiprivDrawTextBackgroundParams alloc] initWithStart:start end:end r:r g:g b:b a:a];
|
||||
[p->backgroundParams addObject:dtb];
|
||||
[dtb release];
|
||||
}
|
||||
|
||||
static uiForEach processAttribute(const uiAttributedString *s, const uiAttribute *attr, size_t start, size_t end, void *data)
|
||||
{
|
||||
struct foreachParams *p = (struct foreachParams *) data;
|
||||
CFRange range;
|
||||
CGColorRef color;
|
||||
int32_t us;
|
||||
CFNumberRef num;
|
||||
double r, g, b, a;
|
||||
uiUnderlineColor colorType;
|
||||
|
||||
start = uiprivAttributedStringUTF8ToUTF16(s, start);
|
||||
end = uiprivAttributedStringUTF8ToUTF16(s, end);
|
||||
range.location = start;
|
||||
range.length = end - start;
|
||||
switch (uiAttributeGetType(attr)) {
|
||||
case uiAttributeTypeFamily:
|
||||
case uiAttributeTypeSize:
|
||||
case uiAttributeTypeWeight:
|
||||
case uiAttributeTypeItalic:
|
||||
case uiAttributeTypeStretch:
|
||||
case uiAttributeTypeFeatures:
|
||||
addFontAttributeToRange(p, start, end, attr);
|
||||
break;
|
||||
case uiAttributeTypeColor:
|
||||
uiAttributeColor(attr, &r, &g, &b, &a);
|
||||
color = mkcolor(r, g, b, a);
|
||||
CFAttributedStringSetAttribute(p->mas, range, kCTForegroundColorAttributeName, color);
|
||||
CFRelease(color);
|
||||
break;
|
||||
case uiAttributeTypeBackground:
|
||||
uiAttributeColor(attr, &r, &g, &b, &a);
|
||||
addBackgroundAttribute(p, start, end, r, g, b, a);
|
||||
break;
|
||||
// TODO turn into a class, like we did with the font attributes, or even integrate *into* the font attributes
|
||||
case uiAttributeTypeUnderline:
|
||||
switch (uiAttributeUnderline(attr)) {
|
||||
case uiUnderlineNone:
|
||||
us = kCTUnderlineStyleNone;
|
||||
break;
|
||||
case uiUnderlineSingle:
|
||||
us = kCTUnderlineStyleSingle;
|
||||
break;
|
||||
case uiUnderlineDouble:
|
||||
us = kCTUnderlineStyleDouble;
|
||||
break;
|
||||
case uiUnderlineSuggestion:
|
||||
// TODO incorrect if a solid color
|
||||
us = kCTUnderlineStyleThick;
|
||||
break;
|
||||
}
|
||||
num = CFNumberCreate(NULL, kCFNumberSInt32Type, &us);
|
||||
CFAttributedStringSetAttribute(p->mas, range, kCTUnderlineStyleAttributeName, num);
|
||||
CFRelease(num);
|
||||
break;
|
||||
case uiAttributeTypeUnderlineColor:
|
||||
uiAttributeUnderlineColor(attr, &colorType, &r, &g, &b, &a);
|
||||
switch (colorType) {
|
||||
case uiUnderlineColorCustom:
|
||||
color = mkcolor(r, g, b, a);
|
||||
break;
|
||||
case uiUnderlineColorSpelling:
|
||||
color = [spellingColor CGColor];
|
||||
break;
|
||||
case uiUnderlineColorGrammar:
|
||||
color = [grammarColor CGColor];
|
||||
break;
|
||||
case uiUnderlineColorAuxiliary:
|
||||
color = [auxiliaryColor CGColor];
|
||||
break;
|
||||
}
|
||||
CFAttributedStringSetAttribute(p->mas, range, kCTUnderlineColorAttributeName, color);
|
||||
if (colorType == uiUnderlineColorCustom)
|
||||
CFRelease(color);
|
||||
break;
|
||||
}
|
||||
return uiForEachContinue;
|
||||
}
|
||||
|
||||
static void applyFontAttributes(CFMutableAttributedStringRef mas, uiFontDescriptor *defaultFont)
|
||||
{
|
||||
uiprivCombinedFontAttr *cfa;
|
||||
CTFontRef font;
|
||||
CFRange range;
|
||||
CFIndex n;
|
||||
|
||||
n = CFAttributedStringGetLength(mas);
|
||||
|
||||
// first apply the default font to the entire string
|
||||
// TODO is this necessary given the #if 0'd code in uiprivAttributedStringToCFAttributedString()?
|
||||
cfa = [uiprivCombinedFontAttr new];
|
||||
font = [cfa toCTFontWithDefaultFont:defaultFont];
|
||||
[cfa release];
|
||||
range.location = 0;
|
||||
range.length = n;
|
||||
CFAttributedStringSetAttribute(mas, range, kCTFontAttributeName, font);
|
||||
CFRelease(font);
|
||||
|
||||
// now go through, replacing every uiprivCombinedFontAttr with the proper CTFontRef
|
||||
// we are best off treating series of identical fonts as single ranges ourselves for parity across platforms, even if OS X does something similar itself
|
||||
range.location = 0;
|
||||
while (range.location < n) {
|
||||
// TODO consider seeing if CFAttributedStringGetAttributeAndLongestEffectiveRange() can make things faster by reducing the number of potential iterations, either here or above
|
||||
cfa = (uiprivCombinedFontAttr *) CFAttributedStringGetAttribute(mas, range.location, combinedFontAttrName, &range);
|
||||
if (cfa != nil) {
|
||||
font = [cfa toCTFontWithDefaultFont:defaultFont];
|
||||
CFAttributedStringSetAttribute(mas, range, kCTFontAttributeName, font);
|
||||
CFRelease(font);
|
||||
}
|
||||
range.location += range.length;
|
||||
}
|
||||
|
||||
// and finally, get rid of all the uiprivCombinedFontAttrs as we won't need them anymore
|
||||
range.location = 0;
|
||||
range.length = 0;
|
||||
CFAttributedStringRemoveAttribute(mas, range, combinedFontAttrName);
|
||||
}
|
||||
|
||||
static const CTTextAlignment ctaligns[] = {
|
||||
[uiDrawTextAlignLeft] = kCTTextAlignmentLeft,
|
||||
[uiDrawTextAlignCenter] = kCTTextAlignmentCenter,
|
||||
[uiDrawTextAlignRight] = kCTTextAlignmentRight,
|
||||
};
|
||||
|
||||
static CTParagraphStyleRef mkParagraphStyle(uiDrawTextLayoutParams *p)
|
||||
{
|
||||
CTParagraphStyleRef ps;
|
||||
CTParagraphStyleSetting settings[16];
|
||||
size_t nSettings = 0;
|
||||
|
||||
settings[nSettings].spec = kCTParagraphStyleSpecifierAlignment;
|
||||
settings[nSettings].valueSize = sizeof (CTTextAlignment);
|
||||
settings[nSettings].value = ctaligns + p->Align;
|
||||
nSettings++;
|
||||
|
||||
ps = CTParagraphStyleCreate(settings, nSettings);
|
||||
if (ps == NULL) {
|
||||
// TODO
|
||||
}
|
||||
return ps;
|
||||
}
|
||||
|
||||
// TODO either rename this (on all platforms) to uiprivDrawTextLayoutParams... or rename this file or both or split the struct or something else...
|
||||
CFAttributedStringRef uiprivAttributedStringToCFAttributedString(uiDrawTextLayoutParams *p, NSArray **backgroundParams)
|
||||
{
|
||||
CFStringRef cfstr;
|
||||
CFMutableDictionaryRef defaultAttrs;
|
||||
CTParagraphStyleRef ps;
|
||||
CFAttributedStringRef base;
|
||||
CFMutableAttributedStringRef mas;
|
||||
struct foreachParams fep;
|
||||
|
||||
cfstr = CFStringCreateWithCharacters(NULL, uiprivAttributedStringUTF16String(p->String), uiprivAttributedStringUTF16Len(p->String));
|
||||
if (cfstr == NULL) {
|
||||
// TODO
|
||||
}
|
||||
defaultAttrs = CFDictionaryCreateMutable(NULL, 0,
|
||||
&kCFCopyStringDictionaryKeyCallBacks,
|
||||
&kCFTypeDictionaryValueCallBacks);
|
||||
if (defaultAttrs == NULL) {
|
||||
// TODO
|
||||
}
|
||||
#if 0 /* TODO */
|
||||
ffp.desc = *(p->DefaultFont);
|
||||
defaultCTFont = fontdescToCTFont(&ffp);
|
||||
CFDictionaryAddValue(defaultAttrs, kCTFontAttributeName, defaultCTFont);
|
||||
CFRelease(defaultCTFont);
|
||||
#endif
|
||||
ps = mkParagraphStyle(p);
|
||||
CFDictionaryAddValue(defaultAttrs, kCTParagraphStyleAttributeName, ps);
|
||||
CFRelease(ps);
|
||||
|
||||
base = CFAttributedStringCreate(NULL, cfstr, defaultAttrs);
|
||||
if (base == NULL) {
|
||||
// TODO
|
||||
}
|
||||
CFRelease(cfstr);
|
||||
CFRelease(defaultAttrs);
|
||||
mas = CFAttributedStringCreateMutableCopy(NULL, 0, base);
|
||||
CFRelease(base);
|
||||
|
||||
CFAttributedStringBeginEditing(mas);
|
||||
fep.mas = mas;
|
||||
fep.backgroundParams = [NSMutableArray new];
|
||||
uiAttributedStringForEachAttribute(p->String, processAttribute, &fep);
|
||||
applyFontAttributes(mas, p->DefaultFont);
|
||||
CFAttributedStringEndEditing(mas);
|
||||
|
||||
*backgroundParams = fep.backgroundParams;
|
||||
return mas;
|
||||
}
|
||||
159
dep/libui/darwin/autolayout.m
Normal file
159
dep/libui/darwin/autolayout.m
Normal file
@@ -0,0 +1,159 @@
|
||||
// 15 august 2015
|
||||
#import "uipriv_darwin.h"
|
||||
|
||||
NSLayoutConstraint *uiprivMkConstraint(id view1, NSLayoutAttribute attr1, NSLayoutRelation relation, id view2, NSLayoutAttribute attr2, CGFloat multiplier, CGFloat c, NSString *desc)
|
||||
{
|
||||
NSLayoutConstraint *constraint;
|
||||
|
||||
constraint = [NSLayoutConstraint constraintWithItem:view1
|
||||
attribute:attr1
|
||||
relatedBy:relation
|
||||
toItem:view2
|
||||
attribute:attr2
|
||||
multiplier:multiplier
|
||||
constant:c];
|
||||
uiprivFUTURE_NSLayoutConstraint_setIdentifier(constraint, desc);
|
||||
return constraint;
|
||||
}
|
||||
|
||||
CGFloat uiDarwinMarginAmount(void *reserved)
|
||||
{
|
||||
return 20.0;
|
||||
}
|
||||
|
||||
CGFloat uiDarwinPaddingAmount(void *reserved)
|
||||
{
|
||||
return 8.0;
|
||||
}
|
||||
|
||||
// this is needed for NSSplitView to work properly; see http://stackoverflow.com/questions/34574478/how-can-i-set-the-position-of-a-nssplitview-nowadays-setpositionofdivideratind (stal in irc.freenode.net/#macdev came up with the exact combination)
|
||||
// turns out it also works on NSTabView and NSBox too, possibly others!
|
||||
// and for bonus points, it even seems to fix unsatisfiable-constraint-autoresizing-mask issues with NSTabView and NSBox too!!! this is nuts
|
||||
void uiprivJiggleViewLayout(NSView *view)
|
||||
{
|
||||
[view setNeedsLayout:YES];
|
||||
[view layoutSubtreeIfNeeded];
|
||||
}
|
||||
|
||||
static CGFloat margins(int margined)
|
||||
{
|
||||
if (!margined)
|
||||
return 0.0;
|
||||
return uiDarwinMarginAmount(NULL);
|
||||
}
|
||||
|
||||
void uiprivSingleChildConstraintsEstablish(uiprivSingleChildConstraints *c, NSView *contentView, NSView *childView, BOOL hugsTrailing, BOOL hugsBottom, int margined, NSString *desc)
|
||||
{
|
||||
CGFloat margin;
|
||||
|
||||
margin = margins(margined);
|
||||
|
||||
c->leadingConstraint = uiprivMkConstraint(contentView, NSLayoutAttributeLeading,
|
||||
NSLayoutRelationEqual,
|
||||
childView, NSLayoutAttributeLeading,
|
||||
1, -margin,
|
||||
[desc stringByAppendingString:@" leading constraint"]);
|
||||
[contentView addConstraint:c->leadingConstraint];
|
||||
[c->leadingConstraint retain];
|
||||
|
||||
c->topConstraint = uiprivMkConstraint(contentView, NSLayoutAttributeTop,
|
||||
NSLayoutRelationEqual,
|
||||
childView, NSLayoutAttributeTop,
|
||||
1, -margin,
|
||||
[desc stringByAppendingString:@" top constraint"]);
|
||||
[contentView addConstraint:c->topConstraint];
|
||||
[c->topConstraint retain];
|
||||
|
||||
c->trailingConstraintGreater = uiprivMkConstraint(contentView, NSLayoutAttributeTrailing,
|
||||
NSLayoutRelationGreaterThanOrEqual,
|
||||
childView, NSLayoutAttributeTrailing,
|
||||
1, margin,
|
||||
[desc stringByAppendingString:@" trailing >= constraint"]);
|
||||
if (hugsTrailing)
|
||||
[c->trailingConstraintGreater setPriority:NSLayoutPriorityDefaultLow];
|
||||
[contentView addConstraint:c->trailingConstraintGreater];
|
||||
[c->trailingConstraintGreater retain];
|
||||
|
||||
c->trailingConstraintEqual = uiprivMkConstraint(contentView, NSLayoutAttributeTrailing,
|
||||
NSLayoutRelationEqual,
|
||||
childView, NSLayoutAttributeTrailing,
|
||||
1, margin,
|
||||
[desc stringByAppendingString:@" trailing == constraint"]);
|
||||
if (!hugsTrailing)
|
||||
[c->trailingConstraintEqual setPriority:NSLayoutPriorityDefaultLow];
|
||||
[contentView addConstraint:c->trailingConstraintEqual];
|
||||
[c->trailingConstraintEqual retain];
|
||||
|
||||
c->bottomConstraintGreater = uiprivMkConstraint(contentView, NSLayoutAttributeBottom,
|
||||
NSLayoutRelationGreaterThanOrEqual,
|
||||
childView, NSLayoutAttributeBottom,
|
||||
1, margin,
|
||||
[desc stringByAppendingString:@" bottom >= constraint"]);
|
||||
if (hugsBottom)
|
||||
[c->bottomConstraintGreater setPriority:NSLayoutPriorityDefaultLow];
|
||||
[contentView addConstraint:c->bottomConstraintGreater];
|
||||
[c->bottomConstraintGreater retain];
|
||||
|
||||
c->bottomConstraintEqual = uiprivMkConstraint(contentView, NSLayoutAttributeBottom,
|
||||
NSLayoutRelationEqual,
|
||||
childView, NSLayoutAttributeBottom,
|
||||
1, margin,
|
||||
[desc stringByAppendingString:@" bottom == constraint"]);
|
||||
if (!hugsBottom)
|
||||
[c->bottomConstraintEqual setPriority:NSLayoutPriorityDefaultLow];
|
||||
[contentView addConstraint:c->bottomConstraintEqual];
|
||||
[c->bottomConstraintEqual retain];
|
||||
}
|
||||
|
||||
void uiprivSingleChildConstraintsRemove(uiprivSingleChildConstraints *c, NSView *cv)
|
||||
{
|
||||
if (c->leadingConstraint != nil) {
|
||||
[cv removeConstraint:c->leadingConstraint];
|
||||
[c->leadingConstraint release];
|
||||
c->leadingConstraint = nil;
|
||||
}
|
||||
if (c->topConstraint != nil) {
|
||||
[cv removeConstraint:c->topConstraint];
|
||||
[c->topConstraint release];
|
||||
c->topConstraint = nil;
|
||||
}
|
||||
if (c->trailingConstraintGreater != nil) {
|
||||
[cv removeConstraint:c->trailingConstraintGreater];
|
||||
[c->trailingConstraintGreater release];
|
||||
c->trailingConstraintGreater = nil;
|
||||
}
|
||||
if (c->trailingConstraintEqual != nil) {
|
||||
[cv removeConstraint:c->trailingConstraintEqual];
|
||||
[c->trailingConstraintEqual release];
|
||||
c->trailingConstraintEqual = nil;
|
||||
}
|
||||
if (c->bottomConstraintGreater != nil) {
|
||||
[cv removeConstraint:c->bottomConstraintGreater];
|
||||
[c->bottomConstraintGreater release];
|
||||
c->bottomConstraintGreater = nil;
|
||||
}
|
||||
if (c->bottomConstraintEqual != nil) {
|
||||
[cv removeConstraint:c->bottomConstraintEqual];
|
||||
[c->bottomConstraintEqual release];
|
||||
c->bottomConstraintEqual = nil;
|
||||
}
|
||||
}
|
||||
|
||||
void uiprivSingleChildConstraintsSetMargined(uiprivSingleChildConstraints *c, int margined)
|
||||
{
|
||||
CGFloat margin;
|
||||
|
||||
margin = margins(margined);
|
||||
if (c->leadingConstraint != nil)
|
||||
[c->leadingConstraint setConstant:-margin];
|
||||
if (c->topConstraint != nil)
|
||||
[c->topConstraint setConstant:-margin];
|
||||
if (c->trailingConstraintGreater != nil)
|
||||
[c->trailingConstraintGreater setConstant:margin];
|
||||
if (c->trailingConstraintEqual != nil)
|
||||
[c->trailingConstraintEqual setConstant:margin];
|
||||
if (c->bottomConstraintGreater != nil)
|
||||
[c->bottomConstraintGreater setConstant:margin];
|
||||
if (c->bottomConstraintEqual != nil)
|
||||
[c->bottomConstraintEqual setConstant:margin];
|
||||
}
|
||||
469
dep/libui/darwin/box.m
Normal file
469
dep/libui/darwin/box.m
Normal file
@@ -0,0 +1,469 @@
|
||||
// 15 august 2015
|
||||
#import "uipriv_darwin.h"
|
||||
|
||||
// TODO hiding all stretchy controls still hugs trailing edge
|
||||
|
||||
@interface boxChild : NSObject
|
||||
@property uiControl *c;
|
||||
@property BOOL stretchy;
|
||||
@property NSLayoutPriority oldPrimaryHuggingPri;
|
||||
@property NSLayoutPriority oldSecondaryHuggingPri;
|
||||
- (NSView *)view;
|
||||
@end
|
||||
|
||||
@interface boxView : NSView {
|
||||
uiBox *b;
|
||||
NSMutableArray *children;
|
||||
BOOL vertical;
|
||||
int padded;
|
||||
|
||||
NSLayoutConstraint *first;
|
||||
NSMutableArray *inBetweens;
|
||||
NSLayoutConstraint *last;
|
||||
NSMutableArray *otherConstraints;
|
||||
|
||||
NSLayoutAttribute primaryStart;
|
||||
NSLayoutAttribute primaryEnd;
|
||||
NSLayoutAttribute secondaryStart;
|
||||
NSLayoutAttribute secondaryEnd;
|
||||
NSLayoutAttribute primarySize;
|
||||
NSLayoutConstraintOrientation primaryOrientation;
|
||||
NSLayoutConstraintOrientation secondaryOrientation;
|
||||
}
|
||||
- (id)initWithVertical:(BOOL)vert b:(uiBox *)bb;
|
||||
- (void)onDestroy;
|
||||
- (void)removeOurConstraints;
|
||||
- (void)syncEnableStates:(int)enabled;
|
||||
- (CGFloat)paddingAmount;
|
||||
- (void)establishOurConstraints;
|
||||
- (void)append:(uiControl *)c stretchy:(int)stretchy;
|
||||
- (void)delete:(int)n;
|
||||
- (int)isPadded;
|
||||
- (void)setPadded:(int)p;
|
||||
- (BOOL)hugsTrailing;
|
||||
- (BOOL)hugsBottom;
|
||||
- (int)nStretchy;
|
||||
@end
|
||||
|
||||
struct uiBox {
|
||||
uiDarwinControl c;
|
||||
boxView *view;
|
||||
};
|
||||
|
||||
@implementation boxChild
|
||||
|
||||
- (NSView *)view
|
||||
{
|
||||
return (NSView *) uiControlHandle(self.c);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation boxView
|
||||
|
||||
- (id)initWithVertical:(BOOL)vert b:(uiBox *)bb
|
||||
{
|
||||
self = [super initWithFrame:NSZeroRect];
|
||||
if (self != nil) {
|
||||
// the weird names vert and bb are to shut the compiler up about shadowing because implicit this/self is stupid
|
||||
self->b = bb;
|
||||
self->vertical = vert;
|
||||
self->padded = 0;
|
||||
self->children = [NSMutableArray new];
|
||||
|
||||
self->inBetweens = [NSMutableArray new];
|
||||
self->otherConstraints = [NSMutableArray new];
|
||||
|
||||
if (self->vertical) {
|
||||
self->primaryStart = NSLayoutAttributeTop;
|
||||
self->primaryEnd = NSLayoutAttributeBottom;
|
||||
self->secondaryStart = NSLayoutAttributeLeading;
|
||||
self->secondaryEnd = NSLayoutAttributeTrailing;
|
||||
self->primarySize = NSLayoutAttributeHeight;
|
||||
self->primaryOrientation = NSLayoutConstraintOrientationVertical;
|
||||
self->secondaryOrientation = NSLayoutConstraintOrientationHorizontal;
|
||||
} else {
|
||||
self->primaryStart = NSLayoutAttributeLeading;
|
||||
self->primaryEnd = NSLayoutAttributeTrailing;
|
||||
self->secondaryStart = NSLayoutAttributeTop;
|
||||
self->secondaryEnd = NSLayoutAttributeBottom;
|
||||
self->primarySize = NSLayoutAttributeWidth;
|
||||
self->primaryOrientation = NSLayoutConstraintOrientationHorizontal;
|
||||
self->secondaryOrientation = NSLayoutConstraintOrientationVertical;
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)onDestroy
|
||||
{
|
||||
boxChild *bc;
|
||||
|
||||
[self removeOurConstraints];
|
||||
[self->inBetweens release];
|
||||
[self->otherConstraints release];
|
||||
|
||||
for (bc in self->children) {
|
||||
uiControlSetParent(bc.c, NULL);
|
||||
uiDarwinControlSetSuperview(uiDarwinControl(bc.c), nil);
|
||||
uiControlDestroy(bc.c);
|
||||
}
|
||||
[self->children release];
|
||||
}
|
||||
|
||||
- (void)removeOurConstraints
|
||||
{
|
||||
if (self->first != nil) {
|
||||
[self removeConstraint:self->first];
|
||||
[self->first release];
|
||||
self->first = nil;
|
||||
}
|
||||
if ([self->inBetweens count] != 0) {
|
||||
[self removeConstraints:self->inBetweens];
|
||||
[self->inBetweens removeAllObjects];
|
||||
}
|
||||
if (self->last != nil) {
|
||||
[self removeConstraint:self->last];
|
||||
[self->last release];
|
||||
self->last = nil;
|
||||
}
|
||||
if ([self->otherConstraints count] != 0) {
|
||||
[self removeConstraints:self->otherConstraints];
|
||||
[self->otherConstraints removeAllObjects];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)syncEnableStates:(int)enabled
|
||||
{
|
||||
boxChild *bc;
|
||||
|
||||
for (bc in self->children)
|
||||
uiDarwinControlSyncEnableState(uiDarwinControl(bc.c), enabled);
|
||||
}
|
||||
|
||||
- (CGFloat)paddingAmount
|
||||
{
|
||||
if (!self->padded)
|
||||
return 0.0;
|
||||
return uiDarwinPaddingAmount(NULL);
|
||||
}
|
||||
|
||||
- (void)establishOurConstraints
|
||||
{
|
||||
boxChild *bc;
|
||||
CGFloat padding;
|
||||
NSView *prev;
|
||||
NSLayoutConstraint *c;
|
||||
BOOL (*hugsSecondary)(uiDarwinControl *);
|
||||
|
||||
[self removeOurConstraints];
|
||||
if ([self->children count] == 0)
|
||||
return;
|
||||
padding = [self paddingAmount];
|
||||
|
||||
// first arrange in the primary direction
|
||||
prev = nil;
|
||||
for (bc in self->children) {
|
||||
if (!uiControlVisible(bc.c))
|
||||
continue;
|
||||
if (prev == nil) { // first view
|
||||
self->first = uiprivMkConstraint(self, self->primaryStart,
|
||||
NSLayoutRelationEqual,
|
||||
[bc view], self->primaryStart,
|
||||
1, 0,
|
||||
@"uiBox first primary constraint");
|
||||
[self addConstraint:self->first];
|
||||
[self->first retain];
|
||||
prev = [bc view];
|
||||
continue;
|
||||
}
|
||||
// not the first; link it
|
||||
c = uiprivMkConstraint(prev, self->primaryEnd,
|
||||
NSLayoutRelationEqual,
|
||||
[bc view], self->primaryStart,
|
||||
1, -padding,
|
||||
@"uiBox in-between primary constraint");
|
||||
[self addConstraint:c];
|
||||
[self->inBetweens addObject:c];
|
||||
prev = [bc view];
|
||||
}
|
||||
if (prev == nil) // no control visible; act as if no controls
|
||||
return;
|
||||
self->last = uiprivMkConstraint(prev, self->primaryEnd,
|
||||
NSLayoutRelationEqual,
|
||||
self, self->primaryEnd,
|
||||
1, 0,
|
||||
@"uiBox last primary constraint");
|
||||
[self addConstraint:self->last];
|
||||
[self->last retain];
|
||||
|
||||
// then arrange in the secondary direction
|
||||
hugsSecondary = uiDarwinControlHugsTrailingEdge;
|
||||
if (!self->vertical)
|
||||
hugsSecondary = uiDarwinControlHugsBottom;
|
||||
for (bc in self->children) {
|
||||
if (!uiControlVisible(bc.c))
|
||||
continue;
|
||||
c = uiprivMkConstraint(self, self->secondaryStart,
|
||||
NSLayoutRelationEqual,
|
||||
[bc view], self->secondaryStart,
|
||||
1, 0,
|
||||
@"uiBox secondary start constraint");
|
||||
[self addConstraint:c];
|
||||
[self->otherConstraints addObject:c];
|
||||
c = uiprivMkConstraint([bc view], self->secondaryEnd,
|
||||
NSLayoutRelationLessThanOrEqual,
|
||||
self, self->secondaryEnd,
|
||||
1, 0,
|
||||
@"uiBox secondary end <= constraint");
|
||||
if ((*hugsSecondary)(uiDarwinControl(bc.c)))
|
||||
[c setPriority:NSLayoutPriorityDefaultLow];
|
||||
[self addConstraint:c];
|
||||
[self->otherConstraints addObject:c];
|
||||
c = uiprivMkConstraint([bc view], self->secondaryEnd,
|
||||
NSLayoutRelationEqual,
|
||||
self, self->secondaryEnd,
|
||||
1, 0,
|
||||
@"uiBox secondary end == constraint");
|
||||
if (!(*hugsSecondary)(uiDarwinControl(bc.c)))
|
||||
[c setPriority:NSLayoutPriorityDefaultLow];
|
||||
[self addConstraint:c];
|
||||
[self->otherConstraints addObject:c];
|
||||
}
|
||||
|
||||
// and make all stretchy controls the same size
|
||||
if ([self nStretchy] == 0)
|
||||
return;
|
||||
prev = nil; // first stretchy view
|
||||
for (bc in self->children) {
|
||||
if (!uiControlVisible(bc.c))
|
||||
continue;
|
||||
if (!bc.stretchy)
|
||||
continue;
|
||||
if (prev == nil) {
|
||||
prev = [bc view];
|
||||
continue;
|
||||
}
|
||||
c = uiprivMkConstraint(prev, self->primarySize,
|
||||
NSLayoutRelationEqual,
|
||||
[bc view], self->primarySize,
|
||||
1, 0,
|
||||
@"uiBox stretchy size constraint");
|
||||
[self addConstraint:c];
|
||||
[self->otherConstraints addObject:c];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)append:(uiControl *)c stretchy:(int)stretchy
|
||||
{
|
||||
boxChild *bc;
|
||||
NSLayoutPriority priority;
|
||||
int oldnStretchy;
|
||||
|
||||
bc = [boxChild new];
|
||||
bc.c = c;
|
||||
bc.stretchy = stretchy;
|
||||
bc.oldPrimaryHuggingPri = uiDarwinControlHuggingPriority(uiDarwinControl(bc.c), self->primaryOrientation);
|
||||
bc.oldSecondaryHuggingPri = uiDarwinControlHuggingPriority(uiDarwinControl(bc.c), self->secondaryOrientation);
|
||||
|
||||
uiControlSetParent(bc.c, uiControl(self->b));
|
||||
uiDarwinControlSetSuperview(uiDarwinControl(bc.c), self);
|
||||
uiDarwinControlSyncEnableState(uiDarwinControl(bc.c), uiControlEnabledToUser(uiControl(self->b)));
|
||||
|
||||
// if a control is stretchy, it should not hug in the primary direction
|
||||
// otherwise, it should *forcibly* hug
|
||||
if (bc.stretchy)
|
||||
priority = NSLayoutPriorityDefaultLow;
|
||||
else
|
||||
// LONGTERM will default high work?
|
||||
priority = NSLayoutPriorityRequired;
|
||||
uiDarwinControlSetHuggingPriority(uiDarwinControl(bc.c), priority, self->primaryOrientation);
|
||||
// make sure controls don't hug their secondary direction so they fill the width of the view
|
||||
uiDarwinControlSetHuggingPriority(uiDarwinControl(bc.c), NSLayoutPriorityDefaultLow, self->secondaryOrientation);
|
||||
|
||||
oldnStretchy = [self nStretchy];
|
||||
[self->children addObject:bc];
|
||||
|
||||
[self establishOurConstraints];
|
||||
if (bc.stretchy)
|
||||
if (oldnStretchy == 0)
|
||||
uiDarwinNotifyEdgeHuggingChanged(uiDarwinControl(self->b));
|
||||
|
||||
[bc release]; // we don't need the initial reference now
|
||||
}
|
||||
|
||||
- (void)delete:(int)n
|
||||
{
|
||||
boxChild *bc;
|
||||
int stretchy;
|
||||
|
||||
bc = (boxChild *) [self->children objectAtIndex:n];
|
||||
stretchy = bc.stretchy;
|
||||
|
||||
uiControlSetParent(bc.c, NULL);
|
||||
uiDarwinControlSetSuperview(uiDarwinControl(bc.c), nil);
|
||||
|
||||
uiDarwinControlSetHuggingPriority(uiDarwinControl(bc.c), bc.oldPrimaryHuggingPri, self->primaryOrientation);
|
||||
uiDarwinControlSetHuggingPriority(uiDarwinControl(bc.c), bc.oldSecondaryHuggingPri, self->secondaryOrientation);
|
||||
|
||||
[self->children removeObjectAtIndex:n];
|
||||
|
||||
[self establishOurConstraints];
|
||||
if (stretchy)
|
||||
if ([self nStretchy] == 0)
|
||||
uiDarwinNotifyEdgeHuggingChanged(uiDarwinControl(self->b));
|
||||
}
|
||||
|
||||
- (int)isPadded
|
||||
{
|
||||
return self->padded;
|
||||
}
|
||||
|
||||
- (void)setPadded:(int)p
|
||||
{
|
||||
CGFloat padding;
|
||||
NSLayoutConstraint *c;
|
||||
|
||||
self->padded = p;
|
||||
padding = [self paddingAmount];
|
||||
for (c in self->inBetweens)
|
||||
[c setConstant:-padding];
|
||||
}
|
||||
|
||||
- (BOOL)hugsTrailing
|
||||
{
|
||||
if (self->vertical) // always hug if vertical
|
||||
return YES;
|
||||
return [self nStretchy] != 0;
|
||||
}
|
||||
|
||||
- (BOOL)hugsBottom
|
||||
{
|
||||
if (!self->vertical) // always hug if horizontal
|
||||
return YES;
|
||||
return [self nStretchy] != 0;
|
||||
}
|
||||
|
||||
- (int)nStretchy
|
||||
{
|
||||
boxChild *bc;
|
||||
int n;
|
||||
|
||||
n = 0;
|
||||
for (bc in self->children) {
|
||||
if (!uiControlVisible(bc.c))
|
||||
continue;
|
||||
if (bc.stretchy)
|
||||
n++;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
static void uiBoxDestroy(uiControl *c)
|
||||
{
|
||||
uiBox *b = uiBox(c);
|
||||
|
||||
[b->view onDestroy];
|
||||
[b->view release];
|
||||
uiFreeControl(uiControl(b));
|
||||
}
|
||||
|
||||
uiDarwinControlDefaultHandle(uiBox, view)
|
||||
uiDarwinControlDefaultParent(uiBox, view)
|
||||
uiDarwinControlDefaultSetParent(uiBox, view)
|
||||
uiDarwinControlDefaultToplevel(uiBox, view)
|
||||
uiDarwinControlDefaultVisible(uiBox, view)
|
||||
uiDarwinControlDefaultShow(uiBox, view)
|
||||
uiDarwinControlDefaultHide(uiBox, view)
|
||||
uiDarwinControlDefaultEnabled(uiBox, view)
|
||||
uiDarwinControlDefaultEnable(uiBox, view)
|
||||
uiDarwinControlDefaultDisable(uiBox, view)
|
||||
|
||||
static void uiBoxSyncEnableState(uiDarwinControl *c, int enabled)
|
||||
{
|
||||
uiBox *b = uiBox(c);
|
||||
|
||||
if (uiDarwinShouldStopSyncEnableState(uiDarwinControl(b), enabled))
|
||||
return;
|
||||
[b->view syncEnableStates:enabled];
|
||||
}
|
||||
|
||||
uiDarwinControlDefaultSetSuperview(uiBox, view)
|
||||
|
||||
static BOOL uiBoxHugsTrailingEdge(uiDarwinControl *c)
|
||||
{
|
||||
uiBox *b = uiBox(c);
|
||||
|
||||
return [b->view hugsTrailing];
|
||||
}
|
||||
|
||||
static BOOL uiBoxHugsBottom(uiDarwinControl *c)
|
||||
{
|
||||
uiBox *b = uiBox(c);
|
||||
|
||||
return [b->view hugsBottom];
|
||||
}
|
||||
|
||||
static void uiBoxChildEdgeHuggingChanged(uiDarwinControl *c)
|
||||
{
|
||||
uiBox *b = uiBox(c);
|
||||
|
||||
[b->view establishOurConstraints];
|
||||
}
|
||||
|
||||
uiDarwinControlDefaultHuggingPriority(uiBox, view)
|
||||
uiDarwinControlDefaultSetHuggingPriority(uiBox, view)
|
||||
|
||||
static void uiBoxChildVisibilityChanged(uiDarwinControl *c)
|
||||
{
|
||||
uiBox *b = uiBox(c);
|
||||
|
||||
[b->view establishOurConstraints];
|
||||
}
|
||||
|
||||
void uiBoxAppend(uiBox *b, uiControl *c, int stretchy)
|
||||
{
|
||||
// LONGTERM on other platforms
|
||||
// or at leat allow this and implicitly turn it into a spacer
|
||||
if (c == NULL)
|
||||
uiprivUserBug("You cannot add NULL to a uiBox.");
|
||||
[b->view append:c stretchy:stretchy];
|
||||
}
|
||||
|
||||
void uiBoxDelete(uiBox *b, int n)
|
||||
{
|
||||
[b->view delete:n];
|
||||
}
|
||||
|
||||
int uiBoxPadded(uiBox *b)
|
||||
{
|
||||
return [b->view isPadded];
|
||||
}
|
||||
|
||||
void uiBoxSetPadded(uiBox *b, int padded)
|
||||
{
|
||||
[b->view setPadded:padded];
|
||||
}
|
||||
|
||||
static uiBox *finishNewBox(BOOL vertical)
|
||||
{
|
||||
uiBox *b;
|
||||
|
||||
uiDarwinNewControl(uiBox, b);
|
||||
|
||||
b->view = [[boxView alloc] initWithVertical:vertical b:b];
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
uiBox *uiNewHorizontalBox(void)
|
||||
{
|
||||
return finishNewBox(NO);
|
||||
}
|
||||
|
||||
uiBox *uiNewVerticalBox(void)
|
||||
{
|
||||
return finishNewBox(YES);
|
||||
}
|
||||
113
dep/libui/darwin/button.m
Normal file
113
dep/libui/darwin/button.m
Normal file
@@ -0,0 +1,113 @@
|
||||
// 13 august 2015
|
||||
#import "uipriv_darwin.h"
|
||||
|
||||
struct uiButton {
|
||||
uiDarwinControl c;
|
||||
NSButton *button;
|
||||
void (*onClicked)(uiButton *, void *);
|
||||
void *onClickedData;
|
||||
};
|
||||
|
||||
@interface buttonDelegateClass : NSObject {
|
||||
uiprivMap *buttons;
|
||||
}
|
||||
- (IBAction)onClicked:(id)sender;
|
||||
- (void)registerButton:(uiButton *)b;
|
||||
- (void)unregisterButton:(uiButton *)b;
|
||||
@end
|
||||
|
||||
@implementation buttonDelegateClass
|
||||
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
self->buttons = uiprivNewMap();
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
uiprivMapDestroy(self->buttons);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (IBAction)onClicked:(id)sender
|
||||
{
|
||||
uiButton *b;
|
||||
|
||||
b = (uiButton *) uiprivMapGet(self->buttons, sender);
|
||||
(*(b->onClicked))(b, b->onClickedData);
|
||||
}
|
||||
|
||||
- (void)registerButton:(uiButton *)b
|
||||
{
|
||||
uiprivMapSet(self->buttons, b->button, b);
|
||||
[b->button setTarget:self];
|
||||
[b->button setAction:@selector(onClicked:)];
|
||||
}
|
||||
|
||||
- (void)unregisterButton:(uiButton *)b
|
||||
{
|
||||
[b->button setTarget:nil];
|
||||
uiprivMapDelete(self->buttons, b->button);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
static buttonDelegateClass *buttonDelegate = nil;
|
||||
|
||||
uiDarwinControlAllDefaultsExceptDestroy(uiButton, button)
|
||||
|
||||
static void uiButtonDestroy(uiControl *c)
|
||||
{
|
||||
uiButton *b = uiButton(c);
|
||||
|
||||
[buttonDelegate unregisterButton:b];
|
||||
[b->button release];
|
||||
uiFreeControl(uiControl(b));
|
||||
}
|
||||
|
||||
char *uiButtonText(uiButton *b)
|
||||
{
|
||||
return uiDarwinNSStringToText([b->button title]);
|
||||
}
|
||||
|
||||
void uiButtonSetText(uiButton *b, const char *text)
|
||||
{
|
||||
[b->button setTitle:uiprivToNSString(text)];
|
||||
}
|
||||
|
||||
void uiButtonOnClicked(uiButton *b, void (*f)(uiButton *, void *), void *data)
|
||||
{
|
||||
b->onClicked = f;
|
||||
b->onClickedData = data;
|
||||
}
|
||||
|
||||
static void defaultOnClicked(uiButton *b, void *data)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
uiButton *uiNewButton(const char *text)
|
||||
{
|
||||
uiButton *b;
|
||||
|
||||
uiDarwinNewControl(uiButton, b);
|
||||
|
||||
b->button = [[NSButton alloc] initWithFrame:NSZeroRect];
|
||||
[b->button setTitle:uiprivToNSString(text)];
|
||||
[b->button setButtonType:NSMomentaryPushInButton];
|
||||
[b->button setBordered:YES];
|
||||
[b->button setBezelStyle:NSRoundedBezelStyle];
|
||||
uiDarwinSetControlFont(b->button, NSRegularControlSize);
|
||||
|
||||
if (buttonDelegate == nil) {
|
||||
buttonDelegate = [[buttonDelegateClass new] autorelease];
|
||||
[uiprivDelegates addObject:buttonDelegate];
|
||||
}
|
||||
[buttonDelegate registerButton:b];
|
||||
uiButtonOnClicked(b, defaultOnClicked, NULL);
|
||||
|
||||
return b;
|
||||
}
|
||||
129
dep/libui/darwin/checkbox.m
Normal file
129
dep/libui/darwin/checkbox.m
Normal file
@@ -0,0 +1,129 @@
|
||||
// 14 august 2015
|
||||
#import "uipriv_darwin.h"
|
||||
|
||||
struct uiCheckbox {
|
||||
uiDarwinControl c;
|
||||
NSButton *button;
|
||||
void (*onToggled)(uiCheckbox *, void *);
|
||||
void *onToggledData;
|
||||
};
|
||||
|
||||
@interface checkboxDelegateClass : NSObject {
|
||||
uiprivMap *buttons;
|
||||
}
|
||||
- (IBAction)onToggled:(id)sender;
|
||||
- (void)registerCheckbox:(uiCheckbox *)c;
|
||||
- (void)unregisterCheckbox:(uiCheckbox *)c;
|
||||
@end
|
||||
|
||||
@implementation checkboxDelegateClass
|
||||
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
self->buttons = uiprivNewMap();
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
uiprivMapDestroy(self->buttons);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (IBAction)onToggled:(id)sender
|
||||
{
|
||||
uiCheckbox *c;
|
||||
|
||||
c = (uiCheckbox *) uiprivMapGet(self->buttons, sender);
|
||||
(*(c->onToggled))(c, c->onToggledData);
|
||||
}
|
||||
|
||||
- (void)registerCheckbox:(uiCheckbox *)c
|
||||
{
|
||||
uiprivMapSet(self->buttons, c->button, c);
|
||||
[c->button setTarget:self];
|
||||
[c->button setAction:@selector(onToggled:)];
|
||||
}
|
||||
|
||||
- (void)unregisterCheckbox:(uiCheckbox *)c
|
||||
{
|
||||
[c->button setTarget:nil];
|
||||
uiprivMapDelete(self->buttons, c->button);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
static checkboxDelegateClass *checkboxDelegate = nil;
|
||||
|
||||
uiDarwinControlAllDefaultsExceptDestroy(uiCheckbox, button)
|
||||
|
||||
static void uiCheckboxDestroy(uiControl *cc)
|
||||
{
|
||||
uiCheckbox *c = uiCheckbox(cc);
|
||||
|
||||
[checkboxDelegate unregisterCheckbox:c];
|
||||
[c->button release];
|
||||
uiFreeControl(uiControl(c));
|
||||
}
|
||||
|
||||
char *uiCheckboxText(uiCheckbox *c)
|
||||
{
|
||||
return uiDarwinNSStringToText([c->button title]);
|
||||
}
|
||||
|
||||
void uiCheckboxSetText(uiCheckbox *c, const char *text)
|
||||
{
|
||||
[c->button setTitle:uiprivToNSString(text)];
|
||||
}
|
||||
|
||||
void uiCheckboxOnToggled(uiCheckbox *c, void (*f)(uiCheckbox *, void *), void *data)
|
||||
{
|
||||
c->onToggled = f;
|
||||
c->onToggledData = data;
|
||||
}
|
||||
|
||||
int uiCheckboxChecked(uiCheckbox *c)
|
||||
{
|
||||
return [c->button state] == NSOnState;
|
||||
}
|
||||
|
||||
void uiCheckboxSetChecked(uiCheckbox *c, int checked)
|
||||
{
|
||||
NSInteger state;
|
||||
|
||||
state = NSOnState;
|
||||
if (!checked)
|
||||
state = NSOffState;
|
||||
[c->button setState:state];
|
||||
}
|
||||
|
||||
static void defaultOnToggled(uiCheckbox *c, void *data)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
uiCheckbox *uiNewCheckbox(const char *text)
|
||||
{
|
||||
uiCheckbox *c;
|
||||
|
||||
uiDarwinNewControl(uiCheckbox, c);
|
||||
|
||||
c->button = [[NSButton alloc] initWithFrame:NSZeroRect];
|
||||
[c->button setTitle:uiprivToNSString(text)];
|
||||
[c->button setButtonType:NSSwitchButton];
|
||||
// doesn't seem to have an associated bezel style
|
||||
[c->button setBordered:NO];
|
||||
[c->button setTransparent:NO];
|
||||
uiDarwinSetControlFont(c->button, NSRegularControlSize);
|
||||
|
||||
if (checkboxDelegate == nil) {
|
||||
checkboxDelegate = [[checkboxDelegateClass new] autorelease];
|
||||
[uiprivDelegates addObject:checkboxDelegate];
|
||||
}
|
||||
[checkboxDelegate registerCheckbox:c];
|
||||
uiCheckboxOnToggled(c, defaultOnToggled, NULL);
|
||||
|
||||
return c;
|
||||
}
|
||||
159
dep/libui/darwin/colorbutton.m
Normal file
159
dep/libui/darwin/colorbutton.m
Normal file
@@ -0,0 +1,159 @@
|
||||
// 15 may 2016
|
||||
#import "uipriv_darwin.h"
|
||||
|
||||
// TODO no intrinsic height?
|
||||
|
||||
@interface colorButton : NSColorWell {
|
||||
uiColorButton *libui_b;
|
||||
BOOL libui_changing;
|
||||
BOOL libui_setting;
|
||||
}
|
||||
- (id)initWithFrame:(NSRect)frame libuiColorButton:(uiColorButton *)b;
|
||||
- (void)deactivateOnClose:(NSNotification *)note;
|
||||
- (void)libuiColor:(double *)r g:(double *)g b:(double *)b a:(double *)a;
|
||||
- (void)libuiSetColor:(double)r g:(double)g b:(double)b a:(double)a;
|
||||
@end
|
||||
|
||||
// only one may be active at one time
|
||||
static colorButton *activeColorButton = nil;
|
||||
|
||||
struct uiColorButton {
|
||||
uiDarwinControl c;
|
||||
colorButton *button;
|
||||
void (*onChanged)(uiColorButton *, void *);
|
||||
void *onChangedData;
|
||||
};
|
||||
|
||||
@implementation colorButton
|
||||
|
||||
- (id)initWithFrame:(NSRect)frame libuiColorButton:(uiColorButton *)b
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
// the default color is white; set it to black first (see -setColor: below for why we do it first)
|
||||
[self libuiSetColor:0.0 g:0.0 b:0.0 a:1.0];
|
||||
|
||||
self->libui_b = b;
|
||||
self->libui_changing = NO;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)activate:(BOOL)exclusive
|
||||
{
|
||||
if (activeColorButton != nil)
|
||||
activeColorButton->libui_changing = YES;
|
||||
[NSColorPanel setPickerMask:NSColorPanelAllModesMask];
|
||||
[[NSColorPanel sharedColorPanel] setShowsAlpha:YES];
|
||||
[super activate:YES];
|
||||
activeColorButton = self;
|
||||
// see stddialogs.m for details
|
||||
[[NSColorPanel sharedColorPanel] setWorksWhenModal:NO];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(deactivateOnClose:)
|
||||
name:NSWindowWillCloseNotification
|
||||
object:[NSColorPanel sharedColorPanel]];
|
||||
}
|
||||
|
||||
- (void)deactivate
|
||||
{
|
||||
[super deactivate];
|
||||
activeColorButton = nil;
|
||||
if (!self->libui_changing)
|
||||
[[NSColorPanel sharedColorPanel] orderOut:nil];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self
|
||||
name:NSWindowWillCloseNotification
|
||||
object:[NSColorPanel sharedColorPanel]];
|
||||
self->libui_changing = NO;
|
||||
}
|
||||
|
||||
- (void)deactivateOnClose:(NSNotification *)note
|
||||
{
|
||||
[self deactivate];
|
||||
}
|
||||
|
||||
- (void)setColor:(NSColor *)color
|
||||
{
|
||||
uiColorButton *b = self->libui_b;
|
||||
|
||||
[super setColor:color];
|
||||
// this is called by NSColorWell's init, so we have to guard
|
||||
// also don't signal during a programmatic change
|
||||
if (b != nil && !self->libui_setting)
|
||||
(*(b->onChanged))(b, b->onChangedData);
|
||||
}
|
||||
|
||||
- (void)libuiColor:(double *)r g:(double *)g b:(double *)b a:(double *)a
|
||||
{
|
||||
NSColor *rgba;
|
||||
CGFloat cr, cg, cb, ca;
|
||||
|
||||
// the given color may not be an RGBA color, which will cause the -getRed:green:blue:alpha: call to throw an exception
|
||||
rgba = [[self color] colorUsingColorSpace:[NSColorSpace sRGBColorSpace]];
|
||||
[rgba getRed:&cr green:&cg blue:&cb alpha:&ca];
|
||||
*r = cr;
|
||||
*g = cg;
|
||||
*b = cb;
|
||||
*a = ca;
|
||||
// rgba will be autoreleased since it isn't a new or init call
|
||||
}
|
||||
|
||||
- (void)libuiSetColor:(double)r g:(double)g b:(double)b a:(double)a
|
||||
{
|
||||
self->libui_setting = YES;
|
||||
[self setColor:[NSColor colorWithSRGBRed:r green:g blue:b alpha:a]];
|
||||
self->libui_setting = NO;
|
||||
}
|
||||
|
||||
// NSColorWell has no intrinsic size by default; give it the default Interface Builder size.
|
||||
- (NSSize)intrinsicContentSize
|
||||
{
|
||||
return NSMakeSize(44, 23);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
uiDarwinControlAllDefaults(uiColorButton, button)
|
||||
|
||||
// we do not want color change events to be sent to any controls other than the color buttons
|
||||
// see main.m for more details
|
||||
BOOL uiprivColorButtonInhibitSendAction(SEL sel, id from, id to)
|
||||
{
|
||||
if (sel != @selector(changeColor:))
|
||||
return NO;
|
||||
return ![to isKindOfClass:[colorButton class]];
|
||||
}
|
||||
|
||||
static void defaultOnChanged(uiColorButton *b, void *data)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void uiColorButtonColor(uiColorButton *b, double *r, double *g, double *bl, double *a)
|
||||
{
|
||||
[b->button libuiColor:r g:g b:bl a:a];
|
||||
}
|
||||
|
||||
void uiColorButtonSetColor(uiColorButton *b, double r, double g, double bl, double a)
|
||||
{
|
||||
[b->button libuiSetColor:r g:g b:bl a:a];
|
||||
}
|
||||
|
||||
void uiColorButtonOnChanged(uiColorButton *b, void (*f)(uiColorButton *, void *), void *data)
|
||||
{
|
||||
b->onChanged = f;
|
||||
b->onChangedData = data;
|
||||
}
|
||||
|
||||
uiColorButton *uiNewColorButton(void)
|
||||
{
|
||||
uiColorButton *b;
|
||||
|
||||
uiDarwinNewControl(uiColorButton, b);
|
||||
|
||||
b->button = [[colorButton alloc] initWithFrame:NSZeroRect libuiColorButton:b];
|
||||
|
||||
uiColorButtonOnChanged(b, defaultOnChanged, NULL);
|
||||
|
||||
return b;
|
||||
}
|
||||
145
dep/libui/darwin/combobox.m
Normal file
145
dep/libui/darwin/combobox.m
Normal file
@@ -0,0 +1,145 @@
|
||||
// 14 august 2015
|
||||
#import "uipriv_darwin.h"
|
||||
|
||||
// NSComboBoxes have no intrinsic width; we'll use the default Interface Builder width for them.
|
||||
// NSPopUpButton is fine.
|
||||
#define comboboxWidth 96
|
||||
|
||||
struct uiCombobox {
|
||||
uiDarwinControl c;
|
||||
NSPopUpButton *pb;
|
||||
NSArrayController *pbac;
|
||||
void (*onSelected)(uiCombobox *, void *);
|
||||
void *onSelectedData;
|
||||
};
|
||||
|
||||
@interface comboboxDelegateClass : NSObject {
|
||||
uiprivMap *comboboxes;
|
||||
}
|
||||
- (IBAction)onSelected:(id)sender;
|
||||
- (void)registerCombobox:(uiCombobox *)c;
|
||||
- (void)unregisterCombobox:(uiCombobox *)c;
|
||||
@end
|
||||
|
||||
@implementation comboboxDelegateClass
|
||||
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
self->comboboxes = uiprivNewMap();
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
uiprivMapDestroy(self->comboboxes);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (IBAction)onSelected:(id)sender
|
||||
{
|
||||
uiCombobox *c;
|
||||
|
||||
c = uiCombobox(uiprivMapGet(self->comboboxes, sender));
|
||||
(*(c->onSelected))(c, c->onSelectedData);
|
||||
}
|
||||
|
||||
- (void)registerCombobox:(uiCombobox *)c
|
||||
{
|
||||
uiprivMapSet(self->comboboxes, c->pb, c);
|
||||
[c->pb setTarget:self];
|
||||
[c->pb setAction:@selector(onSelected:)];
|
||||
}
|
||||
|
||||
- (void)unregisterCombobox:(uiCombobox *)c
|
||||
{
|
||||
[c->pb setTarget:nil];
|
||||
uiprivMapDelete(self->comboboxes, c->pb);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
static comboboxDelegateClass *comboboxDelegate = nil;
|
||||
|
||||
uiDarwinControlAllDefaultsExceptDestroy(uiCombobox, pb)
|
||||
|
||||
static void uiComboboxDestroy(uiControl *cc)
|
||||
{
|
||||
uiCombobox *c = uiCombobox(cc);
|
||||
|
||||
[comboboxDelegate unregisterCombobox:c];
|
||||
[c->pb unbind:@"contentObjects"];
|
||||
[c->pb unbind:@"selectedIndex"];
|
||||
[c->pbac release];
|
||||
[c->pb release];
|
||||
uiFreeControl(uiControl(c));
|
||||
}
|
||||
|
||||
void uiComboboxAppend(uiCombobox *c, const char *text)
|
||||
{
|
||||
[c->pbac addObject:uiprivToNSString(text)];
|
||||
}
|
||||
|
||||
int uiComboboxSelected(uiCombobox *c)
|
||||
{
|
||||
return [c->pb indexOfSelectedItem];
|
||||
}
|
||||
|
||||
void uiComboboxSetSelected(uiCombobox *c, int n)
|
||||
{
|
||||
[c->pb selectItemAtIndex:n];
|
||||
}
|
||||
|
||||
void uiComboboxOnSelected(uiCombobox *c, void (*f)(uiCombobox *c, void *data), void *data)
|
||||
{
|
||||
c->onSelected = f;
|
||||
c->onSelectedData = data;
|
||||
}
|
||||
|
||||
static void defaultOnSelected(uiCombobox *c, void *data)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
uiCombobox *uiNewCombobox(void)
|
||||
{
|
||||
uiCombobox *c;
|
||||
NSPopUpButtonCell *pbcell;
|
||||
|
||||
uiDarwinNewControl(uiCombobox, c);
|
||||
|
||||
c->pb = [[NSPopUpButton alloc] initWithFrame:NSZeroRect pullsDown:NO];
|
||||
[c->pb setPreferredEdge:NSMinYEdge];
|
||||
pbcell = (NSPopUpButtonCell *) [c->pb cell];
|
||||
[pbcell setArrowPosition:NSPopUpArrowAtBottom];
|
||||
// the font defined by Interface Builder is Menu 13, which is lol
|
||||
// just use the regular control size for consistency
|
||||
uiDarwinSetControlFont(c->pb, NSRegularControlSize);
|
||||
|
||||
// NSPopUpButton doesn't work like a combobox
|
||||
// - it automatically selects the first item
|
||||
// - it doesn't support duplicates
|
||||
// but we can use a NSArrayController and Cocoa bindings to bypass these restrictions
|
||||
c->pbac = [NSArrayController new];
|
||||
[c->pbac setAvoidsEmptySelection:NO];
|
||||
[c->pbac setSelectsInsertedObjects:NO];
|
||||
[c->pbac setAutomaticallyRearrangesObjects:NO];
|
||||
[c->pb bind:@"contentValues"
|
||||
toObject:c->pbac
|
||||
withKeyPath:@"arrangedObjects"
|
||||
options:nil];
|
||||
[c->pb bind:@"selectedIndex"
|
||||
toObject:c->pbac
|
||||
withKeyPath:@"selectionIndex"
|
||||
options:nil];
|
||||
|
||||
if (comboboxDelegate == nil) {
|
||||
comboboxDelegate = [[comboboxDelegateClass new] autorelease];
|
||||
[uiprivDelegates addObject:comboboxDelegate];
|
||||
}
|
||||
[comboboxDelegate registerCombobox:c];
|
||||
uiComboboxOnSelected(c, defaultOnSelected, NULL);
|
||||
|
||||
return c;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user