foralex / picoc

Automatically exported from code.google.com/p/picoc
0 stars 0 forks source link

Could someone add #! for comment? #158

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I know, #! is not standard syntax in c standard.
But there is it, we can put

#!/usr/bin/pococ

in a script for shell script using

thanks

Original issue reported on code.google.com by xsof...@gmail.com on 31 May 2012 at 3:54

GoogleCodeExporter commented 8 years ago
or when pococ read a file, if first line begins with #! then simply skip this 
line.

so we can use  #!/usr/bin/pococ

Original comment by xsof...@gmail.com on 31 May 2012 at 3:55

GoogleCodeExporter commented 8 years ago
patch platform/platform_unix.c, in function PlatformReadFile

insert codes below
// code begin

    if ((ReadText[0] == '#') && (ReadText[1] == '!'))
    {
        for (char *p = ReadText; (*p != '\r') && (*p != '\n'); ++p)
        {
            *p = ' ';
        }
    }
// code end

before function return,
so we can put
#!/usr/bin/pico
into first line of a source code and chmod 755 then execute it

Original comment by xsof...@gmail.com on 31 May 2012 at 4:25

GoogleCodeExporter commented 8 years ago
Thanks, I've added that in r573

Original comment by zik.sale...@gmail.com on 31 May 2012 at 6:00