pascal ascii characters

C and PASCAL (or any other high-level languages) in here please

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2596
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: pascal ascii characters

Postby charles » Tue Jan 29, 2008 3:51 pm

keep laughing ,but not funny
there are more than one way to obtain results from commands..
i guess i should defend my self and say that i allready know how to do execute the commands with the illustrated examples , and at the time for which the related quote was relevent, i was rewriting my own aes .gem library for gfa...
i had needed..no not you lonny , I had needed or devised a method which was to
pass the contents at a address of the array which held the data
onto the array of intin ( integer input array).
this avoids the looping for those who don't know.

i enjoy programming like this ..take a look at the example given in the gfa manual if have any questions,,they also intend for us to program like this too
if you have the gfa basic 3.0 manual
page430,431...VDISYS...............

so i'm back reality though.......no one cares about me and pascal
and i'm too dumb or in experienced to know what happens after i acheive
this method....hypothetically ,for every line of code i execute...anything can go wrong.
me and murphy i guess....murphies law.....
going beyond boundries
..me
...charles
The radioactive half-life : )
Atari is a lifestyle,not a hobby.
HOLD ON ! ! ! Im printing unreadable characters ...!

User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2462
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: pascal ascii characters

Postby lp » Tue Jan 29, 2008 6:27 pm

i had needed..no not you lonny , I had needed or devised a method which was to
pass the contents at a address of the array which held the data
onto the array of intin ( integer input array).
this avoids the looping for those who don't know.


Well whatever this bit of code is, I'm 100% sure it could of been solved in GFA. Had you provided a proper explanation of the problem back then. Yellow_Colorz_PDT_09

PS. If you don't want such responses, don't mention my name.

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2596
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: pascal ascii characters

Postby charles » Tue Jan 29, 2008 7:41 pm

i did provide proper explanation ..like i said , nobody cares......have fun , i'm busy
viewtopic.php?f=70&t=11099
charles
The radioactive half-life : )
Atari is a lifestyle,not a hobby.
HOLD ON ! ! ! Im printing unreadable characters ...!

User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2462
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: pascal ascii characters

Postby lp » Wed Jan 30, 2008 5:12 am

Please go back through the thread on that topic, you will find several tried to help you.

viewtopic.php?f=70&t=11099

Re-reading it is very funny, most of them are trying to guess your problem? Why? Because you fail to properly describe it. Actually after re-reading it, I see a clue I missed, you mention gtext, so all this hoopla is over a call to v_gtext() from GFA. This is really hilarious, because you can just do TEXT x,y,"this is a call to v_gtext()!". Check it out, no loop required. :D

Now I know how you solved it in pascal, a library call to v_gtext() which, btw internally the library call does a loop to move the 8-bit text into the 16-bit VDI array.

OMG! A serious case of not reading the manual.

User avatar
Nyh
Atari God
Atari God
Posts: 1496
Joined: Tue Oct 12, 2004 2:25 pm
Location: Netherlands

Re: pascal ascii characters

Postby Nyh » Wed Jan 30, 2008 12:53 pm

lp wrote:Now I know how you solved it in pascal, a library call to v_gtext() which, btw internally the library call does a loop to move the 8-bit text into the 16-bit VDI array.

A serious case of not reading the manual.

I am afraid Charles does read manuals, lots of them. But he is (still?) a cookbook programmer, he doesn't understand what is in the books. In this thread http://www.atari-forum.com/viewtopic.php?f=16&t=12664 he introduces the "menu_unregister(WORD itemid);" function but he complains: "but the succeding lines of parameters i do not know. I have been wondering what he means by that because, well, all you need to know is in the function definition. But rereading this other thread I think he means that he doesn't know what to put into the int_in[] array. An other typical sign of Charles cookbook programming is "finding items pertaining to my field of interest..midi and pascal...for atari" which indicates for me he needs all examples direct usable, it should work after a single copy and paste. One would expect a single Pascal reference book, a Atari ST OS reference book en a MIDI reference book are enough.

BTW Charles, you could use the following solve your problem:
1 use an other editor to create the special characters you need; load the source in an editor like Tempus 2 make all special characters, save and continue in Pure Pascal, I you make a complete comment block with all ASCII characters you can copy and paste a special character whenever you need them.
2 save your GFA source as ASCII and load it into the Pure Pascal environment. With copy and past you can get all the strings you need
3 I think (not 100% sure on this) you can use string concatenation to insert special characters in strings.

Hans Wessels

joska
Hardware Guru
Hardware Guru
Posts: 4499
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: pascal ascii characters

Postby joska » Wed Jan 30, 2008 2:06 pm

charles wrote: whandle:=1;{identification for window handle}
a:='The '#14#15' Forum '#189;
v_gtext(whandle,199,99,a);


What are you doing here? First of all, you can't just use any random number as a handle. A handle is given to you by the AES or VDI, depending on which you use. The point of using a handle in the first place is that it's a unique identifier to a system resource that's allocated to you. Windows are handled by the AES, so a window handle must be aquired using wind_create: whandle = wind_create(widgets, x, y, w, h) before you can use it.

Secondly, v_gtext is a VDI function and needs a handle to a VDI virtual or physical workstation. Your code simply use VDI handle 1, which normally refers to the screen. This will work, but it's not the recommended way to use the VDI. You should use virtual workstations, and retrieve the proper handle using v_opnvwk().

The AES and VDI can be frustrating stuff, especially if you're struggling with a new language (and perhaps lack of experience in programming). I suggest that you practise Pascal for a while before delving into GEM! GEM may look simple, but anyone who's written a GEM-app from scratch knows that you're spending more time on the GUI than the business logic.
Jo Even

VanillaMiNT - Firebee - Falcon060 - Milan060 - Falcon040 - MIST - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64

User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2462
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: pascal ascii characters

Postby lp » Wed Jan 30, 2008 4:36 pm

I saw the [b]whandle:=1;{identification for window handle}{/b] but I ignored it. Did not even want to get into explaining that. It should be noted that most BASICs open a VDI workstation for you upon start up and close it upon exit. So all the complexity of the workstation is hidden from the user. Some even have window commands that hide handles. In BASIC the programmer can be blissfully ignorant of handles, even file I/O handles.

What he probably didn't know, is that pascal, C, assembler, etc (non-BASICs) do not do any of this stuff for you, it's all up to the programmer.

I suspect back when he did finally get the v_gtext() call working in GFA, he also passed "1" as well.

handle=1 may be true for plain TOS, but there no guarantee that will work in MagiC, MiNT, Geneva etc since the OS can allocate different resources and if you start an app before yours, handle 1 could be owned by someone else. Actually in plain TOS, I think even an ACC could grab handle 1 if opened before your app, so really it's not a safe practice at all.
Last edited by lp on Wed Jan 30, 2008 5:37 pm, edited 1 time in total.

User avatar
Desty
Atari God
Atari God
Posts: 1970
Joined: Thu Apr 01, 2004 2:36 pm
Location: 53 21N 6 18W
Contact:

Re: pascal ascii characters

Postby Desty » Wed Jan 30, 2008 4:44 pm

lp wrote:handel=1 may be true for plain TOS, but there no guarantee that will work in MagiC, MiNT, Geneva etc since the OS can allocate different resources and if you start an app before yours, handle 1 could be owned by someone else. Actually in plain TOS, I think even an ACC could grab handle 1 if opened before your app, so really it's not a safe practice at all.

Or if you're developing in a GEM-based IDE, like your GFA editor, it would probably grab the first available handle which might be 1. So your program might work compiled from the desktop, but not run from the IDE. Which would be sad.
tá'n poc ar buile!

User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2462
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: pascal ascii characters

Postby lp » Wed Jan 30, 2008 5:42 pm

That's true indeed. I'm not sure what happens if you start using some other apps VDI handle. It might appear to work, but if you start altering the point sizes, colors, line widths, etc the original app that was allocated the handle might start behaving strangely.

joska
Hardware Guru
Hardware Guru
Posts: 4499
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: pascal ascii characters

Postby joska » Wed Jan 30, 2008 9:09 pm

lp wrote:That's true indeed. I'm not sure what happens if you start using some other apps VDI handle. It might appear to work, but if you start altering the point sizes, colors, line widths, etc the original app that was allocated the handle might start behaving strangely.


You guys are talking about virtual workstation handles. Handle 1 is the handle for the physical workstation 1, which normally is the screen. It's usually "owned" by the AES. I would assume that you'll run into the same problems on a multitasking environment though - if all apps used the same handle then all changes to point size etc will be global. I'm only assuming this because I never mess around with handles I don't own so I really don't know what happens.
Jo Even

VanillaMiNT - Firebee - Falcon060 - Milan060 - Falcon040 - MIST - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2596
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: pascal ascii characters

Postby charles » Thu Jan 31, 2008 1:00 am

joska:
What are you doing here? First of all, you can't just use any random number as a handle.
char:
yes i know that ,,i use graf_handle after v_opnvwk..if my learning has paid off....


josk:
A handle is given to you by the AES or VDI, depending on which you use. The point of using a handle in the first place is that it's a unique identifier to a system resource that's allocated to you. Windows are handled by the AES,

char: allready know , thanks ,i'm just going from memory but one to 6 windows open within gem......no?
whats been done is illustrating what this initial thread relates to
pascal ascii characters...i could not find any way to write a string of characters which weren't available on my keyboard..

josk:
so a window handle must be aquired using wind_create: whandle = wind_create(widgets, x, y, w, h) before you can use it.

char:
always? i know , i been learning from examples within pascal...do ones too!!!

joska:
Secondly, v_gtext is a VDI function and needs a handle to a VDI virtual or physical workstation. Your code simply use VDI handle 1, which normally refers to the screen. This will work, but it's not the recommended way to use the VDI. You should use virtual workstations, and retrieve the proper handle using v_opnvwk().

char:
believe me i do , but not for this demonstration, it was just to quickily show how the
characters , above deecimal 121 or hexidecimal $7B ,within pascal
are unobtainable throuogh the keyboard,but can still be written into a string....good for midi!!!!!!!!!!!!!!!!

joska:
The AES and VDI can be frustrating stuff,

char:
yep ,like clipping , over lapping rectangles,wind update and mctrl..

joska:
especially if you're struggling with a new language
(and perhaps lack of experience in programming).

char:
both in one basket , how dull......i still like programming .

joska:
I suggest that you practise Pascal for a while before delving into GEM!
GEM may look simple, but anyone who's written a GEM-app from scratch knows that you're spending more time on the GUI than the business logic.

char:
i speak the same truths about gem joska ..its a whole lot of glimmer and
sparkles to hide the true program functions ,,,alll that just to make look good,,great less input more action!!!!!!!


okay i will write to the next post ,...

charles
The radioactive half-life : )
Atari is a lifestyle,not a hobby.
HOLD ON ! ! ! Im printing unreadable characters ...!

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2596
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: pascal ascii characters

Postby charles » Thu Jan 31, 2008 2:49 am

I saw the [b]whandle:=1;{identification for window handle}{/b] but I ignored it. Did not even want to get into explaining that.

you don't have to explain any thing except what i asked,,its like what you said before
where you found something you missed ,
i gave up explaining because half the replies were to something they missed..is this a game or this war?
(whos on my side?) with friends like these , i don't need enemies........

now i seem to spend more time answering replies to my threads
then discovering the truths...

don't waste your time on me because i will ask if i find something difficult..
saving you time and me the time of replying to all the stuff people ideally have "demised" for me...i got suckered into it again ...
here we go again ...
i might just start a new thread called
"blow a stack on charles"

because
is this all help
to
help me
and now there are cross coments not even relleveint to my original topic...

comm on folks start a new thread called gem windows ...
and then one called window whandles .,,,
or one called how to print the characters to screen ,
primarilly important ,
just utilize the space ,
all this talk because of pascal ascii characters ..
please , i am starting to take this personally...

soon if any body thinks this is a good ideal i'm going to
place all the tos, gem and vdi commands one by one into
the forum , into a separate topic..of the coding column..
so each user of the coding forum ,at their leisure can respond how they have made
use of these commands , when programming newbies need advise we won't have to go through all this we can just dirrect to the relevent command...when to use them and under which particular circumstance to use them...doesn't matter what language applies...
only matters that we can find the information we need..

avoiding just kinda what happened here...
a whole lot of comments about
the wrong thing ,
you know publicly speaking,
whos right and whos wrong...
good programming advise but at the wrong time..
[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
It should be noted that most BASICs open a VDI workstation for you upon start up and close it upon exit. So all the complexity of the workstation is hidden from the user. Some even have window commands that hide handles. In BASIC the programmer can be blissfully ignorant of handles, even file I/O handles.

the person who needs this information would find it easier if it was in its own topic heading out in the public area , when does the point arrive to stop relaying info??
but this feeling comes after considering it is aimed to help me ,
i know , thats why i dislike the hidden parts to basics...but i say thanks.


What he probably didn't know, is that pascal, C, assembler, etc (non-BASICs) do not do any of this stuff for you, it's all up to the programmer.

ido i do ,
so what i want to avoid is this typical type of thing now
,,opression ,,,
me being subject to long two hours typing to just establish
we've gotten off track...

i'd like to stay on track , so i get a little vocal to state a point and next thing arisses
somebodies picking me apart...

so i will launch my next ideal <><><><:>
start a thred for every command (in the vdi , tos and gem)
so we can reference them with our own coding techniques,
wheather it be joska knowing lots abouot windows wandles , boxes screen functions ,
or lonny commenting , interacting and adding his experience...
nyh daegnohe for c
and so on and so forth.......
this will always invite great , on topic feedback

this is a coding forum so why not have an index?


comedy part......
,,,the trheadds like this fashion will soon be a way of the past
:::::::::::::pascal ascii characters:::::::::::::::::::::::::

char:
do you know any thing about pascal ascii characters?

every body else:
no ...what are they?

char : the characters obtained through the ascii chart using hexideciaml or decimal values .
symbolic,numeric,or alphabitacal ..i can't access some through the keyboard..

everybody else:
well within super demonic speed writerIIII, i made it look like i had atari letters on it..

a passer by :
no dummy that was super super writer III , it wasn't demonic....

char:
cool,...what next????

evrybody else:
so why didn't you tell us you were using super demonic writer charles?

char:
okay ,i'm not.

evrybody else:
hurry up , you're music video is being bootlegged.

anybodyelse:
i don't see how this affects anything.

apassere by /:
it doesn't i'm just glad to elaborate

char:
this is a little much,huh?

some one :
maybe we need more help on the topic , i personally really enjoyed the video.

char:
i don't have a video..

anyole body :
well you should , any body with speed demon has one..

char:
uhm? bad terms?????

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

i give up for tonight, allready two hours again typing to responces..no time to actually
practise , don't worry about me guys i'll be fine, my solution is obvious , i aim to learn one thing at a time (and all ways of executing it , not just one)
there is alot more to be said , (and a ot more to do)
but with all the factoring information which surrounds
the topic .... keeping it simple seems to work
i get lost in detail most likely...the varying degree of different opionions..
and the different aspects of the right complement..
sometimes what i feel funny is when people branch out into something they guess will help and is not what meant to be..


I suspect back when he did finally get the v_gtext() call working in GFA, he also passed "1" as well.


?????it never was gfa i was working it in ?????
i left for pascal ..
charles
The radioactive half-life : )
Atari is a lifestyle,not a hobby.
HOLD ON ! ! ! Im printing unreadable characters ...!

User avatar
sh3-rg
Captain Atari
Captain Atari
Posts: 438
Joined: Thu May 08, 2003 1:33 pm
Location: bolton - england
Contact:

Re: pascal ascii characters

Postby sh3-rg » Thu Jan 31, 2008 3:08 am

OK, I think Charles cleared that lot up perfectly (with the addition of some comedy exchanges between Char, anybody, everybody & a passer by, a very nice touch). I'd sleep better tonight knowing he didn't have to waste another 2 hours on a further reply, so I vote to lock this thread. (turn once: O~~m )

ps OT : anyone have a download link for SuperWriterIII?

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2596
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: pascal ascii characters

Postby charles » Thu Jan 31, 2008 3:23 am

yes it has expired , all input absorbed , thanks
charles ..
The radioactive half-life : )
Atari is a lifestyle,not a hobby.
HOLD ON ! ! ! Im printing unreadable characters ...!

User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2462
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: pascal ascii characters

Postby lp » Thu Jan 31, 2008 5:17 am

?????it never was gfa i was working it in ?????
i left for pascal ..


http://www.atari-forum.com/viewtopic.php?f=70&t=11099 [May 10, 2007]

Yeah right. Re-read your own thread, the examples you give and receive are in GFA syntax!! And then you thank us for them and state that we solved your problem. Nice try.

See the "Search" option at the top, guess what, helpful bits of info can be found using that. So even if the topic may drift, the info can be found with some searching. So chill out.

Oh look what I found: viewtopic.php?f=70&t=11370&p=93080 [Jun 17, 2007]
Here's where you discuss moving to Pascal almost a full month later. :oops:

joska
Hardware Guru
Hardware Guru
Posts: 4499
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: pascal ascii characters

Postby joska » Thu Jan 31, 2008 8:50 am

charles wrote:yes i know that ,,i use graf_handle after v_opnvwk..if my learning has paid off....


You're on the right track. graf_handle() must be called before any VDI functions, because it's graf_handle() that gives you the handle. Something like this (in C syntax):

Code: Select all

int i, work_in[11], work_out[57];

vw = graf_handle(&i, &i, &i, &i);
work_in[0] = 1;
v_opnvwk(work_in, &vw, work_out);


Then you can call VDI functions using the aquired handle in vw.

This is from memory so I'm a bit uncertain about the work_in[] parameter. It must contain the device ID for the device to open the virtual workstation on, 1 is the screen. I'm pretty sure it's work_in[0], but check the docs first.

charles wrote:char: allready know , thanks ,i'm just going from memory but one to 6 windows open within gem......no?


Seven actually. This depends on which TOS and/or AES version the application is running on. Never assume a limit here, evaluate the return values from wind_create() and wind_open() to determine whether the creation/opening of a window failed or not.

charles wrote:
joska wrote: so a window handle must be aquired using wind_create: whandle = wind_create(widgets, x, y, w, h) before you can use it.


always? i know , i been learning from examples within pascal...do ones too!!!


Always!! Never make up a window handle of your own! It will 100% certainly fail as soon as you run your app under anything but TOS.

charles wrote:characters , above deecimal 121 or hexidecimal $7B ,within pascal
are unobtainable throuogh the keyboard,but can still be written into a string....


This looks like a limitation in the High Speed Pascal editor. Same with PureC, for some reason it won't let me enter the character "ø", which prevents me from commenting my code in Norwegian ;-)

charles wrote:yep ,like clipping , over lapping rectangles,wind update and mctrl..


Window handling and redraws are actually quite easy, I use the same piece of code to do this in all my programs (from memory, can't guarantee that this will compile!):

Code: Select all

/*
** win: structure with info on the window in question. In this function only hande and pointers to
** the redraw functions are used.
** e: structure with a copy of the occured event.
*/
static int wind_redraw(WINDOW *win, EVNT *e)
{
   GRECT rect;

   /* Lock the screen manager while redrawing */
   wind_update(BEG_UPDATE);

   /* Hide mouse cursor */
   graf_mouse(M_OFF, NULL);
   
   /* Get first dirty rectangle */
   wind_get(win->handle, WF_FIRSTXYWH, &rect.g_x, &rect.g_y, &rect.g_w, &rect.g_h);

   /* A rectangle width and height of 0 indicates the end of the rectangle list */
   while (rect.g_w && rect.g_h)
   {
      /* Intersect the dirty rectangle with the dirty rectangle in the event */
      if (rc_intersect((GRECT *)&e->msg[4], &rect))
      {
         /* Call the redraw function with the intersected rectangle. */
         win->redraw(win, &rect);
      }
      /* Get next rectangle from the window rectangle list */
      wind_get(win->handle, WF_NEXTXYWH, &rect.g_x, &rect.g_y, &rect.g_w, &rect.g_h);
   }

   /* Show mouse cursor */
   graf_mouse(M_ON, NULL);

   /* Unlock screen manager */
   wind_update(END_UPDATE);

   return TRUE;
}


Again in C, but it's very simple code and should be easy to follow. I'm not sure if HS Pascal allows pointers to functions, but if it does you should use a function like this. Then you can use this function for all window redraws simply by passing a pointer to the appropriate redraw function.

Btw. the rc_intersect() function (or was it a macro?) was stolen from Tim Ohren's excellent ProGEM articles. I strongly suggest reading them, even though they are 20 years old or so they're still relevant.

This is the easy stuff - creating windowed dialogs that works under TOS, MagiC and N.AES/XaAES is a whole other issue. Something apparently simple like using edit fields took me ages to figure out.

If you want to make proper GEM applications with Pascal you might consider switching to Pure Pascal and use a library called Object Gem. It will take away lot of the hard work when making GEM applications.
Jo Even

VanillaMiNT - Firebee - Falcon060 - Milan060 - Falcon040 - MIST - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64

joska
Hardware Guru
Hardware Guru
Posts: 4499
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: pascal ascii characters

Postby joska » Thu Jan 31, 2008 10:49 am

lp wrote:It should be noted that most BASICs open a VDI workstation for you upon start up and close it upon exit. So all the complexity of the workstation is hidden from the user. Some even have window commands that hide handles. In BASIC the programmer can be blissfully ignorant of handles, even file I/O handles.

What he probably didn't know, is that pascal, C, assembler, etc (non-BASICs) do not do any of this stuff for you, it's all up to the programmer.


That's assuming that the programmer only uses the AES and VDI bindings and not a library that takes care of these things! There's no reason why Pascal or C should be more difficult to deal with than BASIC when it comes to developing GEM applications. The following piece of code display and handles a windowed dialog with all types of objects supported by MagiC and XaAES:

Code: Select all

#include <stdlib.h>
#include <aes.h>
#include <string.h>
#include <stdio.h>

#include "test.h"
#include "vgem.h"

static int handle_events(void);
static int main_OnExitObject(VDIALOG *d, VEVNT *e, int exitobj);

int my_apid;

int main(int argc, char *argv[])
{
   OBJECT *o_main, *i_main;
   VDIALOG *d_main;

   my_apid = application_init("test.rsc", "  Just a test");   

   o_main = get_object_tree(DIALOG);
   i_main = get_object_tree(ICON1);

   /*
   ** Dialog
   */
   d_main = create_dialog(o_main, i_main, " Visual GEM ", SIZER|VSLIDE|HSLIDE|FULLER|UPARROW|DNARROW|RTARROW|LFARROW);
   d_main->OnExitObject = main_OnExitObject;

   open_dialog(d_main, -1, -1);
   
   handle_events();
   
   destroy_dialog(d_main);
   application_exit();

   return 0;
}

/*
** Handle events.
*/
static int handle_events(void)
{
   VEVNT event = {
      MU_KEYBD|MU_BUTTON|MU_MESAG|MU_TIMER,
      256+2, 3, 0,
      0, 0, 0, 0, 0,
      0, 0, 0, 0, 0,
      {0,0,0,0,0,0,0,0},
      500,
      0, 0, 0, 0, 0, 0,
      0};
   
   while (event.msg[0] != AP_TERM)
   {
      event_multi(&event);
      handle_windows(&event);
   }

   return 0;
}


/*
** This function is called whenever an EXITOBJECT is selected in the dialog.
*/
static int main_OnExitObject(VDIALOG *d, VEVNT *e, int exitobj)
{
   switch (exitobj)
   {
      case OK:
         printf("OK pressed\n");
         send_ap_term(my_apid);
         break;
      case RADIO1:
         printf("Radiobutton 1 pressed\n");
         break;
      case RADIO2:
         printf("Radiobutton 2 pressed\n");
         break;
      case RADIO3:
         printf("Radiobutton 3 pressed\n");
         break;
      case CHECK:
         printf("Checkbutton pressed\n");
         break;
   }

   return FALSE;
}


It use my own little library which handles windows and dialogs completely transparent to the developer. If you want to write a simple, single dialog app you could take this code and only extend the OnExitObject function. If you want to display several dialogs simultaneously you just add more create_dialogs() and open_dialogs() calls. You can attach code/functions or containers to events and to each object in the dialogs. E.g.

Code: Select all

extobj(d_main->o + OK)->OnClick = main_OnClick;
assigns the function main_OnClick() to the button with index OK, and this function will then automatically be called whenever you click on this button.

This is ofcourse the normal way of developing GEM applications, once you've found (or created) a library that suits your need you generally don't need to worry about the AES or VDI bindings except when doing stuff that doesn't fit in a generic library.

Charles: As I said in another reply you might want to consider using a library like this. You still need to understand how the AES and VDI works, but you'll save a huge amount of time when doing GEM stuff.

Oh, in case anyone wonders why I wrote my own library instead of using one of the already existing - it was fun and a good exercise ;-) And I found most other libs (like CF-Lib and WinDom) too bulky and complex, they try to do everything instead of going for a lean, modular consept. My library is focused on windows and dialogs and is only 11Kb compiled.
Jo Even

VanillaMiNT - Firebee - Falcon060 - Milan060 - Falcon040 - MIST - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2596
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: pascal ascii characters

Postby charles » Thu Jan 31, 2008 1:49 pm

Again in C, but it's very simple code and should be easy to follow.

yep , i can clearily see the pattern a program follows to launch a successful application.
i use something very similar in pascal....except i pulled apart the demo version of mine sweeper and had worked backwards from complete program to parts of prog.
you're better than a text book , but this is too much allready.....

I'm not sure if HS Pascal allows pointers to functions,
doesn't matter i use pure pascal now
yep i think i asked in another thread about it ,,,,,???????
can you tell me a little about it ?
what its function is or how it reacts within a program..might be different i pascal??

but if it does you should use a function like this. Then you can use this function for all window redraws simply by passing a pointer to the appropriate redraw function.

Btw. the rc_intersect() function (or was it a macro?) was stolen from Tim Ohren's excellent ProGEM articles. I strongly suggest reading them, even though they are 20 years old or so they're still relevant.

okay , i only read english /speak english...


This is the easy stuff - creating windowed dialogs that works under TOS, MagiC and N.AES/XaAES is a whole other issue.

yes i assume these desktop /o.s.'s install their own windows and fonts and stuff....
i do not use any of these and tend to just use plain tos 1.2 from basic atari desktop..
so no problems!

Something apparently simple like using edit fields took me ages to figure out.

good i got a thread on that somewhere too!!!,i didn't quite figure it completey out ..
not that there were any conflict , it just did not get my boxtext cursor to perform like desired...ed_start,ed_init..etc ?????

If you want to make proper GEM applications with Pascal you might consider switching to Pure Pascal and use a library called Object Gem. It will take away lot of the hard work when making GEM applications.

noway , i just recieved this a couple days ago ,,i have it ...and this is the perferred pascal i use too.
you do not have the hlp files to pure pascal , do you?

charles
The radioactive half-life : )
Atari is a lifestyle,not a hobby.
HOLD ON ! ! ! Im printing unreadable characters ...!

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2596
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: pascal ascii characters

Postby charles » Thu Jan 31, 2008 2:03 pm

okay i'll be back later , but i have question..
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
VEVNT event = {
MU_KEYBD|MU_BUTTON|MU_MESAG|MU_TIMER,
256+2, 3, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
{0,0,0,0,0,0,0,0},
500,
0, 0, 0, 0, 0, 0,
0};
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

evnt_multi XXXXXXXXXXXXXXXX

the first value of parameter passed is which type of evnts to poll for

is | the c symbol for 'or' ?
does add work too?

the second value is the one i should ask about ..
i have concluded ,but do not know for sure ,,,
0 is for one button ,
1 is for right button,
and
2 is for both buttons .

so 256 is always added , or is it added because of one of the extra commands?
like i would use 0,1,2 when MU_BUTTN
and then 256 with the MU_TIMER
and now when combined i use 256+2..is this true or is it because
256 is the mask and we are checking for bits 0,1,2 ???????

okay just checkin out what i learned so far.

charles
The radioactive half-life : )
Atari is a lifestyle,not a hobby.
HOLD ON ! ! ! Im printing unreadable characters ...!

User avatar
Desty
Atari God
Atari God
Posts: 1970
Joined: Thu Apr 01, 2004 2:36 pm
Location: 53 21N 6 18W
Contact:

Re: pascal ascii characters

Postby Desty » Thu Jan 31, 2008 2:26 pm

charles wrote:is | the c symbol for 'or' ?
does add work too?

Yep, | indeed means a bitwise-or in C. But add won't work. When you see flags being combined with the OR operator like this, you'll see that every flag is a unique power of two:
1, 2, 4, 8, 16, ... Every power of two consists of all zeros and a one somewhere in binary:
00000001 = 1
00000010 = 2
00000100 = 4 ... etc.

You probably know this stuff already, but just in case. Anyway, by OR-ing those numbers, you can see that none of the ones can be wiped out, and no two numbers will interfere with each other. You can always check if a particular flag is set by AND-ing the current value with that flag and checking if the result is non-zero (it will be either zero or equal to the flag value).
So if you have three flags, say for text styles bold=1, italic=2, underlined=4, you could set the current text style to: BOLD | ITALIC | UNDERLINED = 0001 | 0010 | 0100 = 0111.
Then to check if the current style includes bold: 0111 & BOLD = 0111 & 0001 = 0001, which is nonzero and thus true. You couldn't use addition instead of OR-ing, because OR works on individual bits whereas addition can carry forward to the next most significant bit, which would flip the wrong flags if you're setting something that's true (e.g. if the style is 0111 then adding ITALIC would turn off italic and underline. OR-ing would just have no effect). If you want to flip values on and off (change BOLD to opposite state it is now) you'd use XOR.

charles wrote:the second value is the one i should ask about ..
i have concluded ,but do not know for sure ,,,
0 is for one button ,
1 is for right button,
and
2 is for both buttons .

I don't think 0 wouldn't be used, because you OR-ing it would have no effect. It might be 1, 2, 4.
tá'n poc ar buile!

joska
Hardware Guru
Hardware Guru
Posts: 4499
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: pascal ascii characters

Postby joska » Thu Jan 31, 2008 2:32 pm

charles wrote:is | the c symbol for 'or' ?


Yes.

charles wrote:does add work too?


Not sure what you mean.

charles wrote:the second value is the one i should ask about ..
i have concluded ,but do not know for sure ,,,
0 is for one button ,
1 is for right button,
and
2 is for both buttons .


The second parameter specifies how many clicks to wait for, in this case it returns after max. two clicks (doubleclick). The actual number of clicks is returned in the last parameter.

The third parameter specifies which buttons to wait for, this is a bitmask. Adding 256 effectively sets bit 9, which means that you can wait for either button. If bit 9 is not set, you can only wait for one button.

All this is well documented in various docs, like tos.hyp, GEMlib documentation, Atari Compendium etc.
Jo Even

VanillaMiNT - Firebee - Falcon060 - Milan060 - Falcon040 - MIST - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64

User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2462
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: pascal ascii characters

Postby lp » Thu Jan 31, 2008 2:59 pm

Joska wrote:
That's assuming that the programmer only uses the AES and VDI bindings and not a library that takes care of these things! There's no reason why Pascal or C should be more difficult to deal with than BASIC when it comes to developing GEM applications. The following piece of code display and handles a windowed dialog with all types of objects supported by MagiC and XaAES:

That's exactly what I'm assuming "right out of the box", not a few months later after making a lib. He clearly ain't at that level, hence the TEXT command does exactly what v_gtext() does, not to mention slightly faster.

joska
Hardware Guru
Hardware Guru
Posts: 4499
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: pascal ascii characters

Postby joska » Thu Jan 31, 2008 6:22 pm

lp wrote:That's exactly what I'm assuming "right out of the box", not a few months later after making a lib. He clearly ain't at that level, hence the TEXT command does exactly what v_gtext() does, not to mention slightly faster.


You don't need to write a lib, there are plenty around. If charles wish to continue using Pascal (and not switch to C) there is Pure Pascal and ObjectGEM, which is very good stuff if you like to type BEGIN and END instead of { and } ;) This combination was popular in Germany in the late nineties, apps like CAB and Texel are written using ObjectGEM. You need to adapt to OO though.
Jo Even

VanillaMiNT - Firebee - Falcon060 - Milan060 - Falcon040 - MIST - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64

User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2462
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: pascal ascii characters

Postby lp » Thu Jan 31, 2008 6:33 pm

I've seen his GFA code via private mailings, trust me when I say, it would be surprising if he utilized any lib.

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2596
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: pascal ascii characters

Postby charles » Fri Feb 01, 2008 12:26 am

yeah
i just had alot of functions pre declared ,
then i had two or three arrays which
i used to capture midi data with ,
i used the timer to clock the length of time before data began,
length in beetween data
and length of datas..on to off points..
it was difficult , because while doing this i also needed to
route out previousilly captured data (reading all thoses arrays back out the midi port)
going through these arrays in a loop !!!!
while monitoring the menu ,
drawing grafics and
printing to screen a some how hand made timer....along with a bar to represent the time/read position of song ......

program never really sat still, just kept continouslly playing the midi loop until i developed the play stop and record buttons...

the grafics really "bunged up" gfa and printing or TEXT-ing every increment of my timer/millisecond didn't help.
it was at this point more of a strob-ing disco light than a program to make music with...grafics all screwey
on /off
and the
bar going across the screen ...with my notes on a make shift staff(i suck at grafics too!)...all the pulsing didn't work and vsync was really affecting the playback timer.

pascal cleared up and eliminated any mysterious phulnders gfa amplified..
so i been with pascal ever since...
the text thing is still an issue , its not the text call only its all the gfa vdi arrays,
you've missed the point again ,i will tell you about this later lonny .


You don't need to write a lib, there are plenty around. If charles wish to continue using Pascal (and not switch to C) there is Pure Pascal and ObjectGEM, which is very good stuff if you like to type BEGIN and END instead of { and } This combination was popular in Germany in the late nineties, apps like CAB and Texel are written using ObjectGEM. You need to adapt to OO though.
lp wrote:That's exactly what I'm assuming "right out of the box", not a few months later after making a lib. He clearly ain't at that level, hence the TEXT command does exactly what v_gtext() does, not to mention slightly faster.


]]]]]]]]]]]]]]]]]]]]
You don't need to write a lib, there are plenty around. If charles wish to continue using Pascal (and not switch to C) there is Pure Pascal and ObjectGEM, which is very good stuff

you mean the "gem " unit within pascal.....
USES GEM;
???????????????? i gonna google object gem too????????????????????
if you like to type BEGIN and END instead of { and } ;) This combination was popular in Germany in the late nineties, apps like CAB and Texel are written using ObjectGEM. You need to adapt to OO though.
'''''''''''''''''''''''''''''00'''''''''''''''''''''''''''''
? like #00 pascal string , null end? is right?
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''

and i have skipped lots of other stuff , so all you three i talk to i talk to later, i have small pascal demo to post , but nobody uses the damn thing either so will be useless if youjust wish to analyse visually..
charles
the library was good , taught me about passing parameters , taught me about vdi gem tos,
even discovered the vdisys gemsys method after dpoke lpoke and poke
okay loads on mind i will start new thread for this new program entitled"haze-dayz"

charles
i think , but not certain pascal uses 256 +1for left mbut...+
for right butt...or 3 for both..because if i use just like 200 for instant and i try to uses the keyboard to leave , nothing happens until i'm over 255..but you'll see in the demo , which of course has me nervous , ...we'll be here for a while.
i know the amount of clicks evnt multi needs???? , but wait ,
i need some back up evidence i provide...
The radioactive half-life : )
Atari is a lifestyle,not a hobby.
HOLD ON ! ! ! Im printing unreadable characters ...!


Social Media

     

Return to “C / PASCAL etc.”

Who is online

Users browsing this forum: No registered users and 3 guests