How would I convert Javascript and CSS code to C code so I can compile it into a Debian 10 App? - compilation

let t=0;function setup(){createCanvas(600,600);noStroke();r=random(255);g=random(255);b=random(255);fill(r,g,b,127)}
function draw(){background(0);for(let x=0;x<=width;x=x+r){for(let y=0;y<=height;y=y+r){const xAngle=map(mouseX,0,width,-4TAU,4PI,!0);const yAngle=map(mouseY,0,height,-4TAU,4PI,!0);const angle=xAngle*(x/width)+yAngle*(y/height);const myX=x+20cos(2PIt+angle);const myY=y+20sin(2PIt+angle);fill(r,g,b,127);fill(r,g,b,127);ellipse(myX,myY,10)}}
t=t+0.01}
I tried using a C Compiler and it kept doing it to C++ Code, not C Code.

Related

How to get gcc to compile 16-bit unicode strings

So I'm trying to compile this project : https://github.com/dmitrystu/libusb_stm32 with Segger Embedded studio which uses gcc. The process is choking on this error :
pasting formed 'u"Open source USB stack for STM32"', an invalid preprocessing token
which is caused by this line :
static const struct usb_string_descriptor manuf_desc_en = USB_STRING_DESC("Open source USB stack for STM32");
So USB_STRING_DESC is a macro :
#define USB_STRING_DESC(s) {.bLength = sizeof(CAT(u,s)),.bDescriptorType = USB_DTYPE_STRING,.wString = {CAT(u,s)}}
And CAT is a macro CAT(x,y) x##y. The intent must be to convert a string of type 8-bit char into a 16-bit Unicode type but the compiler doesn't like it. Is there some #include or compiler setting that may be missing that I have to add here? Clearly the author of this code expects it to work so there must be some fault in my setup.
Also I'm not clear on how the sizeof() operation is supposed to work here. As I understand it there is no way to get the length of a string at compile time so that operation will always return the size of a pointer.
In response to Keith's question, the gcc version is 4.2.1. Poking around the compiler settings the default option is the C99 standard, when I changed it to C11 everything compiled just fine. Thanks!

A C example about using PTRACE_GETSIGMASK and PTRACE_SETSIGMASK?

Is there a C example about using PTRACE_GETSIGMASK and PTRACE_SETSIGMASK?
I have not found any C example about using PTRACE_GETSIGMASK/PTRACE_SETSIGMASK, I wrote a simple code to test them, but it returns and EINVAL error.
I am trying to modify the trace signal mask
kernel sizeof(sigset_t)=8, userspace sizeof(sigset_t)=128. try addr=8

Debugging Alpha BASIC for OpenVMS

I am trying to take over some projects involving DEC BASIC, A.K.A. VAX BASIC, A.K.A. Alpha BASIC. I am really hoping to run into someone with experience here. I have been through the user manual for VAX/Alpha BASIC through and though but I can't figure out how to debug shareable code.
I can create, compile and link shareable code, I can debug the code that references the shareable code, but I can't debug the shareable code. Any help would be greatly appreciated.
The commands I am using to compile and link are:
$ BASIC/DEBUG/NOOPTIMIZE COMPARE_DATES_TEST.BAS,COMPARE_DATES.BAS
$ LINK/SHAREABLE/DEBUG COMPARE_DATES.OBJ,COMPARE_DATES_SUB/OPT
$ LINK/DEBUG COMPARE_DATES_TEST,COMPARE_DATES_MAIN/OPT
$ RUN COMPARE_DATES_TEST
The contents of the two option files are:
$ type COMPARE_DATES_SUB.OPT
! COMPARE_DATES_SUB.OPT
SYMBOL_VECTOR=(COMPARE_DATES=PROCEDURE)
$ type COMPARE_DATES_MAIN.OPT
! COMPARE_DATES_MAIN.OPT
COMPARE_DATES/SHAREABLE
My shareable code has a bug, but I don't know where, the debugger reports:
— SRC: module COMPARE_DATES_TEST$MAIN -scroll-source————————————————————————————
1: EXTERNAL INTEGER FUNCTION COMPARE_DATES(STRING,STRING)
2: DECLARE STRING A$, B$
3: A$ = "01-APR-18"
4: B$ = "15-MAY-2017"
5:
-> 6: PRINT COMPARE_DATES(A$, B$)
7: END
— OUT -output———————————————————————————————————————————————————————————————————
stepped to COMPARE_DATES_TEST$MAIN\COMPARE_DATES_TEST$MAIN\%LINE 3
stepped to COMPARE_DATES_TEST$MAIN\COMPARE_DATES_TEST$MAIN\%LINE 4
stepped to COMPARE_DATES_TEST$MAIN\COMPARE_DATES_TEST$MAIN\%LINE 6
%BAS-F-SUBOUTRAN, Subscript out of range
-BAS-I-FROFUN, In external function COMPARE_DATES
-BAS-I-FROMOD, In module COMPARE_DATES_TEST
break on unhandled exception preceding 18446744071563830960
— PROMPT -error-program-prompt——————————————————————————————————————————————————
%DEBUG-I-SOURCESCOPE, source lines not available for %PC in scope number 0
Displaying source for 6\%PC
DBG>
Too long for a comment: You compiled with /NOOPTIMIZE, so I would have expected that a STEP/INTO when at line 6, PRINT COMPARE_DATES(A$, B$), would have stepped to COMPARE_DATES in your shareable image. I don't know why that's not the case, here. The debugger is right, you don't have the sources for DEC$BASRTL. Your shareable image is not installed, it is in your address space. It seems PRINT has problems with the passed argument. I would try a SET IMAGE COMPARE_DATES; SET MODULE/ALL; SET BREAK COMPARE_DATES at the initial debugger prompt. That makes all debug symbols of the shareable image known and sets a breakpoint in your function. And then a GO should get you into your function. (I noticed, that you have the same names for the function, the source module and the shareable image. This shouldn't be a problem.)

Int32 can't be converted to gcl_queue_flags

My attempt to use OpenCL with the Swift language (using xcode6 Dp4, Yosemite DP4) fails:
import Cocoa
import OpenCL
-
-
var queue: dispatch_queue_t = gcl_create_dispatch_queue(CL_DEVICE_TYPE_GPU, nil)
-
-
An error message comes up at "var queue ..."-line; "Int32 can't be converted to gcl_queue_flags". The line of code works perfectly when using Objective-C or C. Testing OpenCL (and GCDas well) seems not work in playground.
This is an issue with the way the CL_DEVICE_TYPE_GPU macro is imported to Swift — it's an Int32, but the function takes UInt64. So you can use cl_queue_flags(CL_DEVICE_TYPE_GPU) to convert it. You might also want to file a bug.

Is it possible to run extra lines of code during debugging

I want to execute extra lines of code during debugging in Visual Studio 2012.
Is it possible to make it.
One application would be to execute some WRITE(,) statements, or evaluate some expressions.
If you're using F77 with the Intel Compiler, have a look at the /D-lines option. You can write code like
if (x.gt.10) then
x = 0
D print *, 'x reset'
end if
It will only compile the lines with D in column 1 if the /D-lines option is present, otherwise it is treated as a comment. I've only ever used this on F77. I don't know if it works on F90 etc.
Reference http://software.intel.com/sites/products/documentation/doclib/stdxe/2013/composerxe/compiler/fortran-lin/GUID-E356B0E3-F847-40A9-A932-77B4D8EEF53B.htm
The Intel compiler also supports preprocessing. You could use either
the C type macros with #if etc http://software.intel.com/sites/products/documentation/doclib/stdxe/2013/composerxe/compiler/fortran-mac/GUID-4A598AC5-1C5F-48F2-BA42-DA8F38D46CB3.htm
the original Microsoft/DEC macros with !DEC$ http://software.intel.com/sites/products/documentation/doclib/stdxe/2013/composerxe/compiler/fortran-mac/GUID-0E1D6C34-2565-4331-864F-5970EF452E27.htm
If you're using Silverfrost, have a look at the CIF-CELSE-CENDIF /VPARAM /SPARAM options.
You can use the #if to do this within Visual Studio.
#if DEBUG
Console.WriteLine("Debug version");
#endif
http://msdn.microsoft.com/en-us/library/4y6tbswk(v=vs.110).aspx

Resources