On Tuesday 14 March 2017 22:16:17 Kurt Jacobson wrote: > > sudo halcompile --install mux2s32.comp > > worked a treat. Is there a man page? > > Excellent, I'm glad it worked. Here is the man page for the HAL comp > generator: > http://linuxcnc.org/docs/html/hal/comp.html > > I just modified the code for the mux2, simply changed any instance of > float to s32. It is not very picky about types, I have found you can > make a HAL comp to convert float to s32 as simply as this: > > pin in float in; > pin out s32 out; > function _; > ;; > FUNCTION(_) { > out = in > } > > I though there was no way it would work, but it did. I hear C is much > less picky about types than Python though. > It won't let you mix & match without some conversions though. But its less noisy about such errors, you can miss them flying by, then spend some hair trying to figure why your program apparently kills its stack & you've a really helpfull screen full of blinking, colored confetti.
My experience with C goes waaayyyy back into the 80's, and a var's type is what you declare it to be in the function in the compilers available then. Occasionally buggier than a 10 day old road kill, I even took a students half-assed attempt at re-writing its c.prep. His code I assume the prof gave him a passing grade, could still get scope confused, and could still be driven berzackers by an input file of more than 10k. It was well organized, so fixing its scope problem was easy enough, and I raised the buffer size till it could handle a 35k file on a 64k cpu, and managed to build a working version of Chuck Foresburgs rzsz with it several times. The coco people are still using it occasionally 20 some years later. The object for either rz or sz is about 34k. And I actually shrank it a bit, while nearly doubling its speed. But it could give you bit for bit, on any sized file, over a phone line worse than two tomato cans and 500 miles of dacron string. Phone lines have come a long way in the last 25 years. But if a packets checksum was bad, it just kept hammering on it till it was good before it ever asked for the next packet. But my C knowledge was rendered largely obsolete with the new compilers that C89 and the red book by K&R made possible. > *seen on a t-shirt at Walmart: "I'll go to work when my coffee does." > :) > > > I'll have to remember that one! I have another I found at kmart in Iron Mountain MI, up in youper country, the usual grey work T, says in faded stencil: Don't rush me, I get paid by the hour. Despite me being well salaried at the time, it followed me back to the motel. :) I also was up there in the dead of winter once, with 6 feet of fried down to 3 feet of crusted snow you still couldn't walk on safely on everything, and found a down filled jacket at kmart I still use 10+ years later, a $25 bill at the register. Down in this neck of the woods and today I would have to order it from L. L. Bean or similar for about $150. Sometimes it pays to be a tourist. :) Cheers, Gene Heskett -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) Genes Web page <http://geneslinuxbox.net:6309/gene> ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users