To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.nxtOpen lugnet.robotics.nxt in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / NXT / 258
257  |  259
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 didn’t 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

I’m working on documentation. I’ll 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. I’m working on ironing out all those problems as fast as I can.

Here’s 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:
  Re: Not eXactly C beta news (NBC)
 
(...) I have uploaded NBC beta 14 for Linux, Mac OSX, and Win32 platforms. John Hansen (18 years ago, 14-Dec-06, to lugnet.robotics.nxt, FTX)

Message is in Reply To:
  Re: Not eXactly C beta news (NBC)
 
(...) Where do we find the sample file test.nxc, or some other documentation of NXC? I didn't find the sample file in the source and binary distributions of beta 13. (18 years ago, 13-Dec-06, to lugnet.robotics.nxt, FTX)

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
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR