Standard 'C' Functions

Non-platform specific questions.

Standard 'C' Functions

Postby Just4Fun » Sat Apr 22, 2006 5:11 pm

Just out of curiosity,

Can someone tell me which standard 'C' functions can't be used with GE?

For example: I can't use printf or scanf... what other standard functions can't be used to build programs in the global editor? :?: TIA
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby Fuzzy » Sat Apr 22, 2006 5:31 pm

if you can find source code that shows how to build printf, you might able to port it to GE. After all, those are just functions like any other.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Postby Just4Fun » Sat Apr 22, 2006 5:59 pm

Hi ThreeFingersPete:

Does your answer mean that I would put the printf statement into a function and call it from the global editor? I've tried to build printf before just to see if I could do it and I didn't have any luck so I assumed that it could not be used.

At one point Makslane said,"There is no support for printf in Game Editor. "

So I assumed that what I was doing was impossible. It would be great to get a list of standard 'C' functions together that can't be used so that we don't spin our wheels trying. I know that there are simple ways to do this stuff in GE, but sometimes I want to try using a little 'C' code for learning and for fun. I'd also like to use GE for more than games and that requires more 'C'. TIA
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby Fuzzy » Sat Apr 22, 2006 7:23 pm

Nope. What I mean is that somewhere back in the mists of time, someone built printf using the basics of C, or more likely, assembler language. If Makslane says its not possible, it may very well be not possible.

However, a lot of the advanced commands in C and GE are just functions made with the basics of if, while, variables...

Sometimes you can reinvent the wheel, so to speak. Until Makslane decides its worth his while to add a function like printf, we must work our way around the limitations.

At a certain point, the people that created C decided "this far, and no more" and let the programmers create what they needed. Most of what C allows for is already in GE. What seems to be missing is port calls and whatnot, low level graphics card access would be an example.

Things like Printf are just functions bound up in a library and uncluded as a collection. when you go to global code and save a group of stuff there, thats about what a library is. There are sources to read how Printf is set up.

look around in here...
http://en.wikipedia.org/wiki/C_standard_library
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Postby makslane » Sat Apr 22, 2006 8:16 pm

The printf function print a text in the standard text output.
There is no standard text output in Game Editor, so, use printf make no sense.

But you can use the sprintf function and update a text actor.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby Just4Fun » Mon Apr 24, 2006 2:47 am

Ok. We know that we can't use printf. So I have one function to add to my can't use list. What are other functions that we can't use? Anyone care to add to the can't list? TIA
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby Fuzzy » Mon Apr 24, 2006 4:19 am

Here is a list of keywords for C. Some wil be in GE, some will not. I will point out the ones i know are not part of GE.

asm - not in GE - used to link assembly instructions
auto - I have no idea... a car?
break - GE!
case - GE
char - GE
const - I'll have to try this..
continue - not sure
default - no, I think
do - yup, GE
double - yup
else - yup
enum - I think so. I had partial success with this, and it can do really neat things. You hardly ever see it used.
extern - nope. for linking libraries
float - yup
for - you bet! GE all the way
goto - I THINK so
if - my mortal enemy, a verified resident of GE
int - yep
long - yes
register - no. for direct access to CPU
return - I am happy Just4Fun has returned! GE compatible, and so is return
short - yes
signed - yes
sizeof - for arrays i think? or strings? used in GE
static - uh... no?
struct - never seen it in GE, but Makslane uses it to make GE!
switch - dont use if, switch to switch in GE!
typedef - nope. never seen in GE
union - unlikely in GE
unsigned - yes
void - yes in GE
volatile - i think this refers to shared port resources, so is not in GE
while - Worth your while to use in GE

I might be off on some of these things. It never hurts to look them up. Everything you see in C that is not in this list was created with these 30+ items.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Postby WauloK » Mon Apr 24, 2006 4:48 am

i wonder if other defines are in GE.
ifdef
ifndef
endif
Available for Beta-testing.. PM me!
Black 16Gb iPhone 3GS
Windows 7: 2Gb RAM. Dell 9150.
WauloK
 
Posts: 42
Joined: Wed Apr 19, 2006 3:19 am
Location: Sydney, Aussieland
Score: 0 Give a positive score

Postby DilloDude » Mon Apr 24, 2006 6:04 am

ThreeFingerPete wrote:if - my mortal enemy, a verified resident of GE
What is it you don't like about ifs?
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Postby WauloK » Mon Apr 24, 2006 6:56 am

possibly a 'switch' fan? ;)
Available for Beta-testing.. PM me!
Black 16Gb iPhone 3GS
Windows 7: 2Gb RAM. Dell 9150.
WauloK
 
Posts: 42
Joined: Wed Apr 19, 2006 3:19 am
Location: Sydney, Aussieland
Score: 0 Give a positive score

Postby Fuzzy » Mon Apr 24, 2006 8:32 am

Definately a switch fan.

I dont mind ifs, really, its just me being silly.

On the other hand, if you choose to limit your options, you will find that you gain strength and creativity. When I run into a situation where I think I need an if statement, or a while, or whatever, I stop and think: Can I do without this step?

Doing so certainly tightens up code. You will often see a beginning programmer use 11 ifs in a row... if A = 0... if A = 1.... thats understandable, but note the last line; if A = 10....

You dont need that last if, as long as you prepared things so A can only ever be 0 through 10. Often you are using a loop!

We all learn to step past this; we become intermediate programmers, and consider ourselves wise, but tell me this: are we still doing things that a master would say is silly?

So I limit myself. I challenge myself to do without, in hopes that I can find some novel and hopefully efficient way to do what I need. Sometimes I fail, but the trying teaches me things.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Postby WauloK » Mon Apr 24, 2006 12:43 pm

similar to 'real coders' hating 'goto' in languages...
Available for Beta-testing.. PM me!
Black 16Gb iPhone 3GS
Windows 7: 2Gb RAM. Dell 9150.
WauloK
 
Posts: 42
Joined: Wed Apr 19, 2006 3:19 am
Location: Sydney, Aussieland
Score: 0 Give a positive score

Postby Just4Fun » Mon Apr 24, 2006 2:34 pm

An interesting thread. ThreeFingersPete... thanks for adding what you do know. I can see that I really need to dig into some 'C' to test some of this stuff. Would people add to the list as they discover what doesn't work? I am focusing on what doesn't work because I *think that list would be a lot shorter than what does work.

WauloK: "goto" was pretty popular in the 'olden/golden' days of programming. I've seen several books that talk about spagetti code and some that actually still try to 'sell' it. It can have some application in rare circumstances, but I think most 'real' and probably most 'unreal' programmers would agree with you. :wink: The whole subject of goto is kind of interesting.

I also like the "switch" statement. It seems to make things more readable,but "if" works and is sometimes easier for eternal beginning programmers like me to understand.

Thanks for getting some scripting discussion going in the forum. I have also enjoyed and learned from the #Define discussion. I hope that as people learn, they will share with the rest of us... TIA to all the great GE people! :D
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby Fuzzy » Mon Apr 24, 2006 8:01 pm

You know whats missing from that list? getch and putch.... but i think they make use of the register keyword, so would be secondary functions...
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Postby WauloK » Mon Apr 24, 2006 9:39 pm

Just4Fun wrote:WauloK: "goto" was pretty popular in the 'olden/golden' days of programming. I've seen several books that talk about spagetti code and some that actually still try to 'sell' it. It can have some application in rare circumstances, but I think most 'real' and probably most 'unreal' programmers would agree with you. :wink: The whole subject of goto is kind of interesting.


Yeh. I was a member of the 'golden olden' days programming ;)
Started on computers about 22 years ago, programming in BASIC and Assembly. They both have a 'goto' type command :)
Available for Beta-testing.. PM me!
Black 16Gb iPhone 3GS
Windows 7: 2Gb RAM. Dell 9150.
WauloK
 
Posts: 42
Joined: Wed Apr 19, 2006 3:19 am
Location: Sydney, Aussieland
Score: 0 Give a positive score

Next

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest