jverne / nqc Goto Github PK
View Code? Open in Web Editor NEWNQC (Not Quite C) is a programming language for several LEGO MINDSTORMS products including the RCX, CyberMaster, and Scout.
Home Page: http://www.clevermonkey.org/nqc
License: Other
NQC (Not Quite C) is a programming language for several LEGO MINDSTORMS products including the RCX, CyberMaster, and Scout.
Home Page: http://www.clevermonkey.org/nqc
License: Other
While I learn the code-base, add Doxygen API comments. Once I have enough, add some targets to the Makefile to generate the API docs.
Do I dare try to get this working in Windows 10? The USB support alone might be a quagmire.
It probably needs to be native Windows support, and not through WSL or MinGW.
No matter what mode I put the tower in, -firmfast fails. It starts to upload, issues a series of tones and a beep-beep, and then uploads again until it reports a failure:
3402% ./bin/nqc -firmfast firmware/firm0332.lgo
Downloading firmware:...............................................................................................................................................................................................
No reply from RCX
3402 (253)%
Subsequent commands indicate there is no firmware.
Only fails sometimes, so there seems to be a timing bug somewhere. Maybe where I took out the wait/pause stuff in the OS X specific USB send code?
Lift a logger macro from one of my other project and shove it into NQC. verbose printf is getting old.
Either abandon rcxspy or get it working. It exercises some of the disassembly stuff in RCXlib which is nice, but it looks like it has languished a bit. RCX_Image also does some weird stuff with a char array. Either convert this to use safe string functions or use a C++ string object.
There are a few places where we accept things like strings of directories and hope it fits in a 1024-byte bag. May as well guard against those and squelch the compiler warnings about unsafe use of str*
When compiling this under Windows Subsystem for Linux (WSL) using Ubuntu, I was able to get this to compile using the following steps:
sudo apt install build-essential bison flex
nqc/DirList.cpp
to replace strlcpy()
and strlcat()
with strncpy()
and strcat()
respectively. Usage of sizeof()
worked to at least compile bin/nqc
. Here's the git diff
showing the patched lines. (Note: I'm not sure this is the right way, but it should be close... I think???)diff --git a/nqc/DirList.cpp b/nqc/DirList.cpp
index 766b2b4..6bccc93 100644
--- a/nqc/DirList.cpp
+++ b/nqc/DirList.cpp
@@ -53,7 +53,7 @@ bool DirList::Find(const char *filename, char *pathname)
struct stat stat_buf;
size_t len = sizeof(pathname);
- if (strlcpy(pathname, filename, len) >= len) {
+ if (sizeof(strncpy(pathname, filename, len)) >= len) {
return false;
}
@@ -61,8 +61,8 @@ bool DirList::Find(const char *filename, char *pathname)
return true;
for(Entry *e = fEntries.GetHead(); e; e=e->GetNext()) {
- if (strlcpy(pathname, e->GetPath(), len) < len) {
- if (strlcat(pathname, filename, len) < len) {
+ if (sizeof(strncpy(pathname, e->GetPath(), len)) < len) {
+ if (sizeof(strncat(pathname, filename, len)) < len) {
if (stat(pathname, &stat_buf) == 0) {
return true;
}
make
from the root of the repositorybin/nqc
If this sounds acceptable, I'll open a PR for the change.
Porting my work to Raspberry Pi running some sort of Linux should be doable.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.