Palm Infocenter Board index
View unanswered posts | View active topics It is currently 21 Mar 2010, 10:22



Post new topic Reply to topic  [ 8 posts ] 
 Palm SDK Developer Suite Help! How do I create an app? 
Author Message

Joined: 21 Sep 2006, 02:31
Posts: 3
Post Palm SDK Developer Suite Help! How do I create an app?
Hello Everyone

I am new to this board and actually kinda new to palm got my first one almost a year ago and found out what exactly I had been missing. I recently found out that the palm os was programmed in C/C++ and that there were development kits avaiable for free to allow programmers to design their own applications, of course I was interested but I have no experience in this area.

So I have come to the experts to ask if any one of you could help me figure out how to put code that I have have/found/written in C/C++ on the palm in application for using the new developer suite. For example I would love to put the code shown below on my palm as an app, but don't know how. Can any of you guys help me with this.

#include <iostream.h>
#include <time.h>
#include <math.h>
#include <iomanip.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <ctype.h>
#include <string.h>
#include <fstream.h>

const int MAX_COUNT1 = 100;
const int MAX_COUNT2 = 100;


void When_Case_STMT_Gen (int BIT_NUMBER, int Select_Statement_Type1, int NUMBER_OF_STMTS, int STARTING_AT, ofstream& out_file)

{
int BIT_WIDTH_VA, CURRENT_NUMBER, CURRENT_NUMBER1, a,b,c,d, POW_CON;
int BINARY_NUMBER_ARRAY[MAX_COUNT1][MAX_COUNT2];


CURRENT_NUMBER = STARTING_AT;
CURRENT_NUMBER1 = STARTING_AT;

for ( a = 0; a < NUMBER_OF_STMTS + 1; a++ )

{
BIT_WIDTH_VA = BIT_NUMBER - 1;

for ( b = 0; b < BIT_NUMBER ; b++ )

{
POW_CON = (int) pow(2, (double) BIT_WIDTH_VA);

if ( POW_CON > CURRENT_NUMBER )
{

BINARY_NUMBER_ARRAY[a][BIT_WIDTH_VA] = 0;

}

else if ( POW_CON < CURRENT_NUMBER || POW_CON == CURRENT_NUMBER)
{
CURRENT_NUMBER = CURRENT_NUMBER - (int) pow(2,(double) BIT_WIDTH_VA);
BINARY_NUMBER_ARRAY[a][BIT_WIDTH_VA] = 1;

}
//out_file<<BINARY_NUMBER_ARRAY[m][BIT_WIDTH_VA]<<\" M IS \" <<m<< \" BIT_WIDTH_VA is \"<< BIT_WIDTH_VA<<\" (int) pow(2,(double) is \"<< POW_CON <<\" AND CURRENT # IS \"<<CURRENT_NUMBER<<endl;
BIT_WIDTH_VA = BIT_WIDTH_VA - 1;
}

CURRENT_NUMBER1 = CURRENT_NUMBER1 + 1;
CURRENT_NUMBER = CURRENT_NUMBER1;
}

if ( Select_Statement_Type1 == 1 )
{

out_file<< \" case SELECT is \\n\";
out_file<<endl;

for ( c = 0; c < NUMBER_OF_STMTS; c++)
{
out_file<<\" when '\";

for ( d = BIT_NUMBER - 1; d >= 0; d--)
{

if ( d == 0 )
{
out_file<<BINARY_NUMBER_ARRAY[c][d]<<\"' => \\n\";
out_file<<\" Variable <= '????';\\n\";
}
else
{
out_file<<BINARY_NUMBER_ARRAY[c][d];

}
}
}
out_file<<\" when OTHERS => \\n\";
out_file<<\" Variable <= ZZZZZ;\";
out_file<<\"end case;\\n\";
}
else if ( Select_Statement_Type1 == 2 )
{

out_file<< \" with SELECT is \\n\";
out_file<<endl;
out_file<<\"SIGNAL\";

for ( c =0; c < NUMBER_OF_STMTS; c++)
{
out_file<<\" <= VALUE when '\";

for ( d = BIT_NUMBER -1; d >= 0; d--)
{

if ( d == 0 )
{
out_file<<BINARY_NUMBER_ARRAY[c][d]<<\"' , \\n\";
}
else
{
out_file<<BINARY_NUMBER_ARRAY[c][d];

}
}

}

out_file <<\" <= 'ZZZZZZ' when OTHERS;\\n \";

}
return ;
}

int i;
void IF_STMT_GEN (int IF_COUNT, ofstream& out_file )
{
out_file << \" if ( expression ) then \\n\";
out_file<<endl;
out_file<<\" SIGNAL <= \"<<\"????;\";
out_file<<endl;
for ( i = 0; i<= IF_COUNT; i++)
{
out_file << \" else if ( expression ) then \\n\";
out_file <<endl;
out_file<<\" SIGNAL <= \"<<\"????;\";
out_file<<endl;
}
out_file<<\" end if; \";
return ;
}

int main()
{
// The number 12 represents the CHECK_BIT VALUE.
const int MAX_COUNT = 100;

int i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, DATA_LENGTH, DATA_COUNTER, CB_COUNTER, a, z, b,c, d, e;
int DATA_WIDTH, CHECK_BIT_COUNT, CODE_WIDTH, VALUE, CHECK_BIT_COUNT1, DATA_BIT_NUMBER, SPOT_FOUND,POW_CON ;
int DATA_POSITION, BIT_WIDTH_SEARCH, BIT_WIDTH, CURRENT_NUMBER, WIDTH_OF_THE_BINARY_BIT_ARRAY;
int PARITY_BIT_POSITION[MAX_COUNT], SYNDROME_EQUATION_ARRAY[MAX_COUNT][MAX_COUNT], BINARY_NUMBER_ARRAY[MAX_COUNT][MAX_COUNT], DATA_POINT_COUNT_ARRAY[MAX_COUNT];
int CODE_SEGMENT[MAX_COUNT], TW0_SQ_K_MINUS_1, CURRENT_LOCATION, BIT_WIDTH_VA,PRESENT_CHECK_BIT;
int LOOP_CONTROL, PARITY_BIT_POSITION1[MAX_COUNT], SPACE_COUNT, SPACE_COUNT2, SPACE_COUNT3;
int Select_Statement_Type, STARTINGAT, NUMOFSTMTS, BIT_COUNT, STATE_MENT_COUNT;

ofstream out_file;
out_file.open(\"C:/STATEMENT_GEN.txt\"); // opening the points file.

if (out_file.fail()) // ensuring that the file opened properly
{
cout <<\"\\nThe file did not open\"<<endl;
cout <<\"\\nHey check to ensure the file actually exists\"<< endl;
exit(1);
}

cout<<\" Hello what type of select statement would like to generate.\\n\";
cout<<\" You have three types to choose from \\n\";
cout<<\" 1. Case Statement\\n\";
cout<<\" 2. With Statement\\n\";
cout<<\" 3. IF Else Statemtne\\n\";
cout<<\" Please choose enter 1 2 or 3.\\n\";
cin>>Select_Statement_Type;

if ( Select_Statement_Type == 3 )
{
cout<<\" OK got it, now how many iterations of this statement do you want.\";
cin>>STATE_MENT_COUNT;
IF_STMT_GEN(STATE_MENT_COUNT, out_file);
}

else
{
cout<<\" OK got it, how many bits are in the selection variable.\";
cin>>BIT_COUNT;
cout<<endl;
cout<< \" How many statements do you want ?\";
cin>>NUMOFSTMTS;
cout<<\" Starting at what number ?\";
cin>>STARTINGAT;
When_Case_STMT_Gen (BIT_COUNT, Select_Statement_Type, NUMOFSTMTS, STARTINGAT, out_file);
}

out_file.close();
return 0;

}


21 Sep 2006, 06:56
Profile Send private message
Guru
User avatar

Joined: 17 Jan 2002, 06:18
Posts: 1999
Location: South West, VA
Post 
Suggestion: When posting code, use the [code] [/code] tags.


21 Sep 2006, 08:13
Profile Send private message
Guru
User avatar

Joined: 17 Jan 2002, 06:18
Posts: 1999
Location: South West, VA
Post 
Example without of the code tag:

#include <stdio.h>
int main( int argc, char **argv )
{
printf( \"Hello World!\\n\" );
return 0;
}

Example with the code tag:

Code:
    #include <stdio.h>
    int main( int argc, char **argv )
    {
        printf( \"Hello World!\\n\" );
        return 0;
    }



21 Sep 2006, 08:14
Profile Send private message
Guru
User avatar

Joined: 17 Jan 2002, 06:18
Posts: 1999
Location: South West, VA
Post 
Suggestion:

First try to learn how to write Palm OS programs, and then try to figure out how to move your code to the Palm. You may be able to find some on-line tutorials. I learned from “Palm OS Programming” by Neil Rhodes, O’Relly. However, I think “Palm OS: Programming Bible” by Lonnon Foster, Wiley may be a better choice. The Foster book was not available back then.

Some notes:
  • Palm OS's API were designed for C programming, not C++.
  • However, the standard C library is typically not available.
  • The gcc compiler typically used for Palm OS programming does support C++, but the standard C++ libraries are typically not available either.
  • There are some partial standard-C library and standard-C++ library implementations available, but nothing full.
  • Therefore, though you may know the language, one needs to learn the Palm OS APIs instead of relying on the old trusted standard C or C++ libraries.


21 Sep 2006, 08:18
Profile Send private message

Joined: 21 Sep 2006, 02:31
Posts: 3
Post 
Hello Potter

Thanks for the posting tip.

It sounds like you are saying that the palm os programming environment uses a \"C like\" language, but it's not exactly C. OK well if thats the case I'll just leave my programs on my lab top, don't have the time to learn a different language, know too many as it is, my head is almost full.

I thought that that the suite would allow a C programmer to write something in C compile it and it would build an executable for you that you could download to your palm but it appears that that isn't the case. Am I write? Because if so, I'm toast, I just really can't put in the effort to learn yet another language, and palm needs to call its os programming language some sort of C hybrid instead of C if thats not what it is.


21 Sep 2006, 08:54
Profile Send private message
Guru
User avatar

Joined: 17 Jan 2002, 06:18
Posts: 1999
Location: South West, VA
Post Re:
ASIC_Designer wrote:
It sounds like you are saying that the palm os programming environment uses a "C like" language, but it's not exactly C.

The Palm OS Developer's Suite uses GCC as its compiler. This is the same C/C++ compiler use on Linux and FreeBSD, and is available for so many others. It is a fully compliant C compiler (and I am pretty sure fully compliant C++). However the standard C and C++ libraries are not available on Palm OS.

Have you ever looked into how to write a Windows or Mac application? For either, you can write in C or C++, however most of the standard C/C++ libraries do you little good. You have to learn how to write with the Windows or Mac APIs. Writing to Palm OS is similar, but instead of doing one little good, the standard libraries are not there at all.


22 Sep 2006, 04:50
Profile Send private message

Joined: 16 Mar 2007, 07:30
Posts: 5
Post You can do that!!!
Try using onBoardC and vfsDOS. This allows you to us the stdio library to implement standard C code!! :D

_________________
Kevin Phelps


13 Jun 2007, 11:49
Profile Send private message
User avatar

Joined: 01 Jan 2008, 02:24
Posts: 6
Location: Harpes Ferry, WV
Post 
I've been trying to figure out how to get a development environment setup on my Mac as well and can't seem to find anything. Most of the packages/tools/utilities/SDK/IDE that I can find are for PC only and the ones for Mac are >3 years old so I figure they won't run on 10.4.

Any hints? Advice? Links? Bad news?

_________________
Image
Image

Old Programmers Never Die ... They just lose their bits


01 Jan 2008, 07:36
Profile Send private message WWW
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to: