#💽Programming Chat v2
1 messages · Page 13 of 1
well yeah this makes sense

@spare quartz
use std::thread;
use std::sync::{Arc, Mutex};
struct Client {
token: Mutex<String>,
}
impl Client {
fn do_thing(&self, num: u8) {
let mut t = self.token.lock().unwrap();
*t = format!("token{num}");
}
}
fn main() {
let client = Arc::new(Client { token: Mutex::new("token".to_string()) });
let c1 = client.clone();
let c2 = client.clone();
let t1 = thread::spawn(move || thread(c1, 1));
let t2 = thread::spawn(move || thread(c2, 2));
t1.join().unwrap();
t2.join().unwrap();
println!("{:?}", client.token);
}
fn thread(client: Arc<Client>, num: u8) {
client.do_thing(num);
}
this works...maybe I will do this
atomic reference counted? no
I still think it sucks more than just having independent functions and creating state in each thread
but
¯_(ツ)_/¯
because now the user has to wrap their shit in an arc
rather than just
use std::thread;
fn main() {
thread::spawn(|| thread());
}
fn thread() {
let request_jar = Jar::new(Some("roblosecurity"));
// ...
}
Arc
i dunno!!!
do i look like a cdn expert
yes.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/home/miko/.ssh/github' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
ive goten that error a few times
You and your stupid furries
Why didn’t that embed
nooooooooo reasssonnn
Honestly this is probably the average Rust player
rust coder too
you just ignored the play I made on your name, avatar, and hatsune miku
no i didn't . i just went to :3ing
one man show
soiled it
❓
open it up
hold on i need to push
okay its open
theres a password
urghhhh
toulene:<passwd>?
dangit
good enough
lolgetrolled
toulene:lolgetrolled doesn't work

(yes im base64)
WOW your test file laughed at me @spare quartz
THAT WAS UNRELATED
oh
overgrown make
❌
overgrown make
package Install is
for Artifacts (".") use ("share");
end Install;
i wonder what this does
yours has it too
yeah but i dont know what it do
leave it up for a sec
you don't have Connection: Keep-Alive support?
noooooooope
the only two headers considered are:
Content-Length, Authorization
and authorization is only a subset
why do you ask
yeah
oh g
are you spamming it
how did you know :3
👁️.
I thought about it at first but deliberately left the HTTP request unfinished
so yeah if TCP connection closes before request is finished, deallocate
glad I helped you catch that 
hmm
lemme look at the ada wiki on how to fix this
hmm
something like that
wait oops
maybe make the delay a little longer
like
3-5s
?
in case some goober decides to use telnet
but surely there's a way to detect on the fly when the tcp connection closes
like how you did it with your smtp server
@spare quartz I assume you roll your own argument parsing
nope
GNAT
oh
i need to see if i can't shorten this tree
huh neat
and you said I could use GNAT extensions for the exe reader right...
oh wait is that different from a gnat extension
how do I use this
@spare quartz I'm not finding any resources for GNAT.Command_Line cuh
man this is dogshit
almost like nix
basically no docs
https://www.adacore.com/gems/gem-138-gnatcoll.command-line and read the file "g-comlin.ads"
where tf is g-comlin.ads
its a file in your gnat installation
with GNAT.Command_Line; (right click on the part after GNAT.)
well in ada the source code IS the docs
THIS IS LITERALLY JUST LIKE NIX
this is so ass
for quite a while???
I dont use vsc normally because the ada lsp is ass
its good enough personally
says all the errors
where tf does "Command_Line_Config" come from
you make it
oh it's in GNAT.Command_Line
this is so ass
just look at this
- well documented
- fields tell you what they do
- easy to use
I shouldn't have to read the source code to figure out wtf shit does
and then figure out how to use it right on my own
the alternative is reading the ada rm
in which there's nothing about GNAT.Command_Line
not to mention the only way I'm learning some of the ins and outs of this shit is by asking another person
of which there's like one other person besides you in the ada community
idfk how you found out some of the shit you know then
hm
ok how to structure
main file -> pe record called to read -> pe record delegates to other records that represent parts of the file?
main file -> giant procedure that just calls other functions defined elsewhere to read certain parts?
a mix?
ない限り
U+306A : HIRAGANA LETTER NA
U+3044 : HIRAGANA LETTER I
U+9650 : CJK UNIFIED IDEOGRAPH-9650
U+308A : HIRAGANA LETTER RI
Han unification is an effort by the authors of Unicode and the Universal Character Set to map multiple character sets of the Han characters of the so-called CJK languages into a single set of unified characters. Han characters are a feature shared in common by written Chinese (hanzi), Japanese (kanji), Korean (hanja) and Vietnamese (chữ Hán).
@spare quartz what u think
i dunno!!! i ad lib file formats
strangest article ever written??
its for the scp foundation fr fr
@timid quartz figured it out
it's not the best solution in my opinion, but it works
only thing to do nnow is https://datatracker.ietf.org/doc/html/rfc8446 ..
This document specifies version 1.3 of the Transport Layer Security (TLS) protocol. TLS allows client/server applications to communicate over the Internet in a way that is designed to prevent eavesdropping, tampering, and message forgery. This document updates RFCs 5705 and 6066, and obsoletes RFCs 5077, 5246, and 6961. This document also specif...
which is scary looking
What select do
Also why not just copy the way you did it for your smtp server
if delay completes, then reading Request is aborted
Also I don’t remember what I did
Hmmm gonna actually make a commit on my phone
That should be 'Read, not Input
annnnddd commiteddd
Hell yeah im gonna print this shit and put it on the wall in my dorm
Is the rust compiler really that slow
Yeah that's rly cool
It's just a frontend for every graphics API tho
Wait
Isn't tls supposed to be handled by os
If not why you bothering using a scary looking standard
no
handled by libraries usually installed on the system, like OpenSSL
but that's not dependable
Task 50: raised CONSTRAINT_ERROR : bad input for 'Value: "�Ѳ=!8P3�#�ilU��(+Qvs�:XM���1/
i agree
idk when my computer updates openssl its the most time consuming shit ever
@spare quartz so like....why have out params when you just have functions
Oh and before you say multiple return items, I raise you records
what if the same value needs to be modified multiple times
out of the shower now
having to save a record to its own variable and then using that to write to multiple sounds like a lot of work
over just having multiple outs
also sometimes it just makes sense like
procedure Main is
Imaginary_Stream : Stream_Access;
A_String : String (1 .. 32);
begin
A_String := String'Input (Imaginary_Stream); -- ??
String'Read (Imaginary_Stream, A_String);
end Main
Ok but like you’re making the variable anyways because out needs somewhere to put it, so then you just do a little Var := Other_Func (Var);
well duh obviously out needs somewhere to go
but if you're using a function that returns a record with multiple fields, you ALSO need to store that record somewhere
and then manually := for each field
A Heat-Seeking Missile switches to search mode if it loses its target. But what if it doesn't find a new target? Let's find out what happens in 18 seconds. _________________________________________________
To contact me directly: [email protected]
Our channel is about Aviation.
We make ...
got very good groundwork in place
Channel := Example_Stream.Wrap_Stream;
Channel.Enable_TLS;
A'Read (Channel.Stream, BlahBlahBlah); -- Reads from the TLS stream
Channel.Disable_TLS;
A'Read (Channel.Stream_Raw, BlahBlahBlah); -- Reads from the raw socket stream
A'Write ...
w
whats the context
ah
Omh
i should probably redo this one day.....
esp cause i just started spewing accesses
OMG HE'S DOING IT
would teh router route traffic without a tcp port
whar
aera
w aera
wdym
routers have ip's ik that theres some weird protocol that will send what port is used
idk if router just wont route packets to my pc
if theres no port number
im sure it would
would it go to every pc on my network lol
wait but how would it get to my computer
unless its sending to every computer
cuz it doesnt know
wait even worse
hmm
i don't see a clear answer but
the router would (probably) save what NAT ip called it and send back whatever it gets
theres a list of level 4 protocols in /etc/protocols folder
no clue what'd it would do on a portless/connectionless packet though
oh shee
wait wtf is nat this sounds complicated
network address translation
im reading the wikipedia page
since the router only has one external ip, and it could have multiple devices, it gives them all their own internal IP and sorts what gets what itself ("router")
it looks like spectrum gives my computer an ip specificaly for a single connection and then throws it into a bucket to be reused later when its done
wait
like 192.x
?!?!?
yeah
oh nice
it just rewrites it to the external ip (nat)
and decides who to send it to when a response is back
but...
ya
maybe it just handles it as if the router is the device?
like an ICMP request would have the router be the device handling it instead of a fwd'd computer
im talking mostly on ancedotal knowledge so i might be wrong
im allways on anecdotal knowledge
lmao
man I want to just get a bunch of switches and pi's and write an entire network stack lmao
yeah it onl works if theres a port
NAT
im looking at it and everything is just mapping a port to a private/virtual ip
it seems like its superseded by some DHCP thing though which my router has version numbers listed for
oh nope dhcp is completely different
but supersecedes it
lol
DHCP is for allocating internal ips and some other stuff i dont know about
oh
the wikipedia page says computers just ask for internal ip
over udp with dhcp protocol
woah my router runs on linux
damn thats actually cool
i know theres certain ones you can exploit and open a shell on with stuff like telnet
but i've got virtually no exp there
sounds like hacker
oh damn everyones asleep
only my phone and laptop have internal ip's for some reason
Dynamic NAT
Dynamic NAT allocates public IP addresses from a pool to devices on a local network on a first-come, first-served basis.
but from reading this doesnt seem true
damn I jsut realized thats ai hallucination lmao
was this from google search ai
it was below it
from some random website
taht was probably ai generated lmao
crazy cuz i tried doing the chatbot thing on my rtx 2050 and it ran faster than chatgpt.com and was smarter lmao
yeah nat's built on ports
nat wont be helping the packet get to my pc
router either discards/handles it itself then
oh eah
I cant send data over icmp though
wait Ican but it will allways end up at the router
and is meant to be garbage anyways
wait I forgot
my head threw out everything else and had icmp on the burner so started rambling on it lmao
Pasting some links here for safekeeping
and don’t even THINK about calling me a rust… user… just cause your language is interesting doesn’t mean I’d ever use it!!!(*)
Haha

atp why are you stealing katsumi’s pfp
@lyric mesa PFP theft

rust user rust user rust user rust user
atprustages
rust virus
I tried to infect myself but there too many compile errors
You need to learn rust before you can jump into a decently-sized project imo
Terry learned that the hard way
goddamn
and I still go to stackoverflow because chatgpt will hallucinate answers for me
like I actually haved to wrestle with chatgpt to get useful answers on some random things
but ollama exists and llama feels smarter
or atleast its been more useful
Floating point exception (core dumped)
why cant it just give 0 like normal division
normal division doesn't prescribe a value for dividing by 0
it just 0
no, it's undefined
undefined is undefined
undefined is nothing is zero is 0
okay undefined is something
woah
it's just... not defined, it's not a usable value
wha
I was looking in the manual
it's supposed to give an fpu error 😭
no this is normal division on like rax or something
oh
without the dont fault bit set or something
udiv or whatever
divide error
x87, the 256/512 bit registers
it's hardware level stuff they want to be fast instead of just manually doing it with bits n stuff in the regular registers
ough
woah theres 512 bit registers
im gonna fuckin die
im looking at 1.3.6 exceptions in the intel manual
and it says " as an example, divide by zero gives an exception" and then it shows a page fault
AVX-512 are 512-bit extensions to the 256-bit Advanced Vector Extensions SIMD instructions for x86 instruction set architecture (ISA) proposed by Intel in July 2013, and first implemented in the 2016 Intel Xeon Phi x200 (Knights Landing), and then later in a number of AMD and other Intel CPUs (see list below). AVX-512 consists of multiple extens...
i don't think i have AVX-512 on my computer 😭
wait no I was surprsied that they were part of teh fpu
I have 256
well I used to have 256
now i have avx-512
lemme get my cpuid
i'm pretty sure sse is obsoleted as part of avx
oh avx
fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl tsc_reliable nonstop_tsc cpuid extd_apicid pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy svm cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext perfctr_core ssbd ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves clzero xsaveerptr arat npt nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold v_vmsave_vmload umip vaes vpclmulqdq rdpid fsrm
shhh you don't get to see my cpus bugs
opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 f
ma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misa
lignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_
pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a rdseed adx smap clflushopt clwb
sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoi
nvd cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsa
ve_vmload vgif v_spec_ctrl umip pku ospke vaes vpclmulqdq rdpid overflow_recov succor smca fsrm```
I dont have mmx
wait I have mmx and you dont
hold on are you intel or amd
amd
what cpu
Vendor ID: AuthenticAMD
Model name: AMD Ryzen 5 7535HS with Radeon Graphics
5500GT,
CPUID reports as
processor : 11
vendor_id : AuthenticAMD
cpu family : 25
model : 80
your newere than me
CPU family: 25
Model: 68
amd is dropping cpu features cuz compilers jsut arent using them fr fr
🙏
are you doing this from wsl
yeah but the CPUID should still report the same
no hyperv is shit
its cuz your terminal isnt large enough
imagine if wmic cpu | notepad works
and then you can make the font smaller if itw orks
lol
just opens notepad unfortunately
aw man
forced to use >>
wdym
windows added sudo
wha
and also command prompt doesnt have | but > is from multics I think
I really feel like it isnt an ms-dos emulator
and its more useful than powershell fr
i think powershells more powerful
powershell is a linux emulator fr fr
it's just a lot more clunkier to use
well powershell feels more powerful because everythings documented
cmd you haved to have advanced knowledge gained from teh depths of the internet
(which is really just because microsoft sucks at documenting programs in System32)
it gives admin
dyamn
authority/system is crazy
you can actually taskkill your own explorer and open the SYSTEM one in your session
doesn't last a while but you can technically have a SYSTEM "user"
heres an image with the SYSTEM explorer open
it's quite broken but apps you installed globally will be there
imagine if it just sees the file not looking right and copies it
when you startup
and it would brick if it didnt do that
lol
ew nvcuda
why is cuda so shit man
like nvidia forces you to fucking use this x thing
meanwhile opencl workso n fucking everything
well cuh it runs ntdll.dll
oh
windows prints entire event long to com if you have kernel debug on I think
neat
thats gotta be a compat thing
I mean microsoft had to change the uefi spec themselves
so windows could boot
so it was even possible to use eufi
cuz it was just so shi
lol
a bunch of bootloaders use real mode calls
because they are just so convenient
57 bit?
Intel 5-level paging, referred to simply as 5-level paging in Intel documents, is a processor extension for the x86-64 line of processors.: 11 It extends the size of virtual addresses from 48 bits to 57 bits by adding an additional level to x86-64's multilevel page tables, increasing the addressable virtual memory from 256 TB to 128 PB. The ext...
average behavior
HEY I COULDVE USED THIS
WHEN I WAS LEARNING PAGING
so many shit graphs and then wikipedia just comes up with one
yeah wikipedias a really good resource sometimes
I didnt even look at 5 level paging because amd doesnt ahve it
actually good graphs of whats going on instead of a non-linear weird spec
yea
user level forced bsods 💪
apparently it's a good way to display messages on the screen outside of the usual windows env
undocumented though
using ntraiseharderror as a way to printdebug
Introduction Message boxes provide a simple way to show feedback to the user. In user-mode, a message box can be shown with the MessageBoxW API function. However, this API does not exist in kernel-mode. One of the common ways to display info from kernel-mode is the DbgPrint API, which can be listened to from DbgView or an attached Kernel debugge...
the way people figure this out is beyond me
they dissassemble the entire windows kernel and then read through the assembly and figure out how it works
windows.h is already bad and they want to go even deeper
oh cool
ntdll.dll also provides a little C lib too
and why hasnt intel made a memcopy instruction yet
intern decided its time to be funn
wouldn't surprise me
the simple disk format menu was written like
20 years ago
and hasn't changed
1988 is 2 years after windows 1.0
also 5/11 5:11
5/11 5:11 means its definitely intentional lmao
but I cant find anything on what 511 means
naw its gotta be some epoch/bit thing
and nothing happened on 5/11
894863460
unless its a memory address
why would it be
¯_(ツ)_/¯
fr
im not a pe32 doctor
I swear to god its a reference raaah
am looking at pe header
cant find a thing even saying linker timestamp
maybe it's in a section? if pe has those
oh wow
apparently GNAT statically links executables by default
-shared made it go from 3 MB to 281 kb
oh
it also breaks the executable
😁
at least the one on linux works
probably doesn't run cause im missing GNAT on windows
oof
bruh im gonna compile my kernel with -pie so I dont haved to bother anymore lmao
weird ahh virtual memory
raised ADA.IO_EXCEPTIONS.USE_ERROR : Unable to get modification time of the file "C:\Users\Adenosine3Phosphate\Downloads\Auto-GCAS_Saves_Unconscious_F-16_PilotΓÇöDeclassified_USAF_Footage.webm.480p.vp9.webm"
aaaaaaaaaghhhhghg
lmao
damn they in the same place
now that im trying to compile with pie I haved to somehow convince ld to work
oh im not even using ld lmao
okay
it looks like this is some sort of windows problem instead of ada
apparently with file names using unicode it just errors when trying to get modification time
Disassembly of section .data:
00000000 <.data>:
0: e9 3b 04 00 00 jmp 0x440```
uhm idk if tats position independent or not
it does jmp 0x440 as if the program is just at 0 instead of being anywhere it wants
cc1: error: code model kernel does not support PIC mode
bruh
GLOBAL_OFFSET_TABLE
WHY DOES THAT EXIST
why??
apparently x86 has some relative jumping thing
so jmp rel 0x40 jumps forward 0x40 ez pz
but gcc cant use that cuz gcc is too smart apparently
aha
found you
ohhh
it's cause they were using GetFileAttributesExA
GetFileAttributesExW ftw
@spare quartz what the hell
I know that's a lot of images
but
this shit is little endian apparently/?
little endian on 2-byte boundaries
also why is it 16#455000# when it should have an additional null byte what
Yeah I print the index and it’s at 132 not 133 (starts at 128)
Unless it needs to start at index 129…?
yeah it does because ADA USES 1-INDEXING
@spare quartz is there a fairly clean way to do bit vectors in ada
namely reading a bit vector into a record
so like
type Flag_Record is record
Flag_1 : Boolean;
Flag_2 : Boolean;
Flag_3 : Boolean;
Flag_4 : Boolean;
end record;
Flag := 2#0110#;
-- Take binary flag -> put into struct
or do you just have to brute force it
Mf didn’t read the array definition
1-indexing SUCSK
with Pack; or with Size, but strange things might happen if it’s not a full byte and you try reading
it's a full byte
multiple...full bytes...
https://gcc.gnu.org/onlinedocs/gcc-14.1.0/gnat_rm/Security-Hardening-Features.html
https://gcc.gnu.org/onlinedocs/gcc-14.1.0/gnat_rm/Aspect-Local_005fRestrictions.html
Security Hardening Features (GNAT Reference Manual)
Aspect Local_Restrictions (GNAT Reference Manual)
The attribute typ'Deref(expr) where expr is of type System.Address yields the variable of type typ that is located at the given address. It is similar to (totyp (expr).all), where totyp is an unchecked conversion from address to a named access-to-typ type, except that it yields a variable, so it can be used on the left side of an assignment.
Oh what
Reading the GCC manual and everything in the Ada manual is marked as “followed.” But when it’s onto annex H…
Shifts and Rotates (GNAT Reference Manual)
bye bye partition
yknow i want this sticker pack just for funsies
2 or 4
?
the "Characteristics" is just a bit vector
so uhh
type Characteristics is record
-- ...
with Size => 16
with Representation => Unsigned_16
end record;
?
a representation clause determines how the record is structured in memory (and stream wise aswell)
assuming the file's binary structure isn't packing it in with other data it should read fine
(the "record" on the bottom is a rep. clause)
cause otherwise the compiler could theoretically make your record weird in the interest of speed/memory
GCC generally doesn't do anything extreme, but... the added assurance is nice
also god i'm mad at GCC
tried* to compile a mingw cross for 14.2.0 again and it failed like every other attempt
all i can do is wait until it's available on apt
the shell must grow
:haha:
makefile makefile makefile
ITS NOT A MAKEFILE
type Characteristics is record
Stripped_Relocations, Is_Executable, Stripped_Line_Nums,
Stripped_Symbols, Aggressive_WS_Trim, Large_Addr_Aware,
Bytes_Reversed_Lo, Is_32_Bit, No_Debug_Info, Is_Removable,
Is_Net, Is_FS, Is_DLL, Only_Uniprocessor,
Bytes_Reversed_Hi : Boolean;
end record;
this
is gonna be big
if you want to be lazy and not write a clause out for that
with Size => 16, Pack; you can throw these aspects on it
of course the compiler can change the structure to whatever it wants, but it shouldn't... hopefully
if you're compiling with -O2/3 i don't think it'd try anything silly
maybe with -Ofast or -march but i don't think that's likely
prepare for tediousness
mm nvm there's only one reserved bit
oh yeah one thing that won't affect you here but just something you should know
wait where do I throw these
you unfortunately can't overlap record fields onto each other in a rep clause (which adds a bit of difficulty when dealing with embedded stuff) but you can always just delegate to using Unsigneds and shifting
pragma Pack (R);
for R'Size use 49;
?
after end record* since they're aspects of the record type
o
a lot of pragmas are obsolescent in favor of aspects (with ...) but certain ones like Warnings are still used
scpsl server list error againnnnnn
The_Record_Type'Read (Stream, A_Record_Variable) procedure
The_Record_Type'Input (Stream); function
"error: component "Characteristics" cannot be used before end of record declaration"
show record type
type Characteristics is record
Stripped_Relocations, Is_Executable, Stripped_Line_Nums,
Stripped_Symbols, Aggressive_WS_Trim, Large_Addr_Aware,
Reserved, Bytes_Reversed_Lo, Is_32_Bit, No_Debug_Info,
Is_Removable, Is_Net, Is_FS, Is_DLL, Only_Uniprocessor,
Bytes_Reversed_Hi : Boolean;
end record with Size => 16, Pack;
you probably named a field the same as your type
OH
nono
yeah I did
the- yeah
teehee
aaand it didn't work right
h i typed all the bits in order
maybe I have to type them in reverse order...
because little endian...
wait no
is the file in LE?
if the structure is right i'd say just use a rep clause
no PEs are LE
the more i type the more i think im gonna be kicked from this server for being afk
me no wanna type all that...
...I might have to
oh yeah btw
Effect of Bit_Order on Byte Ordering (GNAT Reference Manual)
(will not change endian)
this didn't work
actually no it will change endian huh
oh
what's the record showing in binary, and whats the actual value
how can I print the record as binary lol
either Unchecked_Conversion or just 'Image it and type it out
(STRIPPED_RELOCATIONS => FALSE,
IS_EXECUTABLE => FALSE,
STRIPPED_LINE_NUMS => TRUE,
STRIPPED_SYMBOLS => FALSE,
AGGRESSIVE_WS_TRIM => FALSE,
LARGE_ADDR_AWARE => TRUE,
RESERVED => FALSE,
BYTES_REVERSED_LO => FALSE,
IS_32_BIT => TRUE,
NO_DEBUG_INFO => FALSE,
IS_REMOVABLE => FALSE,
IS_NET => FALSE,
IS_FS => FALSE,
IS_DLL => FALSE,
ONLY_UNIPROCESSOR => FALSE,
BYTES_REVERSED_HI => FALSE)
00100100 10000000
though if I read an Unsigned_16 it shows a different value
oh?
I think
lemme check
2#1000101110#
how can I make it output all the bits
and not trim
cause it omitted like 6 zeroes
i dunno, string ops or something in integer io
but that's really weird... are you sure the record is 16 bits
what about the parent record
the parent record doesn't have a size attribute
are you reading into it or just reading it entirely
I'm manually reading the other fields in the parent record
hm
yeah that's really weird
if you can't figure out what bits its reading off, just use an unchecked_conversion
(i'd reccomend putting the unchecked conv in a custom 'Read)
this is confusing
what is
function Convert is new Ada.Unchecked_Conversion (Source => Unsigned_32, Target => Characteristics_Flags);
...
H.Characteristics := Convert (Unsigned_32'Input (S));
do you know where in the file its reading from
(you can also use this to do the reverse)
it appears to be the correct place
hmm
coff_header.adb:1:09: warning: unit "Ada.Unchecked_Conversion" is never instantiated [-gnatwu]
coff_header.adb:11:16: error: subtype mark required in this context
coff_header.adb:11:16: error: found "Unchecked_Conversion" declared at a-unccon.ads:20
coff_header.adb:11:38: error: incorrect constraint for this kind of type
coff_header.adb:21:28: error: expected type "Characteristics_Flags" defined at coff_header.ads:5
coff_header.adb:21:28: error: found type "Convert" defined at line 10
procedure Read_Header (S : Stream_Access; H : out Header) is
type Convert is
new Ada.Unchecked_Conversion (Source => Unsigned_16,
Target => Characteristics_Flags);
begin
neat
this could potentially be why: https://gcc.gnu.org/onlinedocs/gnat_rm/Attribute-Object_005fSize.html#Attribute-Object_005fSize
Attribute Object_Size (GNAT Reference Manual)
but think about the poor cpu!!!!!!!!
it's not awful to use it when you have a reason to
the names a bit misleading though, its more like Unchecked_Copy
do I still need with Size => 16, Pack; here?

(you might get a trinary boolean!!!)
technically valid in ada.... up until you use it
I may change this and similar to use the fancier method though
with the funny clause
where is that bit type defined..
most likely an example type of Boolean with size 1
custom type then...
i would also recommend you have a bitflipper like the one i made for PNG just in the tiny tiny case the host system is BE
but its not needed cause you're on an LE computer
ill flip ur bits
❌
(you could've just said new boolean 😭)
smh
but that's fine if you're expecting to do like, ...
shifts or rotations on a bit type ...
with Bit_Order =>
the characteristics
(i've never really known what bit_order was for in all seriousnes.........)
what of
raised CONSTRAINT_ERROR : coff_header.ads:7 invalid data
Load address: 0x1086bf000
Call stack traceback locations:
0x1086c0a57 0x1086c0bd3 0x1086c0346 0x1086e5007 0x7ff803c382cb
INVALID DATA!!!! THIS MF HAS A GOOFY BOOLEAN 🚨
also wow your stacktrace is... weird.. are you using symbolic traceback in your binder
or do you intend to use addr2line
idfk
same with mod 2 ** 1
sadge
uGHHH unchecked_conversion it is...
i might try and write an exe reader myself to see if i could try and get something working
-# in rust
but not now!!!!
i would ask if i should use libadalang or try and make my own parser but like
nopppeee
ugh if only this was C
libadalang is >6 years old and they haven't even completed it
C structs map so cleanly onto memory
so do ada recrods...
i think you just need a few more aspects
like what
is this in bits or bytes
bits
no work
Size => 16,
Object_Size => 16,
Bit_Order => System.Low_Order_First,
Pack;
more aspects bro.... more aspects.......
in all seriousness i really don't know why it's not representing right
also btw
forgot to say this but when i said a custom 'Read i mean like
for A'Read use Custom_Read;
ah ic
where Custom_Read is a procedure that follows the semantics defined by 'Read
ask your little ada people on your ada mailing list
im too scared
there's probably gonna be a programmer with 90 years of experience saying my computer is all wrong
like 1 or 8
honestly it might be 8
i think the Size is 1, but the Object_Size is 8
grrrrrrrr maybe that's why it's not representing right
i should decide wehter to -
oh
well thats interesting...

typedef struct {
unsigned int flag1 : 1;
// ...
} characteristics_t;
i bet this would work just fine
yeah but : 1 dictates size
im going to bed but I will watch
0b1110001100011100
I have 2 pages of Japanese to write by Wednesday morning 
bayachao reference
anyways what are you trying hmm
gonna read this into a record and see if it works
I swear I always have issues with bit vectors/fields in languages that aren’t C
this is the one thing ada should have in the bag which is why im so confusd about it
uhhh crap how do i write binary to a file in shell
Like when I was doing this in Zig I had to wrap their “packed struct” in an “extern struct” to force C ABI so that it would read the vector right
END_ERROR...???
oh oops
i was deleting the file
Hi! I’m looking at the error handling story of Ada, which seems to be pretty much all-exception based (and “unchecked” in Java parlance). An alternative to exceptions which I’ve learned to appreciate is the use of option/maybe types or result/either types. Because it forces the caller to check the possible error state, which is carried over by...
heh
Also @spare quartz new css update dropped https://youtu.be/A89FMtIkWKc
CSS just got a brand new official logo. Let's take a look at some of the coolest new features available to HTML and CSS programmers in 2024.
#webdevelopment #programming #thecodereport
💬 Chat with Me on Discord
🔗 Resources
How to deal with CSS https://youtu.be/ouncVBiye_M
Code this, not That... CSS Edition http...
anyways I sleep, I will see your results in the morning
cool, when will we be wirting apps in it
okay yeah
'Read just seems to be really poor at reading records like this
WHUH
@timid quartz
pragma Ada_2022;
with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO;
with Ada.Text_IO;
with Example;
procedure Basic_Exe_Reader is
F : File_Type;
S : Stream_Access;
R : Example.Example;
begin
Open (F, In_File, "bbso");
S := Stream (F);
Example.Example'Read (S, R);
Ada.Text_IO.Put_Line ("Checked Read: " & R'Image);
Close (F);
end Basic_Exe_Reader;
with Ada.Streams;
package Example is
type Bit is new Boolean with
Size => 1;
type Example is record
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P : Bit := False;
end record with
Size => 16;
for Example use record
A at 0 range 0 .. 0;
B at 0 range 1 .. 1;
C at 0 range 2 .. 2;
D at 0 range 3 .. 3;
E at 0 range 4 .. 4;
F at 0 range 5 .. 5;
G at 0 range 6 .. 6;
H at 0 range 7 .. 7;
I at 1 range 0 .. 0;
J at 1 range 1 .. 1;
K at 1 range 2 .. 2;
L at 1 range 3 .. 3;
M at 1 range 4 .. 4;
N at 1 range 5 .. 5;
O at 1 range 6 .. 6;
P at 1 range 7 .. 7;
end record;
private
procedure Read_Example
(Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Item : out Example);
for Example'Read use Read_Example;
end Example;
with Ada.Unchecked_Conversion;
package body Example is
procedure Read_Example
(Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Item : out Example)
is
type U16 is mod 2**16 with
Size => 16;
function Convert is new Ada.Unchecked_Conversion (U16, Example);
begin
Item := Convert (U16'Input (Stream));
end Read_Example;
end Example;
giant message but basically here's what you should do
probably should note down 'Read is bad for records in my head somewhere
DEFAULT 'READ
truly limited by our time...
