Converting ANSI C to Hollywood?

Find quick help here to get you started with Hollywood
Post Reply
MarisaG1967
Posts: 24
Joined: Sat Jun 22, 2024 4:15 am
Location: South San Francisco, CA
Contact:

Converting ANSI C to Hollywood?

Post by MarisaG1967 »

I'm working on converting some small ANSI C programs to Hollywood and was wondering if anyone has tips on doing this...
--- https://amigacity.xyz - Website for all things related to the Amiga
--- https://hollywood.retro-os.live - Fan site for the Hollywood programming environment
--- https://discord.gg/ExmkwrV8ZA - Discord for Hollywood fans
Flinx
Posts: 342
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: Converting ANSI C to Hollywood?

Post by Flinx »

It's better to ask specific questions with code examples. It's almost impossible to answer this in such general terms.
MarisaG1967
Posts: 24
Joined: Sat Jun 22, 2024 4:15 am
Location: South San Francisco, CA
Contact:

Re: Converting ANSI C to Hollywood?

Post by MarisaG1967 »

I don't have any code examples yet. I was just asking for tips on doing this in general.
--- https://amigacity.xyz - Website for all things related to the Amiga
--- https://hollywood.retro-os.live - Fan site for the Hollywood programming environment
--- https://discord.gg/ExmkwrV8ZA - Discord for Hollywood fans
Flinx
Posts: 342
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: Converting ANSI C to Hollywood?

Post by Flinx »

Because the languages have very different levels of abstraction, we would need to know your level of knowledge for useful advice. The way you ask questions shows us how to answer.
A general tip: You need to understand how the program works in order to port it.
MarisaG1967
Posts: 24
Joined: Sat Jun 22, 2024 4:15 am
Location: South San Francisco, CA
Contact:

Re: Converting ANSI C to Hollywood?

Post by MarisaG1967 »

I'm a experienced C programmer, but new to hollywood... I understand the original code and have done the reverse (other languages to C) but this is a new project for me.
--- https://amigacity.xyz - Website for all things related to the Amiga
--- https://hollywood.retro-os.live - Fan site for the Hollywood programming environment
--- https://discord.gg/ExmkwrV8ZA - Discord for Hollywood fans
User avatar
airsoftsoftwair
Posts: 5830
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Converting ANSI C to Hollywood?

Post by airsoftsoftwair »

The biggest problem is probably to deal with data types. Hollywood doesn't have data types whereas C has data types of different quantities (char, short, int...) and most of them are also available as signed and unsigned types. So when porting such code to Hollywood you have to take great care that it behaves exactly as in C. The Cast() function can help here but even with that it can still be difficult to make sure the code behaves the same because in Hollywood all numeric values are basically 64-bit floating point values whereas C has a variety of data types and also distinguishes between signed and unsigned values.
Post Reply