Recent

Author Topic: How to rewrite this type example ?  (Read 5844 times)

Re-searcher

  • New Member
  • *
  • Posts: 16
How to rewrite this type example ?
« on: May 06, 2021, 04:08:35 pm »
Hi everyone,

Congratulations to the designer for creating this Visual IDE and FPC

I am translating a program from basic to Laz/FPC but have the following problem.
The program does not know this example with type.
Have an error by compiling.
How can I rewrite this now?

Type ConstMeta
  Value As String
  Startup As String
End Type

With best regards,
Erik

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: How to rewrite this type example ?
« Reply #1 on: May 06, 2021, 05:00:00 pm »
Not knowing BASIC, but surely that's just a simple record containing two strings?

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Re-searcher

  • New Member
  • *
  • Posts: 16
Re: How to rewrite this type example ?
« Reply #2 on: May 06, 2021, 06:45:13 pm »
Thanks MarkMLl for the quick response

the language was FreeBasic.

Erik

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: How to rewrite this type example ?
« Reply #3 on: May 06, 2021, 06:48:10 pm »
If that type is the FreeBASIC one then yes, it's (more or less) the equivalent of a Pascal record:

Code: Pascal  [Select][+][-]
  1. type
  2.   ConstMeta = record
  3.     Value: String;
  4.     Startup: String;
  5.   end;
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Re-searcher

  • New Member
  • *
  • Posts: 16
Re: How to rewrite this type example ?
« Reply #4 on: May 07, 2021, 01:54:04 pm »
Thanks lucamar for your answer.

The program was for programming PIC and AVR MCU's
But has no IDE for Linux , only for Windows.
It is gcbasic and made in FreeBasic
gcbasic has new keywords.
http://gcbasic.sourceforge.net/Typesetter/index.php/Home

Freebasic has no IDE and no designer like Lazarus in Linux.
Geany has an IDE but no designer.

I want to create a program with the designer and communicate with the PIC or AVR MCU (Microcontroller)
https://en.wikipedia.org/wiki/Microcontroller

With kind regards,
Erik

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: How to rewrite this type example ?
« Reply #5 on: May 07, 2021, 02:55:11 pm »
I want to create a program with the designer and communicate with the PIC or AVR MCU (Microcontroller)

So what language are you trying to write in? Your OP said you were converting /to/ Pascal, but if you're asking how to program in BASIC you're not really in the right place.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

dseligo

  • Hero Member
  • *****
  • Posts: 1196
Re: How to rewrite this type example ?
« Reply #6 on: May 07, 2021, 03:42:25 pm »
So what language are you trying to write in? Your OP said you were converting /to/ Pascal, but if you're asking how to program in BASIC you're not really in the right place.

Int the first post he said:
Quote
I am translating a program from basic to Laz/FPC but have the following problem.

By designer he probably means Lazarus' IDE (and visual design of forms).

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: How to rewrite this type example ?
« Reply #7 on: May 07, 2021, 04:43:43 pm »
So what language are you trying to write in? Your OP said you were converting /to/ Pascal, but if you're asking how to program in BASIC you're not really in the right place.

Int the first post he said:
Quote
I am translating a program from basic to Laz/FPC but have the following problem.

By designer he probably means Lazarus' IDE (and visual design of forms).

I can see what he said, which is why I referred to his OP. So why's he complaining that his BASIC tools don't have "a designer"?

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: How to rewrite this type example ?
« Reply #8 on: May 07, 2021, 04:47:44 pm »
So why's he complaining that his BASIC tools don't have "a designer"?

AFAICT, he's not complaining, he's explaining why he wants to move from BASIC to Pascal, to wit: because of our wonderful "designer" :D
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: How to rewrite this type example ?
« Reply #9 on: May 07, 2021, 05:14:41 pm »
AFAICT, he's not complaining, he's explaining why he wants to move from BASIC to Pascal, to wit: because of our wonderful "designer" :D

Well, in that case I think we unite in welcoming him. I was just a bit concerned by his "BUT..." :-)

Obviously there's quite a few of us who've put work into getting Lazarus/FPC apps talking to microcontrollers, so he didn't really have to quote Wp at us :-)

MarkMLl


MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Re-searcher

  • New Member
  • *
  • Posts: 16
Re: How to rewrite this type example ?
« Reply #10 on: May 10, 2021, 06:09:25 pm »
@MarkMLl

If the people deliver a piece of code, these people also expect a piece of code in return.
The topic also said: How to rewrite this type example?

You also wrote: So what language are you trying to write in?
This furum is about pascal.
So the basic language to Pascal.
I couldn't do anything with your ordinary text file that you gave me.

The only person who helped me is lucamar.

The microcontroller that was just one example.
This is because they now use it.
I also built the interface between a microcontoller and a the PC by myself.

I could also have said: an old CNC from 1966 with a PC.
I have also done this inteface.
Or a link between a PLC and a PC. Have even built an interface for this.
Built an OBDII tool..
Modems built ..... Morse, telex, fax, packet radio

Erik

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: How to rewrite this type example ?
« Reply #11 on: May 10, 2021, 07:04:53 pm »
@MarkMLl

If the people deliver a piece of code, these people also expect a piece of code in return.

This is not a FreeBasic forum. You can't expect people to know obscure Basic dialects here.

Moreover, basic (record and other) syntax can be easily gained from 20 minutes of reading the reference manual.  Something I suggest to read anyway.




« Last Edit: May 10, 2021, 07:09:21 pm by marcov »

Re-searcher

  • New Member
  • *
  • Posts: 16
Re: How to rewrite this type example ?
« Reply #12 on: May 13, 2021, 05:43:09 pm »
Hi everyone,

My country language is not English but dutch.
I am an old person and I have not had to work for a while now.
It is not easy to learn a new computer language that is also written in English with new and incomprehensible words.
The documentation that is in a language other than my country language

The last 3 years at school I only had a calculator.
In recent years, that has been head arithmetic.
Back then, computers at school did not exist.
This was my first PC: Commodore c64 (64kb) with data set 1530 (tape recorder)
The only record I knew was  : PRESS PLAY AND RECORD ON TAPE
Basic V2.0 This is the only basic I know.

At work I learned PLC programming and assembler.


This was the answer from MarkMLl.
Not knowing BASIC, but surely that's just a simple record containing two strings?


Then why can't MarkMLl write in pascal? Can't this person write in Pascal either ?


I hope you now understand and have an understanding of old persons like me.


Erik


MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: How to rewrite this type example ?
« Reply #13 on: May 13, 2021, 06:23:41 pm »
My country language is not English but dutch.
I am an old person and I have not had to work for a while now.
It is not easy to learn a new computer language that is also written in English with new and incomprehensible words.
The documentation that is in a language other than my country language

I agree that it's regrettable that the language and documentation doesn't conform to your native language, but I suggest that you take that up with Wirth- who despite his appointment at ETH in Zurich designed the language using English keywords and has always documented it in English.

Quote
The last 3 years at school I only had a calculator.
In recent years, that has been head arithmetic.
Back then, computers at school did not exist.

Calculator? You had a calculator while at school? You obnoxious young whippersnapper, when I was at school I was grateful to have a decent sliderule and mathematical tables and I didn't have access to a desktop computer until my fourth year at university.

Now I know that /some/ schools had access to the county mainframe using a Teletype- ever seen one of those? or by mailing off coding forms to be punched onto cards- ever done that and had to wait a week for the syntax errors to be sent back to you?

Quote
This was my first PC: Commodore c64 (64kb) with data set 1530 (tape recorder)
The only record I knew was  : PRESS PLAY AND RECORD ON TAPE
Basic V2.0 This is the only basic I know.

At work I learned PLC programming and assembler.

So? Some of us had to do stuff like that using ladder diagrams or machinecode. On occasion I found myself waking up from a dream where I was disassembling Z80 in my head.

Put another way, don't try the "I'm a poor old man" act around here, kiddo >:-)

Quote
This was the answer from MarkMLl.
Not knowing BASIC, but surely that's just a simple record containing two strings?

And? You could have found the example in any elementary text: I carefully gave you the two important terms RECORD and STRING, and if you drop the three terms 'pascal' 'record' 'string' into Google it gives you e.g. https://www.pascal-programming.info/lesson11.php hence the example

Code: Pascal  [Select][+][-]
  1. Type
  2.         Str25    = String[25];
  3.         TBookRec =
  4.                         Record
  5.                                 Title, Author, ISBN : Str25;
  6.                                 Price : Real;
  7.                         End;
  8.  
  9. Var
  10.     myBookRec : TBookRec;
  11.  

Now that's using a "shortstring" which is allocated with a predefined maximum length, you'd more likely these days to do something like

Code: Pascal  [Select][+][-]
  1. Type
  2.         TBookRec =
  3.                         Record
  4.                                 Title, Author, ISBN : String;
  5.                                 Price : Real;
  6.                         End;
  7.  

...and leave the hard work to the compiler.

Quote
I hope you now understand and have an understanding of old persons like me.

Old? Bah...

Look, hopefully we've got that one out of the way. Because of the way you phrased the question I found it very unclear as to what /exactly/ you were asking. If I caused offence and in particular if I wasted your time I'm sorry, but all of us here answer questions as best we can allowing that most of us are still actually working, so we have limited time to spoon-feed people who aren't up to using Google or haven't bothered to find an online book.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: How to rewrite this type example ?
« Reply #14 on: May 13, 2021, 06:51:50 pm »
My country language is not English but dutch.
I am an old person and I have not had to work for a while now.
It is not easy to learn a new computer language that is also written in English with new and incomprehensible words.
The documentation that is in a language other than my country language

Hoi Erik,

Wellicht kun je ook terecht op het NLDelphi forum.
Daar is ook een Lazarus sectie aanwezig.
Kun je gewoon Nederlands praten.

{
Hi Erik,
Perhaps you could goto to NLDelphi forum.
It has a Lazarus section.
You can talk Dutch there.
}

Bart

 

TinyPortal © 2005-2018