Subject:
|
Re: Not eXactly C beta news (NBC)
|
Newsgroups:
|
lugnet.robotics.nxt
|
Date:
|
Thu, 14 Dec 2006 02:06:20 GMT
|
Viewed:
|
11925 times
|
| |
| |
In lugnet.robotics.nxt, Sivan Toledo wrote:
|
In lugnet.robotics.nxt, John Hansen wrote:
|
... This beta
release focuses primarily on improving the Not eXactly C (NXC) programming
language support in the compiler. It is still not done yet but this beta
adds a huge number of features to the NXC compiler.
...
|
Where do we find the sample file test.nxc, or some other documentation of
NXC? I didnt find the sample file in the source and binary distributions of
beta 13.
|
I just uploaded a zip containing a few example programs to the NBC samples page.
http://bricxcc.sourceforge.net/nbc
Im working on documentation. Ill be releasing beta 14 later today (for
all platforms) which has the following new features:
Version 1.0.1.b14
Adds string variables with initialization, assignment, concatenation (including
+=).
Moves ReadSensor, ReadSensorUS, TextOut, NumOut, PlatTone, PlayFile, and
ResetSleepTimer to function status (can be on the RHS of an assignment).
Cls is renamed as ResetScreen. Write is removed (use TextOut and NumOut
instead).
PlayTone is replaced with PlayToneEx(freq, dur, vol, loop).
PlayFile is replaced with PlayFileEx(fname, vol, loop).
Renames InputFieldValue as GetInput and OutputFieldValue as GetOutput.
Reorganizes includes so that NXCDefs.h includes NBCCommon.h and NXTDefs.h
includes NBCCommon.h. NXCDefs.h now defines PlayTone and PlayFile API macros.
It also defines TachometerCount(port) and TachometerLimit(port) API macros
(more to come).
Adds SoundState, SoundFlags, StopSound, ButtonPressed, ButtonCount,
ReadButtonEx, GetFirstTick, PointOut, LineOut, CircleOut, RectOut, and
GraphicOut functions.
Fixes multi-threading issues with variables used as stack and register
variables.
Please email me if you run into any problems. The NXC parser still has some
issues which can lead it into an infinite loop. Im working on ironing out all
those problems as fast as I can.
Heres a quick sample:
#include "NXCDefs.h"
long a=-40, b = 23;
task Fred()
{
OnFwd(OUT_A, 75);
Wait(500);
}
char j=-40, k = 23;
mutex myMutex;
string msg="test", blech;
task main (){
Precedes(Fred);
Random(5000);
if (true)
OnRev(OUT_B, 40);
else
OnFwd(OUT_C, 30);
OnFwd(OUT_A, 20);
a=Random(5000) * 2;
NumOut(0, 20, true, a);
Wait(a);
Off(OUT_A);
/*
do
{
// foobar;
OnFwd(OUT_BC, 50+40);
Wait(500);
Off(OUT_BC);
Wait(1000);
a++; b++;
} while (a < 10);
repeat(10)
{
repeat(4)
{
OnFwd(OUT_BC, 50);
Wait(1000);
Off(OUT_BC);
Wait(2000);
}
}
*/
Acquire(myMutex);
asm {
add a, a, 1
sub b, a, 2
OnRev(OUT_BC, 50)
}
Release(myMutex);
SetSensorType(IN_1, IN_TYPE_SWITCH);
PlayTone(TONE_A4, MS_500);
while(!SoundState())
/* do nothing */ ;
// Wait(500);
PlayFile( "test.rso" );
LineOut(0, 0, 30, 50, false);
PointOut(30, 40, false);
CircleOut(30, 40, 10, false);
RectOut(30, 50, 20, 10, false);
msg += ".r" + "s" + "o" ;
PlayFile(msg);
// Wait(1000);
while(!ButtonPressed(BTN2, true)) ;
}
#define Testing OnRev(OUT_AB, 50)
byte d, e, f;
sub George()
{
OnFwd(OUT_BC, 75);
Testing;
}
John Hansen
|
|
Message has 1 Reply:
Message is in Reply To:
6 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|