Is it a lost cause?

Insecurity based on perception of personal mediocrity is realistic. If there's any possible way to do something stupid, people will find it.
--
Pete
Reply to
Peter Flass
Loading thread data ...
Governments want you to hear their message and no one else's.
So they cam pretend they actually know what they are doing
--
A lie can travel halfway around the world while the truth is putting on  
its shoes.
Reply to
The Natural Philosopher
And GNU Ada 2012 (GNAT).
--
Bill Findlay
Reply to
Anonymous
many
Yup, but with "adult" supervision.
/BAH
Reply to
jmfbahciv

I downloaded the code and unfortunately ran out of disk space on the antique dual core laptop.
There's a pile of directories under the "common" directory for each cpu architecture.
Configuration is handled by a configuration program that tries to autoconfigure the compiler based on the architecture and os...
You have to build it to appreciate how much work went into automating the process. First time I saw this was the rn news reader in '86.
There are shell level tests for standard unix program utilities and libraries which build a config file. When I used to build this stuff in 86 or so I think I did all the configuration editing manually... back in the 2.8 or 2.9 days IIRC.
Anyway... I've added an external USB drive to this $30 Thinkpad and I'm going through the build again. Takes a while.
Bill
Reply to
none
And in my current Ubuntu 16.04 they include Open-Cobol, FreePascal, and the GNAT Ada 95 compiler... so
c, c++, Pascal, Ada, Cobol, Assembler, Tcl and TK, various shells including bash, sh, ksh, zsh, csh, tcsh...
All in all a pretty good free collection of goodies.
The hardware (old T61 dual core laptop) cost me $30 + 25 for the disk drive... and would've had more room if I didn't set it to dual boot with Win10 as a trial run on Win10.
I'm going to install FreeBSD and check out zfs mirroring with a pair of drives next.
The only thing required is high speed internet for the downloads (which can usually be done at a library for wifi... if I wasn't on Fios here.
Bill
Reply to
none
Time someone added a full function BASIC.
As well as a teaching tool BASIC is useful for debugging algorithms.
Full function includes MAT instructions, BCD variables, disk handling, print formatting and sophisticated string handling. Compiled BASIC can CALL libraries written in other languages.
Reply to
Andrew Swallow
Well, its better than RPG I suppose, and a bit easier to read than FORTH.
I wouldn't ever teach somebody the program with such an unstructured language. Python is a better initial teaching tool and can probably do anything to BASIC can, and my preferred languages for sorting out an algorithm are C and Java.
But of course ymmv.
--
martin@   | Martin Gregorie 
gregorie. | Essex, UK 
 Click to see the full signature
Reply to
Martin Gregorie
BASIC is ok to start people coding and for very simple jobs.
--
Canada is all right really, though not for the whole weekend. 

"Saki"
Reply to
The Natural Philosopher
Well....
I wrote a fairly full function BASIC in recent years - it works very well on the Pi too.
And oddly enough I've just been looking at adding the old MAT operations into it too.
BCD? No, sorry, but it has all the usual disk stuff. (does anyone actually use BCD these days?) What sort of "sophisticated string handling" are you after?
It's interpreted though. Calling programs works, but calling functions isn't going to happen in it.
I did it for a bit of fun, initially, but people seem to be actually using it for real world tasks on the Pi - which I find somewhat amusing/astounding and frightening in roughly equal portions.
There are a lot of people who'll argue that BASIC is a bad language to start with - they may be right, but lets not forget that Apple and Microsoft both started with BASIC.. ;-)
As for learning - you only learn as good as your teacher teaches. I think I had some very good teachers and was "into" a structured approach, even in the late 70's with the old BASICs on the Apple II and (80's) BBC Micro all those years back. We didn't have a choice with GOTO - it had to be used, but with a bit of thought it wasn't that hard to write a program that was readable that didn't end up like the usual pile of spaghetti code.
Here's some examples:
Old school:
10 REM TOSS A COIN 20 c = RND (2) 30 IF c = 0 THEN GOTO 100 40 PRINT "Tails" 50 PRINT "Try again "; 60 INPUT t$ 70 IF t$ = "y" THEN GOTO 20 80 END 100 PRINT "Heads" 110 GOTO 50
New stuff:
// Flip a coin
cycle coin = rnd (2) // gives 0 or 1
if coin = 0 then print "Heads" else print "Tails" endif
print "Try again "; input try$ repeat until try$ "y" end
some folks might not like it, but I do - that's why I wrote it :-)
I use it myself for various stuff too - had to do some data analysis recently with data supplied in CSV format - wrote it in my BASIC and it worked a treat. Now thinking of writing a "split" type procedure into the language to make splitting a CSV type line faster - but that might be cheating :-)
But then I've already written it - although it's not that fast: (when you have 4 files of about a million lines each to process)
// splitCsv: // Split a single line and fill a global variable with the // individual components
def proc splitCsvLine (csvLine$)
local t$, q$ local i, length, csv
for i = 0 to 5 cycle csv$ (i) = "" repeat
i = 0
length = len (csvLine$) if length = 0 then endproc
csv = 0 t$ = "" for i = 0 to length - 1 cycle q$ = mid$ (csvLine$, i, 1)
if q$ = "," then // Process a comma csv$ (csv) = t$ csv = csv + 1 t$ = "" else t$ = t$ + q$ endif
repeat
csv$ (csv) = t$ // Last one
endproc
Hey ho...
If you have Raspbian on your Pi and it's relatively up to date then you have my BASIC already installed - try typing:
rtb
in a terminal, or find it via the GUI menu thingy. Latest manual can be found here:
formatting link

If you don't have it, then: sudo apt-get install rtb
And FYI: rtb is written in C. None of this c++ or pithon nonsense here!
Enjoy,
Gordon (Punk Rock Programmer -
formatting link
)
Reply to
Gordon Henderson
were
diagnostic.
though
s;
VMS.
autoconfigure
I've done enough design of build procedures and packaging to have a glimmer of appreciation ;-).
libraries
2.9
The TOPS-10 monitor builds could be canned. We would ship TOPS10.RELs which had all the rels except for the site configuration dependent modules which required a compilation of COMMON, COMMOD, COMDEV, S, F, and ..... (poof! went the last filename). Then the RELs of these assemblies could be PIPed together with the appropriate TOPS10.REL, then LINKed to generate the EXe.
going
/BAH
Reply to
jmfbahciv
Part of the issue now is that you can't jsut turn a computer on, wait (oh, 0.1 to 0.5 seconds) for the beep then start typing BASIC into it...
It has to be booted - from disk/sd/network... then you need to login, run up the GUI (if it doesn't auto start), then work out where to find a terminal emulator utility, or the BASIC interpreter icon in the menus...
Then the bell goes and its off to the next clas...
This is the same for all everything now - be it Python, Scratch, Java, etc.
I think its rather sad, really.
I did try an experiment way back to see just how fast I could get my BASIC running on a Pi from boot-time. 5 seconds was the best I could do it in, but you got no network and a read-only filesystem at that point.
Gordon
Reply to
Gordon Henderson
My first attempts in that area ...
-----ooooo-----
C R A P *********
Create Rapidly Applications Programs
Copyright (c) 1989 by Gareth Alun Evans
CRAP version 1.00 is my gift to the Human race. It is in the public domain. It is given to ALL humans, regardless of sex, colour, race, creed, religion, place of birth, nationality, place of residence or any other characteristic. It may be freely distributed in any country of the world. Obviously, it may not be sold, because it already belongs to everybody! (Charges may be levied for copying and distribution, however.)
Your help as a Beta Tester is appreciated.
No money is solicited, so don't send any!
CRAP.DOC *
*******
This file is the only documentation for the CRAP language. If it is not enough for you, then regrettably, you are probably too inexperienced a programmer for the language. (Ye Gods! Abuse, and hardly started!)
To be a successful systems programmer, you need a devious mind! The name of "CRAP" was therefore, obviously, conceived before the acronym, "Create Rapidly Applications Programs".
RELEASE NOTES *
************
The CRAP Version 1.0 release consists of the following files:
* CRAP.DOC This documentation file.
*
CRAP.COM The interpreter root.
* CRAP.CRP The compiler/linker (used by CRAP.COM).
* BASE.COM The master for creating your .COM programs. This is automatically invoked when DUMPing.
*
LIBRARY.CRP The library procedures, for starting new programs. Contains the String, I/O, Maths and File routines. Each new program thus starts with "RESTORE LIBRARY".
INTRODUCTION ************
The CRAP language is based upon both "Forth" and "C". CRAP is reverse Polish. It eliminates the stack confusion of Forth (SWAP, DUP, DROP, OVER, etc.) by providing local variables.
The 32k CRAP.CRP is a complete compiler and linker, with the unusual capability of being able to recreate source files. (Separate source files can be recreated if vocabularies are used.)
New programs and commands can be entered either from the keyboard or via batch files. If a source program is in NAME.SRC, then just type "@ NAME". Batch files can include any commands, including calling other batch files.
Each program you develop can run stand-alone, or you can revise it by reloading it into the CRAP compiler. Each program that has been DUMPed has both a NAME.COM and a NAME.CRP. (Both are needed to run stand alone). CRAP itself is like this - the compiler/linker has been developed in CRAP. It is an interesting exercise to load CRAP into itself and look at the listing - CAUTION - over 50 pages of it, and no way of stopping it!
Thus: A>crap CRAP> restore crap CRAP> list * (or PLIST * to print, or FLIST fname * to create the source file fname.src )
It is inadvisable to type in new programs from the keyboard. The inevitable syntax errors are given meaningful error messages, but the whole of the brick currently being entered is lost. So - use batch files, prepared off-line by your editor.
There is no limit on program size. Array size should not exceed 32000 (integers) (equivalent to 64000 bytes, not quite 65536). CRAP is free format (spaces are necessary). Thus the above could be "restore crap list *
".
Warning - if you do not type in enough parameters, CRAP keeps prompting you ( spaces and returns are ignored):
CRAP> restore CRAP> CRAP> CRAP> CRAP> crap CRAP> list CRAP> CRAP> CRAP> *
If you think you might have got into this situation, try typing the Software Scream, "aargh".
Program procedure bricks can be entered without any formatting. CRAP will still list them out structured and indented neatly.
GETTING STARTED *
**************
At the MS-DOS prompt, type "CRAP". A>CRAP
This brings up the CRAP compiler with its own prompt. CRAP>
Load in the binary dump of the libraries. CRAP> restore library
Define your initial vocabulary. CRAP> : vocab vnew
Enter this simple program (EXACTLY as shown). N.B. All spaces are needed in the second line. CRAP> : proc firstprocedure CRAP> " Hello World!\0A\0D " console call CRAP> ;
Link firstprocedure as the start of your program. CRAP> link firstprocedure
Create stand alone version. CRAP> dump myprog
Quit back to MS-DOS CRAP> quit
Now run and see what happens! A>myprog
Now, lets grow it a bit. A>CRAP CRAP> restore myprog
Enter this second bit of program CRAP> : vocab vnew CRAP> : proc secondprocedure CRAP> lint counter CRAP> 10 I> counter CRAP> loop CRAP> counter 0 = until CRAP> firstprocedure call CRAP> counter 1 - I> counter CRAP> repeat CRAP> ;
Link secondprocedure as the start of your program. CRAP> link secondprocedure
Create stand alone version. CRAP> dump myother
Quit back to MS-DOS CRAP> quit
Now run and see what happens! A>myother
VOCABULARIES ************
Each "bit" of CRAP is called a BRICK. Bricks are contained in VOCABULARIES. Vocabularies are the means to recreate separate source files. Eg., If you look at CRAP itself, type "flist strings crapstrg". This will create a batch/source file called "STRINGS.SRC", containing the strings library, "crapstrg". (Plist crapstrg prints it, LIST crapstrg displays it)
LIST * lists everything. LIST vocabname lists all bricks in the vocabulary. LIST brickname lists a single brick.
So, with CRAP itself, "LIST STRCPY" will list the string copy procedure brick.
To create a new vocabulary, type ": vocab newname". All subsequent bricks will then be put into newname.
Note: vocabularies themselves are in the master vocabulary, "GAIA", named after the ancient Greeks' Earth Mother. GAIA, being a vocabulary itself, is also included in GAIA! This causes some confusion when examining the DIRectory, or a LIST *
.
If you wish to revert to an earlier vocabulary, type its definition again, ": vocab oldname". To remind you of the current vocabulary, type "VOCAB".
All bricks are defined using the colon ":" command:
: vocab vname create new vocabulary, or return to previous.
: int iname create global integer.
: arr aname 50 create global array of 50 integers.
: poi pname create global pointer.
Remember - under the free format rule, the above could have been entered as: ": vocab vname : int iname : arr aname 50 : poi pname"
To see all the commands, type "HELP".
COMMANDS ********
QUIT Get back to DOS. Also optional on last line of .SRC file.
@ fname Execute batch/source file . Do not type the .SRC.
INFO Print the startup copyright notice.
HELP Brief resume of all the commands.
: bname .. .. Define new brick (more of this later)
DIR Directory of all bricks in their vocabularies.
DUMP fname Produce stand-alone fname.com and fname.crp. (The main procedure will need to have been LINKed).
FLIST fname bname Create fname.src.
FORGET bname Forget a brick. It won't be listed, and cannot be called.
LINK bname Connect a procedure brick as the outer level of a program. (It must not need any parameters).
LIST bname List a vocabulary, a brick, or all (*).
NEW Delete the current program, and revert to the minimum, which is just the GAIA vocabulary.
PLIST bname List to printer.
REM A comment - all text to end of line is ignored.
RESTORE fname Get back a binary DUMP for further development.
RUN Run program from CRAP - needs to have been LINKed.
STACK Debug aid - check before and after RUNning, should be same.
UNLINK Disconnect, so a program cannot be run.
VOCAB Remind one of the current vocabulary.
AARGH The Software Scream - for tight spots with free format input.
So, suppose that MYPROG is to have its main procedure replaced, possibly because of bugs:
CRAP> restore MYPROG Get old binary dump. CRAP> forget MAIN Lose old definition. CRAP> @ main Compile new definition. CRAP> . CRAP> . CRAP> . CRAP> . CRAP> . CRAP> . CRAP> link MAIN Relink for execution. CRAP> dump MYPROG Save executable version.
Note: The old binary code of MYPROG will still exist as garbage. To get rid of it, a complete FLIST is necessary, followed by a NEW, and the appropriate "@"s to recompile. However, for incremental debugging, the old versions can be carried along, at the expense of a (temporarily) larger .CRP file.
BRICKS *
*****
COMMENTS -------- : comment This is a comment ; : comment Here is another comment ;
The semicolon terminates the comment. All bricks have a unique name. In the first comment, "This" is taken as the name. Therefore, all other comments must not start with "this"!
INTEGERS 16 bit quantities -------- : int i1 a variable. : cint i2 12345 a constant, with its decimal value.
POINTERS Special 32 bit quantities (8086 offset and segment) -------- : poi p1 a variable. : cpoi p2 i1 a constant pointer, pointing to i1. : cpoi p3 strcpy a constant pointer, pointing to the STRCPY procedure.
For constant pointers, a brick name must be given to point to.
ARRAYS ------ Arrays are arrays of integers. The zeroth element contains the size. When arrays hold strings, a trailing zero byte is used to terminate, as in the "C" language. (But because of the zeroth integer, strings start at the second (0,1,2) byte).
: arr a1 5 a1 contains 6 elements, the zeroth containing 5. Note: Size is given in decimal.
: carr a2 3 \1234 \0a \0d A constant array. Size is given in decimal, but each integer (all must be given) is in hex. Note: If defining a constant array to hold text, the pairs of bytes have to be given in reverse order (Most significant first). Thus "ABCD" comes out as \4241 \4443. (Use strings in procedures - more obvious ).
VOCABULARIES ------------ : vocab v1 all vocabularies go into the GAIA vocabulary. : endv endv1 end of vocabulary - optional and ignored, because the endv is produced automatically when the vocabulary is defined.
PROCEDURES *
*********
For a better education, list out some of the vocabularies of CRAP itself.
Procedures are generally reverse polish. It is up to you to keep track of the program stack (So, in some ways, CRAP is as much crap as is Forth). Integers take 2 bytes, pointers (addresses) take 4 bytes. All procedures return an answer of one integer on the stack.
Procedures can be passed integer and pointer parameters. These must be defined first (pints and ppois).
Thus, if a procedure is passed 2 integers, A & B, and 3 pointers, C, D & E, : proc newname pint A pint B ppoi C ppoi D ppoi E.
Procedure definitions are terminated by the semicolon ( or can be aborted by the Software Scream, "Aargh").
After the parameters come the local integers: lint X lint Y lint Z Then the local pointers: lpoi LP1 lpoi LP2 Then the local arrays: larr localarrayname 50 Then follows the body of the procedure.
Thus: : proc pname B O D Y O F P R O C E D U R E ;
COMMENT ------ /* This is a comment */ /* This is another */ /* You should have the idea by now */
CONSTANTS --------- Decimals 12345 -1 32 Hex \FFFF \0a Ascii 'A' 'B' ( But use 32 for space) True (-1, \FFFF) true False (0) false String " This is a string " Note: Spaces are necessary to separate the "s from the string. String with control codes " Hello World!\0A\0D "
INTEGERS -------- To read onto stack, just give name, whether local, parameter or global. To write out from stack, precede name by "I>". To copy A to B: A I> B To increment A: A 1 + I> A To get only the lower byte (Top byte becomes 0), precede by "BYTE": BYTE A I> B To set i1 to 3, and then use as answer of procedure: 3 I> i1 i1 answer
POINTERS ------- As for integers, but use "P>". To copy P1 to P2: P1 P> P2 To put address of i1 into P1: & i1 P> P1 To put the value 1234 in the integer P1 points to: P1 1234 I= To put the address of i1 in the pointer that P1 points to: P1 & i1 P= To put an ascii character in the byte that P1 points to: P1 'A' B= To fetch the integer that P1 points to: P1 I[] To fetch the byte that P1 points to: P1 B[] To fetch the pointer that P1 points to: P1 P[] To increment a pointer by one byte: ++ P1 To decrement a pointer by one byte: -- P1
ARRAYS ----- Arrays are used as are pointers. An array can only be accessed by getting its address (Thus leaving a pointer on the stack): & arrayname To point to the 5th byte of an array: & arrayname 5 b. To point to the 5th integer of an array: & arrayname 5 I. To point to the 5th pointer of an array: & arrayname 5 P.
Strings execute as though they are arrays, leaving a pointer to the array size on the stack: " Hi there! "
PROCEDURES ---------- To call a procedure, just give its name: procedurename All procedures return an integer (defaults to zero) which must be used. To pass to an integer: procedurename I> i1 For statement level procedure call, ignoring result: procedurename call The library procedure, "Console", requires one pointer parameter: " Hello World!\0d\0a " Console call Or: " Hello World!\0d\0a " P> P1 P1 Console call Indirect procedure call via pointer: & Console P> P1 " Hello World!\0d\0a " @ P1 call
CODE INSERTS ------------ For religious maniacs only (....God help you!): code 5 \21 \34 \ff \a9 \21 ( Decimal count and hex bytes)
OPERATORS --------- integer integer + integer integer - integer integer * integer integer / integer integer % modulo integer integer mask logical and integer integer union logical or integer integer xor logical exclusive or integer integer shl shift left integer integer shr shift right integer integer > greater than integer integer >= greater or equal integer integer < less than integer integer
Reply to
gareth G4SDW GQRP #3339
Have you _looked_ at Visual BASIC? The notion that BASIC can "only do simple jobs" is like the notion that "COBOL is always slow". It is a nice homily that bears little resemblance to reality.
If all you have is a hammer, everything looks like a nail. In corporate America the only programming languages available to the average person who is not part of the IT department are Visual Basic for Applications, the Windows console command processor, Powershell, and Javascript running in a browser. And people who need to get work done use those and do remarkable things with them.
Reply to
J. Clarke
My point is that teaching yourself BASIC is a pretty good way of teaching yourself how to write an unstructured mess while teaching yourself Python will at least give you the basics of structured programming and thus a helping hand toward writing something that you will be able to easily change in a year's time.
--
martin@   | Martin Gregorie 
gregorie. | Essex, UK 
 Click to see the full signature
Reply to
Martin Gregorie
BCD is useful for accounting applications. When calculating money in trillions you need at least 15 significant figures, including the cents.
String handling - read, write, print, assign, arrays, convert to/from number formats, extract character, insert character, insert substring, append character, append second string, search string for second string, extract substring, compare strings including constants, strip trailing spaces. Open and close string filename. All the thing you do with strings when writing a compiler or text processing program.
BASIC can handle 20 page programs but ensuring you do not use the same variable name for two different things get harder.
You do need structures like IF ... THEN ... ELSEIF ... ELSEIF ... ELSE ... ENDIF same for loops and end of file.
Good.
Reply to
Andrew Swallow
BASIC programs using GOTOs has been largely discredited and as you know went out with the arc. One of the main reasons is that code modifications often necessitate renumbering which is a nightmare when many GOTOs are used. Procedural constructs (PROC-ENDPROC) also make programming significantly easier to follow making line numbering unnecessary.
Using a simple REPEAT-UNTIL loop the whole program can be done in 6 lines without a single GOTO and no line numbers.
REM TOSS A COIN REPEAT c = RND(2) IF c = 1 THEN PRINT "Heads" ELSE PRINT "Tails" INPUT "Try again";t$ UNTIL t$ = "n"
Richard
Reply to
Richard Ashbery
1996 MDC at Moscone ... all the banners said "Internet" ... but the constant refrain was "Preserve Your Investment" ... aka 80s/90s business, safe, closed, local area networks ... with convention of business apps with embedded visual basic that automatigically executed. The network support was extended to network w/o any countermeasures to the wild, anarchy of the internet (and all the automagic visual basic paradigm would continue to exist).
Most of the 90s, the majority of internet related exploits was because of various c language related programming bugs ... but by the start of the century ... the automagic execution exploits had increased to match the c language programming bugs
past posts about c language bugs/exploits
formatting link
--
virtualization experience starting Jan1968, online at home since Mar1970
Reply to
Anne & Lynn Wheeler
Snip stuff about what looks like a nice, scripted programming language, though somewhat removed from traditional BASICs!
I've just installed it on my old RPi B+ for later investigation by using:
$ sudo apt-get install rtb
which did the trick and also added the libsdl-sound1.2 and wiringpi packages. I'm pleased to be handed the latter as I think I may need it soon.
rtb basically 'just works' despite me runnUnable to initalise the sound system: Mixer not built with MP3 support
but adding the -s option fixed that.
Out of sheer curiosity, did you write the parser by hand or did you use lex+bison?
To me that's a job for awk, a UNIX utility that's been around forever, and is commendably fast.
By default, awk reads all the lines in a file, splitting them into fields (whitespace is the default field delimiter, so the default to to convert the line into a list of words) and then uses regular expression patterns that apply 'actions' to the lines that match. It also has two special patterns, BEGIN and END that trigger actions at the start and end of a run
Suppose you have a CSV file in which lines containing the word 'Amount' at the start of the line have an amount in the 5th field that you need to add up, this would do it:
BEGIN { FS="," } /Amount/ { total=total+$5 } END { printf("Total amount: %6.2f\n", total) }
where: - FS="," set the field separator to a comma - /Amount/ is the pattern runs the associated action on that line - actions are written after the triggering pattern and enclosed in curly brackets - $5 is the 5th field on the line - the print format uses 'f' to print a decimal amount - the 'total' variable was initialised to zero by default
awk is a standard Linux utility, and so is included in every RPi.
--
martin@   | Martin Gregorie 
gregorie. | Essex, UK 
 Click to see the full signature
Reply to
Martin Gregorie
I got he following msg when I installed it
"Changing RTB to Setuid-Root for GPIO access"
I don't like this.
1) I may not be accessing GPOI, I dont' want applications having root access unless I specificity request it.
2) If I understand correctly root permissions is no-longer required to access GPIO anyway
--
The superior man understands what is right; the inferior man understands 
what will sell. 
 Click to see the full signature
Reply to
alister

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.