Recent

Author Topic: Has anyone converted the C librarys to FreePascal?  (Read 16504 times)

Firewrath

  • New Member
  • *
  • Posts: 35
Has anyone converted the C librarys to FreePascal?
« on: September 25, 2019, 07:08:59 pm »
So forgive me if I'm being stupid, I tend to do that. >.>
But I know Pascal is 'C like' or 'C based' and that there are some semi-auto conversion tools out there, but you still have to have a pretty good understanding of C to use them. Which I don't. =/

The main reason I'm asking is a friend of mine wants to learn Programming, and has Never done anything like programming before, I'd like to point him at Lazarus/FreePascal for this, since it's so easy to start with, but there is a ...lack of good comprehensive tutorials online.
But there is a TON of stuff for C out there.
While I have played with programming and scripts off and on for years and can get by on some guess work and reading the docs for what I do, he is looking to improve himself for trying to find a new job.

So I was wondering if anyone has ever converted the base C librarys for use with FreePascal?
Where I could start him with Lazarus / FreePascal and then point him at C tutorials for further learning without trying to convert the everything to FreePascal as he goes.

...if not, I'll probably just point him to C or Rust. >.>

And today, the brake line of my car broke, so i'm only 'here' till I get it towed. >.>
*Sigh* So I'm not ignoring replys or anything. =/
...just one of those days.
« Last Edit: September 25, 2019, 09:48:08 pm by Firewrath »
Sorry. I currently don't have Internet Access. So my replies might take a week. -_-

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Has anyone converted the C librarys to FreePascal?
« Reply #1 on: September 25, 2019, 07:20:15 pm »
Just search Google for "Delphi Lazarus learn beginner" and you get a lot of hits. Or dont you have a Google?

Just like

https://delphi-lernen.de/

Starts with Delphi and continues with Lazarus.
German, but we have translators.

schuler

  • Full Member
  • ***
  • Posts: 223

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Has anyone converted the C librarys to FreePascal?
« Reply #3 on: September 25, 2019, 07:50:51 pm »
C was invented to write an operating system. Called Unix.
Pascal was invented to teach students.

garlar27

  • Hero Member
  • *****
  • Posts: 652
Re: Has anyone converted the C librarys to FreePascal?
« Reply #4 on: September 25, 2019, 08:10:03 pm »
Forget about C.

Your friend should start with Pascal (to learn the basics and good practices) and then move to Kotlin, Android, NodeJS, Angular, Java, Python, what so ever. Although Object Pascal is powerful, on those languages is where the money is, right now.

Firewrath

  • New Member
  • *
  • Posts: 35
Re: Has anyone converted the C librarys to FreePascal?
« Reply #5 on: September 25, 2019, 08:18:18 pm »
I have downloaded all the SchoolFreeware FreePascal tutorial vids, and a collection of 30-40 others that I can't remember the name of.
I also have:

StartProgUsingPascal.pdf
FreePascalFromSquareOne.pdf
pascal_tutorial.pdf (from Tutorials Point)
pascal_quick_guide.pdf
modern_pascal_introduction.pdf
(not to mention the 50 other webpages/forum post I have downloaded -_- )

but all those just repeat the basics mostly.

So, Yes. I have heard of google. :P
And I have thought about just letting him learn Delphi, but I know there is weird conversion stuff between Delphi and Lazarus. So I thought I see if anyone had converted C, since it would hopefully be easyer to sort out without having confusing "Well it looks right but..." issues.


As for 'where the money is'...
Thats why I figure C or Rust.
C is used almost everywhere still and everyone is all excited about Rust and looking to move over to it for some reason. I heard Microsoft was looking at adding it to Windows.
I wont be able to help him if he has issues there, but it would probably be good for him to get in on it early'ish.
Sorry. I currently don't have Internet Access. So my replies might take a week. -_-

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Has anyone converted the C librarys to FreePascal?
« Reply #6 on: September 25, 2019, 08:37:17 pm »
For beginner stuff there is absolute no difference between Delphi and Lazarus.

If you look look enough in Google you will find a lot of stuff for advanced.

Here: With pointers, objects, classes, interfaces:

http://www.ggde.gr/dmdocuments/pascal_tutorial.pdf

Nice that you have a Google. But you must spent some time to use it.

And for the more advanced issues there are a lot of tutorials for the special things around.
 
Pascal is the best to learn as first language. C messes up the customs and should be learned when you know how to handle code!


440bx

  • Hero Member
  • *****
  • Posts: 3946
Re: Has anyone converted the C librarys to FreePascal?
« Reply #7 on: September 25, 2019, 08:40:39 pm »
he is looking to improve himself for trying to find a new job.
That sounds like that he just wants to acquire one or more skills that makes him more "valuable" to a potential employer.  The reason I point that out is because, acquiring some programming knowledge, which is fairly easy, is a very different proposition than becoming a professional programmer.

From what you've said, it sounds like his goal isn't becoming a professional programmer.

If that conclusion happens to be correct, I'd recommend he acquires some knowledge of "simpler" programming languages such as Python and AWK.  Knowledge of such languages would allow him to quickly implement solutions to common problems, which is usually what an employer wants.

The above said, Pascal would be a good choice for learning programming and, what is more important than whatever programming language he chooses to study is, being able to analyze problems and design well thought out solutions for them.  For that, I recommend the book "Oh Pascal" from Doug Cooper because he teaches the reader to evaluate a problem in the context of designing a computer program to solve it.  _That_ is the valuable skill, much more than just knowing the language.

(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Firewrath

  • New Member
  • *
  • Posts: 35
Re: Has anyone converted the C librarys to FreePascal?
« Reply #8 on: September 25, 2019, 09:47:52 pm »
That sounds like that he just wants to acquire one or more skills that makes him more "valuable" to a potential employer.  The reason I point that out is because, acquiring some programming knowledge, which is fairly easy, is a very different proposition than becoming a professional programmer.

From what you've said, it sounds like his goal isn't becoming a professional programmer.

Hrm, you know, I don't know 'for sure' but you are probably right.
The way he talked he wanted to learn programming to change jobs, so I probably got ahead of myself thinking he wanted to do it as a job more then he actually does.

Thanks for the advice, I shall talk to him more about it when I get the chance and pass that book along to him if he is interested. ^-^

(Though just to stay on topic, I still say the C librarys in FreePascal would be rather cool / handy and did get a little excited about it when I had the idea. >.>
...Also, so far, 6hrs till I can get towed. OMG x.x)
« Last Edit: September 25, 2019, 09:49:29 pm by Firewrath »
Sorry. I currently don't have Internet Access. So my replies might take a week. -_-

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Has anyone converted the C librarys to FreePascal?
« Reply #9 on: September 25, 2019, 10:06:42 pm »
Hi!

I don't know any really working C to Pascal Transpiler. Seems to be too complicated on code level.

But I found something antique in the deepth of my harddisk:

In 1989 Derek from Knowledge Software wrote a C to Turbo Pascal Transpiler! No classes, no objects. It is a DOS program! Try it!

Winni

del

  • Sr. Member
  • ****
  • Posts: 258
Re: Has anyone converted the C librarys to FreePascal?
« Reply #10 on: September 25, 2019, 11:09:13 pm »
I recommend learning C in order to get a clear understanding of memory management. Then you can make your own simple classes that manage their own memory and that takes away 99% of the hassle. Compile it of course as C++. But you're still down in the weeds. You'll get an appreciation of what happens in constructors and destructors. Then you can jump around between C++ and Free Pascal and see what you like and etc. I would also stay away from Python - you'll just pick up so much mush that you'll have to unlearn later IMHO.

RayoGlauco

  • Full Member
  • ***
  • Posts: 176
  • Beers: 1567
Re: Has anyone converted the C librarys to FreePascal?
« Reply #11 on: September 26, 2019, 12:14:51 am »
Pascal is a good language to learn the principles of programming. Before entering memory management, it is necessary to know what is a variable, a constant, the types of data, the basic control structures, the algorithms, and much more ...
To err is human, but to really mess things up, you need a computer.

garlar27

  • Hero Member
  • *****
  • Posts: 652
Re: Has anyone converted the C librarys to FreePascal?
« Reply #12 on: September 26, 2019, 12:56:58 am »
Pascal is a good language to learn the principles of programming. Before entering memory management, it is necessary to know what is a variable, a constant, the types of data, the basic control structures, the algorithms, and much more ...
I would like to add: You also need a compiler which help you to improve and is "your friend" and don't let you make silly mistakes or screw every thing up because of a wrong -type assignment.


I recommend learning C in order to get a clear understanding of memory management. Then you can make your own simple classes that manage their own memory and that takes away 99% of the hassle. Compile it of course as C++. But you're still down in the weeds. You'll get an appreciation of what happens in constructors and destructors. Then you can jump around between C++ and Free Pascal and see what you like and etc. I would also stay away from Python - you'll just pick up so much mush that you'll have to unlearn later IMHO.
Besides, C has the most shitty syntax you can find among the popular languages.

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Has anyone converted the C librarys to FreePascal?
« Reply #13 on: September 26, 2019, 01:44:22 am »
Yes, garlar27 - it is a shitty syntax. So many useless comments in curly bracketts ........

jamie

  • Hero Member
  • *****
  • Posts: 6091
Re: Has anyone converted the C librarys to FreePascal?
« Reply #14 on: September 26, 2019, 01:54:50 am »
It can't be that bad since fpc has adopted some of it.

+=,. -= *= etc..

 I kind of wish it would adopt a few other things from C but you can't have it all I guess.

 Like for example a compound assignment and Boolean test..

Code: Pascal  [Select][+][-]
  1.  If (SomeVar := AFunction(ParamsIfNeede)) = ? then
  2.  
An Assignment and Testing the results in a short line.
See the beauty in that  :D

Also I wish for a C escape string on the fly..

 If the string starts with " then it must finalize in a " and this can become a C style string where C escape code can be used etc..

 Oh well, Guess I better stop dreaming..
The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018