Author Topic: Pointerish Functions  (Read 3283 times)

0 Members and 1 Guest are viewing this topic.

Charles Pegge

  • Guest
Pointerish Functions
« on: September 30, 2014, 03:16:08 AM »
Often found in C, but better expressed using OOP. as method tables

This example tests a function call made through 2 referenced (pointered) structures:

Code: [Select]
function fun(int n) as int, label
=================================
return n*2
end function

type level1
===========
int a
int (fun)(int n)             'pointer assumed
'int (*fun)(int n)           'C style
'function fun (int n) as int 'Basic style
end type

type level2
===========
int b
level1 * l1      '
'level1 ptr l1
'l1 as level1 ptr
end type

'#recordof _level1
'#recordof _level2

level1 * l1 = getmemory 16
@l1.fun=@fun 'linkage

level2  * l2 = getmemory 16
@l2.l1=@l1 'linkage

'TEST
a = l2.l1.fun 123

'C EQUIVALENT
'a = *l2->l1->fun(123);

print a '246

freememory @l1
freememory @l2

JRS

  • Guest
Re: Pointerish Functions
« Reply #1 on: September 30, 2014, 09:06:01 AM »
There is nothing preventing you from creating and fostering a topic of your own here on the forum. Does participation scare you? The Lisp effort by Mike (for the most part) is helping Charles flush out bugs. Most of us are smart enough to be able to focus on more than one topic at a time.

Please leave bitter at the door!


Charles Pegge

  • Guest
Re: Pointerish Functions
« Reply #2 on: October 01, 2014, 12:33:13 AM »
It has been intriguing to see such intensive activity on the forum. Other topics have been swiftly swept off the home page by the torrent of postings. But nothing lasts forever, and I anticipate we will be spending more time on the Basic side shortly.

JRS

  • Guest
Re: Pointerish Functions
« Reply #3 on: October 01, 2014, 12:44:34 AM »
Quote
This example tests a function call made through 2 referenced (pointered) structures:

That sure looks SBish.  ???

JRS

  • Guest
Re: Pointerish Functions
« Reply #4 on: October 01, 2014, 02:12:31 AM »
Listen up friend. You're the only one complaining so stop blaming everyone else. This is open source programming forum not your personal social network. If you have a problem or seeking help post something intelligent rather than complaints. You attack or blame me for your misgivings again and I will all over you like flies on shit. Got it?


Charles Pegge

  • Guest
Re: Pointerish Functions
« Reply #5 on: October 01, 2014, 02:56:27 AM »
We all know that John loves a good row! :)

JRS

  • Guest
Re: Pointerish Functions
« Reply #6 on: October 01, 2014, 09:11:59 AM »
Your buddy Peter can be found on Aurel's forum. You should join them. You'll fit right in. Aurel has turtle graphics working so you will have something interesting to work on.




« Last Edit: October 01, 2014, 09:32:33 AM by John »

Mike Lobanovsky

  • Guest
Re: Pointerish Functions
« Reply #7 on: October 01, 2014, 10:40:20 AM »
Am I the only one of the opinion that it's becoming somewhat easier to breathe at this place?

JRS

  • Guest
Re: Pointerish Functions
« Reply #8 on: October 01, 2014, 10:55:20 AM »
Most of these member's personal social issues can be avoided if a clear understand of what open source is and how to participate in the project. What we have seen in the past is members thinking their personal projects are more important than OxygenBasic. I have had all the negative attitudes I can take. These last few months have been great and a lot of progress in all areas have been accomplished. Lets not go backwards.
« Last Edit: October 01, 2014, 11:31:32 AM by John »

Charles Pegge

  • Guest
Re: Pointerish Functions
« Reply #9 on: October 01, 2014, 11:35:36 AM »
Well, there has certainly been a change of guard over the past few weeks, though I hope we will still be able to provide topics of more general interest as well.

I miss having gals on the forum, but for some mysterious reason, Basic has always been a boys language. :)

JRS

  • Guest
Re: Pointerish Functions
« Reply #10 on: October 01, 2014, 01:06:51 PM »
Charles,

It's all about commitment. Most people are too busy with their own life and personal projects to contribute and help O2 along and come to open source projects looking for a free hand out. (giving nothing back) Human nature I guess. As the old saying goes, you can lead a horse to water ...