How to use yarpgen random C program generator? - c

I am new here.
Could anyone help me, on how to use yarpgen to generate a random c program.
I tried running the run_gen.py script that I saw in the yarpgen readme.
But, I got a warning and an error like this:
Warning: please set YARPGEN_HOME envirnoment variable to point to test generator path, using C:\Users\..\Python\Python36-32\yarpgen-master for now
and
File C:\Users\..\Python\Python36-32\yarpgen-master\yarpgen wasn't found
Any help would be much appreciated.
Thanks in advance !

The warning very likely points to the source of the problem, run_gen does not know where the other parts of yarpgen are installed.
First, note down the directory you installed/copied yarpgen to.
Then open a command shell. Type this:
cd <where run_gen.py is>
set YARPGEN_HOME=<the path you just noted down>
run_gen.py
If this works, you can write a batch script, that contains the set YARPGEN_HOME=... line and then calls run_gen.py. If the directory where run_gen.py is located is not on your PATH environment variable, call run_gen.py with the full absolute path in the batch script:
set YARPGEN_HOME=<the path to yarpgen>
python3 <absolute_path_to>\run_gen.py
Then you can call your batch script.
You may have to adjust the python3 command depending on the executable Python 3 installed on your machine (it may be just python on Windows).
When I tried this after building with cygwin, I noticed that I had to rename yarpgen.exe to yarpgen to make it work.

Related

Windows BAT script for cp alias produces error

I wrote a file called cp.bat and the content of this file is: DOSKEY cp=COPY $* copy. I saved this file in c:\users\myname\aliases. I also added this path to my environment so cmd can execute it.
When I now type cp in my cmd the output is a strange character for the c in cp.
I need this script to work because I want to install chicken scheme eggs on my machine, but the chicken-install command executes multiple cp commands and those are not recognized in the cmd.
I also tried to alter the build script of the eggs, but it gets newly generated everytime I call the chicken-install command.
It would also help if someone could explain me how to install chicken eggs on a windows machine correctly. I feel this workaround shouldn't be necessary. Thanks in advance.
Like Magoo mentioned:
In all probability, your editor is the root of your problem. Batch files should be created in strict ANSI format using a text-editor, not a word-processor. Notepad is barely adequate; Notepad++ is far better - I use Editplus
The encoding was messed up and it was set to UTF-8-BOM, so I changed it to ANSI and it worked flawlessly.
If you're using CHICKEN 5, it should not be emitting cp commands; it should emit batch files which use the builtin Windows commands only if you're using the mingw platform target. Have you used the PLATFORM=mingw option with every make invocation?
If you're using the mingw-msys (or cygwin) platform, then it will be emitting UNIX style commands.

Cygwin bash.exe cannot run make, works in cmd.exe

I am having issues running any make command in a Cygwin bash terminal. The following is the error that is returned.
"'ygdrive' is not reconized as an internal or external command, operable program or batch file"
However I am able to properly run the make file using cmd.exe, any help would be appreciated.
Thanks Eric E
Looks like you are referencing a path in some recipe with \cygdrive\<letter>\.... bash interprets a single backslash as an escape character and therefore ignores the c directly following it.
Solutions:
If you want the Makefile to be portable to Unix systems, just write forward slashes in paths like this /cygdrive/<letter>/....
If you instead want the Makefile to be compatible with cmd, too, use double backslashes like \\cygdrive\\<letter\\... -- both bash and cmd will understand this.
In any case, such a path should be in a make variable because it is probably completely different on another machine.
The above solution by Felix might be the answer for others, however the solution for my problem was removing "SHELL=C:/Windows/System32/cmd.exe" from the top of my Makefile..

Run C executable from Matlab

I try to run a C implementation of Sift feature descriptor executable from matlab at linux. The script I run and the executable at the some folder and executable is run by the following
./sift <tmp.pgm >tmp.key
and I trued to run it on Matlab with followings but none of them worked
eval('!./sift <tmp.pgm >tmp.key');
system('./sift <tmp.pgm >tmp.key');
unix('./sift <tmp.pgm >tmp.key');
I also check the executable from terminal and it works without any flaw. Is there any other way to do that or Do i have any slight mistake?
Your syntax looks right.
The -1 status means it's probably failing to find or launch sift at all. I know this is basic (and I think someone else mentioned it), but is your Matlab program running from the same directory that sift is in when it calls it? The system() function evaluates paths with respect to the Matlab session's current directory, not the location of the calling script. If your script has called cd for other reasons, that'll affect it. Check your current directory with pwd and do an ls and exist('./sift', 'file') to make sure it's there.
If this is the case, you could make it more robust by calling sift with an absolute path, maybe calculated at run time using fileparts(mfilename('fullpath')) in the script.
I figure out the problem as the path /matlab/bin/glnxa64/matlab_helper has permission problem. After I check the problem, everything started to work correctly.
I had the same problem of permission. Just adding solution for others to see as i had hard time finding the solution.
Open terminal and type
cd \path_of_your_file
sudo chmod -R 777
it will ask for your password and will permit to run the exe. Hugs..

GNU style configure batch file issues

I'm trying to create a GNU like configure script for Windows in a batch file. It seems to work ok so far except depending on the order options get ignored and in particular with the '--with-smtube' option it sometimes gets the path but again depending on the order causes it to result in:
test.cmd --enable-portable --with-smtube=C:\svn\smtube
configure: error: unrecognized option: `C:\svn\smtube'
Try `--with-smtube --help' for more information
(supposed to also say Try `test.cmd --help)
I copied the structure from another script I found but not having success. The order of arguments shouldn't matter and arguments can be omitted (all or some). Can someone steer me in the right direction?
The script is for a Qt program, it uses command prompt as the shell and not msys or cygwin or anything like that.
This is what I have so far: http://redxii.users.sourceforge.net/test.cmd

.bat to .sh converting for SQL*Loader Start on UNIX PC

I have a simple .bat file
#echo; set nls_lang=russian_cis.ru8pc866
#echo off
SET NLS_NUMERIC_CHARACTERS=. '
sqlldr.exe userid=PRB/0611#TSESTDB control=control_file.ctl LOG=fdb_log.log errors=100
cmd
and i need to convert to .sh file for running on the UNIX based pc.
I began to read "BASH Programming - Introduction HOW-TO" (is it suitable for beginners?), but it is a episodical task and dead line comes.
Could anybody help me to convert file? Thanks a lot!!!
rewriting your script.
#!/bin/bash
# #echo;
# set nls_lang=russian_cis.ru8pc866
export NLS_LANG=russian_cis.ru8pc866
# not needed #echo off
# SET NLS_NUMERIC_CHARACTERS=. '
export NLS_NUMERIC_CHARACTERS='.'
PATH="/path/to/sqlDir/install:${PATH}"
# sqlldr.exe userid=PRB/0611#TSESTDB control=control_file.ctl LOG=fdb_log.log errors=100
sqlldr userid=PRB/0611#TSESTDB control=control_file.ctl LOG=fdb_log.log errors=100
# ? cmd
I've left your code in, but commented out (using the shell comment char '#'). The uncommented lines are the 'translation' of .bat syntax into Linux/Unix bash/shell syntax.
There some things above that you may need to fix:
You'll have to include the correct value in the resetting of PATH,
note that the value there is strictly to illustrate the issue.
export is used so that variables set in the current shell (the
shell script) are visible to child processes that run from the shell
script, in this case the important one being sqlldr
I'm not sure what values you really need assigned to
NLS_NUMERIC_CHARACTERS. Note that by quoting with the single-quote
char ' available to the shell, you should get exactly the value
used that you intended. If '*' or other reg-exp chars are used, this
may cause problems.
You may find that sqlldr.exe has a different name altogether. The
linux/unix convention for executable commands does not require the
.exe extension, so I have used sqlldr. Just use the full name of
the program you find in the installed directory.
The line with #!/bin/bash needs to be the first line in the file, with no leading spaces.
You'll also need to inform your OS that the script is intended to be executable. From a bash cmd line, IN the directory that contains this script, do
chmod 755 mySQLLDR_runningScript
Finally, not sure why you have cmd at the end of your .bat file, to open a new window? You'll need to experiment on your system to find the correct cmd to do that. Maybe xterm.
I hope this helps.

Resources