mirror of
https://github.com/cc65/cc65.git
synced 2025-02-23 03:29:00 +00:00
Normalized coding style.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5516 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
1ccfe46892
commit
c3205877cd
@ -28,7 +28,5 @@ static const dlgBoxStr myDialog = {
|
||||
|
||||
void main (void)
|
||||
{
|
||||
|
||||
DoDlgBox (&myDialog);
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
|
||||
/*
|
||||
|
||||
GEOSLib example
|
||||
|
||||
using DlgBoxFileSelect
|
||||
@ -11,17 +9,16 @@
|
||||
26.12.1999
|
||||
*/
|
||||
|
||||
|
||||
#include <geos.h>
|
||||
|
||||
char fName[17] = "";
|
||||
|
||||
void main (void)
|
||||
{
|
||||
|
||||
r0=(int)fName;
|
||||
|
||||
DlgBoxOk(CBOLDON "You now will be presented", "with apps list" CPLAINTEXT);
|
||||
DlgBoxFileSelect("", APPLICATION, fName);
|
||||
DlgBoxOk("You've chosen:" CBOLDON, fName);
|
||||
|
||||
}
|
||||
|
@ -3,8 +3,8 @@
|
||||
#include <conio.h>
|
||||
#include <mouse.h>
|
||||
|
||||
void main(void) {
|
||||
|
||||
void main(void)
|
||||
{
|
||||
struct mouse_info info;
|
||||
char ch;
|
||||
|
||||
@ -28,6 +28,7 @@ char ch;
|
||||
ch = cgetc();
|
||||
cputc(ch);
|
||||
} while (ch!='.');
|
||||
cursor(0);
|
||||
|
||||
DlgBoxOk("Seems that it is all for conio.", "Let's test mouse routines.");
|
||||
|
||||
@ -36,12 +37,13 @@ char ch;
|
||||
mouse_hide();
|
||||
while (!kbhit()) { };
|
||||
cputc(cgetc());
|
||||
|
||||
cputsxy(0, 3, CBOLDON "Now you see the mouse (press any key)" CPLAINTEXT);
|
||||
mouse_show();
|
||||
while (!kbhit()) { };
|
||||
cputc(cgetc());
|
||||
|
||||
/* Get the current mouse coordinates and button states and print them */
|
||||
// Get the current mouse coordinates and button states and print them
|
||||
mouse_info(&info);
|
||||
gotoxy(0, 4);
|
||||
cprintf("X = %3d", info.pos.x);
|
||||
@ -52,7 +54,5 @@ char ch;
|
||||
gotoxy(0, 7);
|
||||
cprintf("RB = %c", (info.buttons & MOUSE_BTN_RIGHT)? '1' : '0');
|
||||
|
||||
|
||||
DlgBoxOk("Bye,", "Bye.");
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
This is an example program for GEOS.
|
||||
It reads GEOS serial number and prints it on the screen.
|
||||
@ -7,6 +6,7 @@
|
||||
05.03.2004
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <geos.h>
|
||||
#include <conio.h>
|
||||
@ -14,7 +14,8 @@
|
||||
const graphicStr Table = {
|
||||
NEWPATTERN(0), MOVEPENTO(0, 0), RECTANGLETO(320, 199), GSTR_END };
|
||||
|
||||
void Exit(void) {
|
||||
void Exit(void)
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@ -22,8 +23,8 @@ void Menu = {
|
||||
(char)0, (char)14, (int)0, (int)28, (char)(HORIZONTAL|1),
|
||||
CBOLDON "quit", (char)MENU_ACTION, &Exit };
|
||||
|
||||
int main(void) {
|
||||
|
||||
int main(void)
|
||||
{
|
||||
dispBufferOn = ST_WR_FORE;
|
||||
|
||||
GraphicsString(&Table);
|
||||
@ -32,6 +33,7 @@ int main(void) {
|
||||
|
||||
DoMenu(&Menu);
|
||||
MainLoop();
|
||||
|
||||
// will never reach this point...
|
||||
return 0;
|
||||
}
|
||||
|
@ -20,8 +20,6 @@ static const graphicStr myString = {
|
||||
|
||||
int main (void)
|
||||
{
|
||||
|
||||
GraphicsString(&myString);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
|
||||
/*
|
||||
|
||||
GEOSLib example
|
||||
|
||||
Hello, world example - with DBox
|
||||
@ -11,25 +9,25 @@
|
||||
26.12.1999
|
||||
*/
|
||||
|
||||
|
||||
#include <geos.h>
|
||||
|
||||
void main (void)
|
||||
{
|
||||
|
||||
/* Let's show what we've got... */
|
||||
// Let's show what we've got...
|
||||
|
||||
DlgBoxOk(CBOLDON "Hello, world" CPLAINTEXT,
|
||||
"This is written in C!");
|
||||
|
||||
/* Normal apps exit from main into system's mainloop, and app finish
|
||||
when user selects it from icons or menu, but here we want to exit
|
||||
immediately.
|
||||
So instead:
|
||||
MainLoop();
|
||||
we can do:
|
||||
(nothing as this is the end of main function)
|
||||
exit(0);
|
||||
return;
|
||||
*/
|
||||
// Normal apps exit from main into system's mainloop, and app finish
|
||||
// when user selects it from icons or menu, but here we want to exit
|
||||
// immediately.
|
||||
// So instead:
|
||||
// MainLoop();
|
||||
// we can do:
|
||||
// (nothing as this is the end of main function)
|
||||
// exit(0);
|
||||
// return;
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
|
||||
/*
|
||||
|
||||
GEOSLib example
|
||||
|
||||
Hello, world example - using graphic functions
|
||||
@ -11,46 +9,43 @@
|
||||
26.12.1999
|
||||
*/
|
||||
|
||||
|
||||
#include <geos.h>
|
||||
|
||||
/* Let's define the window we're operating */
|
||||
// Let's define the window we're operating
|
||||
struct window wholeScreen = {0, 199, 0, 319};
|
||||
|
||||
|
||||
void main (void)
|
||||
{
|
||||
// Let's show what we've got...
|
||||
|
||||
/* Let's show what we've got... */
|
||||
|
||||
/* Let's clear the screen - with different pattern, because apps have cleared screen upon
|
||||
start */
|
||||
|
||||
// Let's clear the screen - with different pattern, because apps have cleared screen upon
|
||||
// start
|
||||
SetPattern(0);
|
||||
InitDrawWindow(&wholeScreen);
|
||||
Rectangle();
|
||||
|
||||
/* Now some texts */
|
||||
|
||||
// Now some texts
|
||||
PutString(COUTLINEON "This is compiled using cc65!" CPLAINTEXT, 20, 10);
|
||||
PutString(CBOLDON "This is bold", 30, 10);
|
||||
PutString(CULINEON "and this is bold and underline!", 40, 10);
|
||||
PutString(CPLAINTEXT "This is plain text", 50, 10);
|
||||
|
||||
/* Wait for 5 secs... */
|
||||
/* Note that this is multitasking sleep, and if there are any icons/menus onscreen,
|
||||
they would be usable, in this case you have only pointer usable */
|
||||
|
||||
// Wait for 5 secs...
|
||||
// Note that this is multitasking sleep, and if there are any icons/menus onscreen,
|
||||
// they would be usable, in this case you have only pointer usable
|
||||
Sleep(5*50);
|
||||
|
||||
/* Normal apps exit from main into system's mainloop, and app finish
|
||||
when user selects it from icons or menu, but here we want to exit
|
||||
immediately.
|
||||
So instead:
|
||||
MainLoop();
|
||||
we can do:
|
||||
(nothing as this is the end of main function)
|
||||
exit(0);
|
||||
return;
|
||||
*/
|
||||
// Normal apps exit from main into system's mainloop, and app finish
|
||||
// when user selects it from icons or menu, but here we want to exit
|
||||
// immediately.
|
||||
// So instead:
|
||||
// MainLoop();
|
||||
// we can do:
|
||||
// (nothing as this is the end of main function)
|
||||
// exit(0);
|
||||
// return;
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -17,8 +17,6 @@ static const void myTab = {
|
||||
|
||||
int main (void)
|
||||
{
|
||||
|
||||
InitRam(&myTab);
|
||||
|
||||
}
|
||||
|
||||
|
@ -40,8 +40,6 @@ static struct menu subMenu2 = {
|
||||
|
||||
void main (void)
|
||||
{
|
||||
|
||||
DoMenu(&subMenu1);
|
||||
DoMenu(&subMenu2);
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
|
||||
/*
|
||||
|
||||
GEOSLib example
|
||||
|
||||
This small application removes GEOS disk write protection tag.
|
||||
@ -12,6 +10,7 @@
|
||||
21.03.2000
|
||||
*/
|
||||
|
||||
|
||||
#include <geos.h>
|
||||
|
||||
char diskName[17] = "";
|
||||
@ -59,16 +58,16 @@ void Error(void)
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
||||
/* Here we clear the screen. Not really needed anyway... */
|
||||
// Here we clear the screen. Not really needed anyway...
|
||||
GraphicsString(&clearScreen);
|
||||
|
||||
/* Get the name of current disk to show it in dialog box */
|
||||
// Get the name of current disk to show it in dialog box
|
||||
GetPtrCurDkNm(diskName);
|
||||
|
||||
while (1) {
|
||||
switch (DoDlgBox(&mainDialog)) {
|
||||
/* What's the result of dialog box? which icon was pressed? */
|
||||
|
||||
// What's the result of dialog box? which icon was pressed?
|
||||
case OK:
|
||||
if (GetDirHead())
|
||||
Error();
|
||||
@ -80,7 +79,7 @@ void main(void)
|
||||
DoDlgBox(&changeDiskDlg);
|
||||
GetPtrCurDkNm(diskName);
|
||||
break;
|
||||
default: /* CANCEL is the third option */
|
||||
default: // CANCEL is the third option
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
#include <geos.h>
|
||||
#include <conio.h>
|
||||
#include <stdlib.h>
|
||||
@ -7,25 +6,30 @@ unsigned char x,y;
|
||||
|
||||
void_func oldMouseVector, oldKeyVector;
|
||||
|
||||
void foo1 (void) {
|
||||
void foo1 (void)
|
||||
{
|
||||
// do something on mouse press/release
|
||||
gotoxy(x,y);
|
||||
++x;
|
||||
cputc('A');
|
||||
|
||||
// call previous routine
|
||||
oldMouseVector();
|
||||
}
|
||||
|
||||
void foo2 (void) {
|
||||
void foo2 (void)
|
||||
{
|
||||
// do something on key press/release
|
||||
gotoxy(x,y);
|
||||
++y;
|
||||
cputc('B');
|
||||
|
||||
// call previous routine
|
||||
oldKeyVector();
|
||||
}
|
||||
|
||||
void hook_into_system(void) {
|
||||
void hook_into_system(void)
|
||||
{
|
||||
// hook into system vectors - preserve old value
|
||||
oldMouseVector = mouseVector;
|
||||
mouseVector = foo1;
|
||||
@ -33,21 +37,20 @@ void hook_into_system(void) {
|
||||
keyVector = foo2;
|
||||
}
|
||||
|
||||
void remove_hooks(void) {
|
||||
void remove_hooks(void)
|
||||
{
|
||||
mouseVector = oldMouseVector;
|
||||
keyVector = oldKeyVector;
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
|
||||
int main(void)
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
|
||||
/*
|
||||
To make cc65 do something for you before exiting you might register
|
||||
a function to be called using atexit call. #include <stdlib.h> then and
|
||||
write:
|
||||
*/
|
||||
// To make cc65 do something for you before exiting you might register
|
||||
// a function to be called using atexit call. #include <stdlib.h> then and
|
||||
// write:
|
||||
atexit(&remove_hooks);
|
||||
|
||||
clrscr();
|
||||
@ -55,16 +58,13 @@ int main(void) {
|
||||
|
||||
hook_into_system();
|
||||
|
||||
/* This program will loop forever though */
|
||||
|
||||
// This program will loop forever though
|
||||
MainLoop();
|
||||
|
||||
/*
|
||||
If not using atexit() you have to remember about restoring system vectors
|
||||
right before exiting your application. Otherwise the system will most
|
||||
likely crash.
|
||||
// If not using atexit() you have to remember about restoring system vectors
|
||||
// right before exiting your application. Otherwise the system will most
|
||||
// likely crash.
|
||||
// remove_hooks();
|
||||
|
||||
remove_hooks();
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
|
||||
/*
|
||||
|
||||
GEOSLib example
|
||||
|
||||
example of using DlgBoxYesNo, DlgBoxOkCancel and DlgBoxOk functions
|
||||
@ -11,6 +9,7 @@
|
||||
26.12.1999
|
||||
*/
|
||||
|
||||
|
||||
#include <geos.h>
|
||||
|
||||
void main(void)
|
||||
@ -22,5 +21,4 @@ void main(void)
|
||||
DlgBoxOk("Ergh, another man...", "Let's go for a beer.");
|
||||
};
|
||||
} while (DlgBoxOkCancel("Do you want to try again?", "") == OK);
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user