Code Monkey home page Code Monkey logo

dspacceleratorsupport's People

Contributors

j-c-w avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

jordiae

dspacceleratorsupport's Issues

Cast string constants to char* in function generation

Cast string constants to char* in function generation

In file included from /home/jordiae/PycharmProjects/psyciogen/tmp/570615bf6e9341628f3f7004c490f404.cpp:2:
/home/jordiae/PycharmProjects/psyciogen/tmp/9ca8380e6acf46328cef6da94a3ab52f.c: In function ‘char* g(char*)’:
/home/jordiae/PycharmProjects/psyciogen/tmp/9ca8380e6acf46328cef6da94a3ab52f.c:6:25: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
    6 |  char * temp_variable = "amkitiscxursnpaabwwjayhoiezlcsfnywoblgrvcpsscwnfxsso";
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Issue with nested structs

IOspec:

{
    "livein": [
        "a"
    ],
    "liveout": [
        "a"
    ],
    "returnvarname": [
        "returnv"
    ],
    "execcmd": "",
    "funname": "func",
    "funargs": [
        "a"
    ],
    "typemap": {
        "a": "pointer(struct Organisation)",
        "returnv": "struct Employee"
    },
    "required_includes": [
        "/home/jordiae/PycharmProjects/psyciogen/tmp/5ab956491a624cdaa11e92fd0a5e5bb7.c"
    ],
    "classmap": {
        "struct Employee": {
            "type": "struct",
            "symbols": [
                "employee_id",
                "name",
                "salary"
            ],
            "typemap": {
                "employee_id": "int32",
                "name": "string",
                "salary": "int32"
            }
        },
        "struct Organisation": {
            "type": "struct",
            "symbols": [
                "organisation_name",
                "org_number",
                "emp"
            ],
            "typemap": {
                "organisation_name": "string",
                "org_number": "string",
                "emp": "struct Employee"
            }
        }
    },
    "range": {},
}

Code:

Include:

struct Employee { int employee_id; char name[20]; int salary;}; struct Organisation { char organisation_name[20]; char org_number[20]; struct Employee emp;};"

func:

struct Employee func(struct Organisation* a) {return a -> emp;}

Error:

/home/jordiae/PycharmProjects/psyciogen/tmp/d85cfdc2133541f7b3333a3652ff9861.c:42:32: error: ‘emp’ was not declared in this scope; did you mean ‘exp’?
   42 | output_temp_3["employee_id"] = emp.employee_id;
      |                                ^~~
      |                                exp
/home/jordiae/PycharmProjects/psyciogen/tmp/d85cfdc2133541f7b3333a3652ff9861.c: In function ‘int main(int, char**)’:
/home/jordiae/PycharmProjects/psyciogen/tmp/d85cfdc2133541f7b3333a3652ff9861.c:71:59: error: invalid conversion from ‘char*’ to ‘char’ [-fpermissive]
   71 | struct Employee a_pointeremp = { a_pointerempemployee_id, a_pointerempname, a_pointerempsalary};
      |                                                           ^~~~~~~~~~~~~~~~
      |                                                           |
      |                                                           char*
/home/jordiae/PycharmProjects/psyciogen/tmp/d85cfdc2133541f7b3333a3652ff9861.c:71:77: warning: narrowing conversion of ‘a_pointerempsalary’ from ‘int’ to ‘char’ [-Wnarrowing]
   71 | struct Employee a_pointeremp = { a_pointerempemployee_id, a_pointerempname, a_pointerempsalary};
      |                                                                             ^~~~~~~~~~~~~~~~~~
/home/jordiae/PycharmProjects/psyciogen/tmp/d85cfdc2133541f7b3333a3652ff9861.c:72:35: error: invalid conversion from ‘char*’ to ‘char’ [-fpermissive]
   72 | struct Organisation a_pointer = { a_pointerorganisation_name, a_pointerorg_number, a_pointeremp};
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                   |
      |                                   char*
/home/jordiae/PycharmProjects/psyciogen/tmp/d85cfdc2133541f7b3333a3652ff9861.c:72:63: error: invalid conversion from ‘char*’ to ‘char’ [-fpermissive]
   72 | struct Organisation a_pointer = { a_pointerorganisation_name, a_pointerorg_number, a_pointeremp};
      |                                                               ^~~~~~~~~~~~~~~~~~~
      |                                                               |
      |                                                               char*
/home/jordiae/PycharmProjects/psyciogen/tmp/d85cfdc2133541f7b3333a3652ff9861.c:72:84: error: cannot convert ‘Employee’ to ‘char’ in initialization
   72 | struct Organisation a_pointer = { a_pointerorganisation_name, a_pointerorg_number, a_pointeremp};
      |                                                                                    ^~~~~~~~~~~~
      |                                                                                    |
      |                                                                                    Employee

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.