Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Fun Project

JohnNichols
Valued Contributor III
2,105 Views

I am doing a fairly heavy bit of Fortran coding for COVID Analysis - but during this I stumbled across a program called Intercal -- it is a rather useless bit of code, and I very rarely program in Cor C++. 

So excuse the questions, but if I am running VS 2019 Preview and Intel C++ is installed how do I know the Intel Compiler and not the VS C++ compiler is being used.  

 

//* $A.c -- generated C-code file for INTERCAL program $A.i */

/* This code is explicitly *not* GPLed.  Use, abuse, and redistribute freely */

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#include <fiddle.h>
#include <abcess.h>
#include <lose.h>

int lineno;

static int abstained[$B]$C;
$D
$E

int main(int argc, char* argv[])
{
    int skipto = 0;

    parseargs(argc, argv);

    /* set seed for random error generation */
#ifdef USG
    srand48(time((long*)0) + getpid());
#else
    srand(time((long*)0));
#endif /* UNIX */

    /* set up stash storage */
    stashinit();

    $F
        /* degenerated code */
        $G
        lose(E633, $J, (char*)0);

    $H
        return 0;
}

/* Generated code for $A.i ends here */
0 Kudos
24 Replies
JohnNichols
Valued Contributor III
1,850 Views

Also I have never seen $D type symbols, is this something in C I have just never seen before. 

The last C++ program I wrote was a driver several years ago -- this is just to give me some relief from the COVID stuff which can get quite difficult with all the deaths. 

0 Kudos
RahulV_intel
Moderator
1,833 Views

Hi John,

 

Firstly, please make sure that Intel C++ Compiler is integrated with VS-2019. Follow these steps to create a sample project that uses Intel C++ compiler:

 

  1. To use Intel Compiler in VS, first create a sample C++ project on VS.
  2. Once you have created a sample project, click on "Project" on the top menu.
  3. Then hover on Intel Compiler option from the drop-down list and click "Use Intel C++"

 

To verify the same, on the output window at the bottom, select "Compiler use" from the "Select output from" drop-down list. You should see something like:

 

 

 

Project: "cpp_intel"

Platform "x64" has been updated to use the Intel C++ compiler successfully.

Platform "Win32" has been updated to use the Intel C++ compiler successfully.

 

 

 

The alphabets in your program starting with "$" looks like runtime argument variables. 

 

Attaching screenshots for reference.

 

Regards,

Rahul

0 Kudos
JohnNichols
Valued Contributor III
1,823 Views

Thank you -- 

In trying to make a 1994 C program work it is easier to rewrite it as Fortran or C#. 

Whoever designed C needs to be keel hauled on an old clipper at once pace per second.  

JMN

0 Kudos
JohnNichols
Valued Contributor III
1,820 Views

it is just a simple variant on a LISP program -- lol -- this is trivial 

 

node *cons(int type, node *car, node *cdr)
{
    node *np = newnode();

    np->opcode = type;
    np->lval = car;
    np->rval = cdr;

    return(np);
}
0 Kudos
RahulV_intel
Moderator
1,792 Views

Hi @JohnNichols ,

 

Could you confirm if you are able to build/run programs on VS-19 using Intel compilers?

 

If there's no issue, could you also let me know if I can close this thread from my end?

 

Thanks,

Rahul

 

0 Kudos
JohnNichols
Valued Contributor III
1,785 Views

When I run the standard hello world program - compile it - line 63 utility -  type name not allowed

code is #pragma warning(push)

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,772 Views

>>type name not allowed code is #pragma warning(push)

Does the code define a macro named "push"?

Jim Dempsey

0 Kudos
RahulV_intel
Moderator
1,775 Views

Hi,


Could you share your complete source code if possible?


Thanks,

Rahul


0 Kudos
Viet_H_Intel
Moderator
1,767 Views

 #pragma warning(push) should be supported by the compiler. Not sure why you get a warning/error.


0 Kudos
jimdempseyatthecove
Honored Contributor III
1,764 Views

#define push NowSomethingOtherThan_push

#pragma warning(push) expands to #pragma warning(NowSomethingOtherThan_push)

IOW verify "push" is not a defined macro.

Jim Dempsey

0 Kudos
JohnNichols
Valued Contributor III
1,745 Views

I updated the VS 2019 Preview to Microsoft Visual Studio Community 2019 Preview
Version 16.7.0 Preview 5.0 and installed the new update on Intel Compilers. 

The standard hello world program now runs as an Intel C++ program, but the start of the Intercal program has a few interesting errors.  

The program is completely useless, the only joy is learning a small amount of C++, sorry did I say joy, anyone who enjoys this needs medication.  

But is something --- 

The best way is to start with the hello world program and build one line at a time.  

 

0 Kudos
RahulV_intel
Moderator
1,730 Views

Hi,


Looks like your application is unix based. It uses unix compatible headers like unistd.h. This header file has references to /sys directory which is generally present in unix based OS. This is the reason you see errors when compiling on VS-19.


For bool data type compilation error in C:

You may need to additionally include the header <stdbool.h>


--Rahul


0 Kudos
JohnNichols
Valued Contributor III
1,723 Views

I will leave it alone, thank you. 

0 Kudos
JohnNichols
Valued Contributor III
1,711 Views

I found a MSDOS version of Intercal complied on Microsoft V 6

/* we (usually, but not always) want int to be long not short - 19960621 WWP */

#ifndef DOS32BIT
#define DOS32BIT
#define IDENTIFICATION "C-INTERCAL 0.15 DOS REVISION 12"
typedef long INT32;
typedef unsigned long UINT32;
#endif

---------------------------------------------------------------------------------------------------

this is in a .h file 

-------------------------------------------------------------------------------------------------

typedef struct
{
char *name;
long value;
}

in the numerals.c file it is originally int32 value; but that throws an error -- change to long and it is ok. 

dos32bit is not defined that I can find 

Do I have to define it -- 

 

 

#
# Makefile for the INTERCAL compiler
#
#  *** BE SURE YOU'VE SPECIFIED THE CORRECT IDENTIFICATION IN DOS32BIT.H! ***
#
# Modified for DOS by: William W. Patterson <ailanto@aol.com>
# Uses Microsoft C V6.00 and nmake
# See ..\README.DOS for further details
#
#  nmake /i       to build
#  nmake install  to move the files into the appropriate directories
#  nmake clean    to remove all the unneeded stuff that a build leaves behind
#

#
# Set BINDIR, INCDIR, LIBDIR to the locations where you want "make install"
# to install the executable, include files, and library for the compiler.
# The compiler will look there for the stuff it needs when you compile
# INTERCAL programs.  INCDIR and LIBDIR can be this directory if you don't
# want to "make install", e.g., if you don't trust makefiles moving stuff
# all over creation behind your back.
# (/dev/null may be another good choice :-))
#

BINDIR = c:\toolboxx
INCDIR = c:\c600\include
LIBDIR = c:\c600\lib

CC = cl -AL

LINK = link

YDEBUG = -vlt
# DEBUG	= -g -DDEBUG
CFLAGS = -DFLEX_SCANNER -I. -Ic:\toolboxx -DICKINCLUDEDIR=\"$(INCDIR:\=^\^\)\" \
	-DICKLIBDIR=\"$(LIBDIR:\=^\^\)\" 
#	-DICKLIBDIR=\"$(LIBDIR:\=^\^\)\" -DDEBUG -DYYDEBUG
LDFLAGS =

LEX = flex -Sc:\toolboxx\skeleton.c

YACC = bison

CSOURCES = ick.y lexer.l feh.c lose.c fiddle.c perpetra.c
ISOURCES = cesspool.c arrgghh.c ick-wrap.c
HEADERS = ick.h lose.h sizes.h abcess.h fiddle.h feh.h
SOURCES = $(CSOURCES) $(ISOURCES) $(HEADERS)

all: ick.exe libick.lib

ick.exe: getopt.obj ick.obj lexer.obj feh.obj lose.obj fiddle.obj perpetra.obj dos32bit.h
	$(LINK) /NOE /STACK:8192 getopt.obj perpetra.obj ick.obj lexer.obj feh.obj lose.obj fiddle.obj, ick.exe;

ytab.h ick.c: ick.y ick.h sizes.h feh.h lose.h
	$(YACC) -d $(YDEBUG) ick.y
	move /y ick_tab.c ick.c
   move /y ick_tab.h ytab.h

lexer.c: lexer.l ick.h lose.h dos32bit.h
	$(LEX) $(LFLAGS) lexer.l
	move /y lexyy.c lexer.c 

# lextest: ytab.h lexer.c ick.h lose.obj
#	$(CC) -DMAIN lexer.c lose.obj $(LEXLIBS) -o lextest

arrgghh.obj: arrgghh.c abcess.h lose.h dos32bit.h
ick.obj: ick.c ick.h feh.h lose.h sizes.h getopt.h dos32bit.h
lexer.obj: lexer.c ytab.h ick.h lose.h dos32bit.h
feh.obj: feh.c feh.h ytab.h ick.h fiddle.h lose.h sizes.h dos32bit.h
perpetra.obj: getopt.h perpetra.c ytab.h ick.h lose.h sizes.h dos32bit.h
cesspool.obj: cesspool.c numerals.c abcess.h lose.h sizes.h dos32bit.h
lose.obj: lose.h dos32bit.h
fiddle.obj: fiddle.h sizes.h dos32bit.h
getopt.obj: getopt.c getopt.h dos32bit.h
sleep.obj: sleep.c dos32bit.h

libick.lib: sleep.obj cesspool.obj lose.obj fiddle.obj arrgghh.obj
	lib libick -+sleep.obj -+cesspool.obj -+lose.obj -+fiddle.obj -+arrgghh.obj;

install: all
	copy /y ick.exe $(BINDIR)
	copy /y dos32bit.h $(INCDIR)
	copy /y lose.h $(INCDIR)
	copy /y abcess.h $(INCDIR)
	copy /y fiddle.h $(INCDIR)
	copy /y ick-wrap.c $(INCDIR)
	copy /y libick.lib $(LIBDIR)
	copy /y ..\pit\lib\syslib.i $(LIBDIR)
	-ick -h

clean:
	del *.obj
	del *.bak
	del lexer.c
	del ick.c
	del ick.out
	del ytab.h

 

 

 

0 Kudos
JohnNichols
Valued Contributor III
1,700 Views

1. The insert a picture does not work. 

2. I get two errors and I do not know enough about char cons pointers to fix the difference between the two files

3. There is also a problem with a long and int32 - combination -  I am not sure which is the best way to correct problem

4. I stole a UINST.h from the web, and if I remove header.h I get a lot of errors even though it only has one line. 

I realize this is of limited historical interest - then again so is Hamlet. 

0 Kudos
JohnNichols
Valued Contributor III
1,698 Views

Files and solution

0 Kudos
JohnNichols
Valued Contributor III
1,691 Views

JohnNichols_0-1595546866680.png

I stripped out the problem code and can now start the parser, this is my first error 

Ok so this is a long slow process

NO idea what a grok is -- is that error code or name 

0 Kudos
JohnNichols
Valued Contributor III
1,685 Views
0 Kudos
JohnNichols
Valued Contributor III
1,660 Views
0 Kudos
RahulV_intel
Moderator
1,426 Views

Hi,

 

I've included #include <stdbool.h> header to correct the bool error(ABCESS.H file).

It lead to a new error that says "cannot open source file "ytab.h" in FEH.C.

I couldn't find ytab.h header file in the application directory that you have attached.

 

Could you share the missing header file ytab.h?

 

Thanks,

Rahul

 

0 Kudos
Reply