Annotation of researchv10dc/cmd/oworm/oscsi/gram.y, revision 1.1

1.1     ! root        1: %start         input
        !             2: 
        !             3: %{
        !             4: 
        !             5: #include       "scsi.h"
        !             6: 
        !             7: %}
        !             8: 
        !             9: %token         DISK ID RELEASE HELP SET EJECT INQUIRY READ CAPACITY SENSE
        !            10: %token         NUMBER EXT SIDEA SIDEB ALL RESET SLEEP START STOP STATUS
        !            11: %token         ECHO ERROR MEDIA WORM WRITE DIAGNOSTIC STRING COPY
        !            12: 
        !            13: %type <str>    STRING
        !            14: %type <num>    NUMBER drive side shelf
        !            15: 
        !            16: %union {
        !            17:        char *str;
        !            18:        long num;
        !            19: }
        !            20: 
        !            21: %%
        !            22: 
        !            23: input  :       /* nothing */
        !            24:        |       input line error '\n'
        !            25:        |       input line '\n'
        !            26:        |       input line ';'
        !            27:        |       input line error ';'
        !            28:        ;
        !            29: 
        !            30:        /*
        !            31:                help can be done explicitly by :help info::
        !            32:        */
        !            33: line   :               /* nothing */
        !            34:        |       CAPACITY drive   { s_capacity($2, (long *)0, (long *)0); }
        !            35:        |       COPY drive NUMBER NUMBER drive NUMBER {/*:COPY sdrive sstart nblocks ddrive dstart:: */
        !            36:                        s_copy($2, $3, $4, $5, $6);
        !            37:                }
        !            38:        |       DIAGNOSTIC drive { s_drdiag($2); }
        !            39:        |       DISK EJECT drive  { s_diskeject($3); }
        !            40:        |       DISK RELEASE drive shelf side  { s_diskrelease($4, $5, $3, 1); }
        !            41:        |       DISK RELEASE drive  { s_diskrelease(-1, A, $3, 1); }
        !            42:        |       DISK SET shelf side drive  { s_diskset($3, $4, $5, 1); }
        !            43:        |       ECHO NUMBER  { print(">> %d <<\n", $2); }
        !            44:        |       HELP  { help(); }
        !            45:        |       ID drive  { scsiid($2); }
        !            46:        |       INQUIRY {
        !            47:                        int i;
        !            48:                        for(i = 0; i<8; i++)
        !            49:                                s_inquiry(scsi_id, i);
        !            50:                }
        !            51:        |       INQUIRY drive  { s_inquiry(scsi_id, $2); }
        !            52:        |       MEDIA drive NUMBER NUMBER  { s_media($2, $3, $4, 0); }
        !            53:        |       MEDIA drive NUMBER NUMBER STRING  { s_mediaf($2, $3, $4, $5); } /*:MEDIA drive start nblocks \"filename\"::*/
        !            54:        |       EXT MEDIA drive NUMBER NUMBER  { s_media($3, $4, $5, 1); }
        !            55:        |       READ drive NUMBER  {
        !            56:                        struct scsi_o output;
        !            57:                        s_read($2, $3, 1, &output);
        !            58:                        scsiodump(output.data, 1024);
        !            59:                }
        !            60:        |       READ ID drive  {
        !            61:                        struct scsi_o output;
        !            62:                        s_read($3, 1, 1, &output);
        !            63:                        print("id='%s'\n", &output.data[42]);
        !            64:                }
        !            65:        |       RESET  { s_reset(); }
        !            66:        |       SENSE drive { s_sense($2, 0); }
        !            67:        |       EXT SENSE drive { s_sense($3, 1); }
        !            68:        |       SLEEP NUMBER  { sleep($2); }
        !            69:        |       START drive { s_start($2); }
        !            70:        |       STATUS drive { s_status($2, (struct scsi_o *)0); }
        !            71:        |       STATUS { s_status(0, (struct scsi_o *)0); }
        !            72:        |       STOP drive  { s_stop($2); }
        !            73:        |       WORM drive { s_worm($2, 1); }
        !            74:        |       WORM drive NUMBER { s_worm($2, $3); } /*:WORM drive start:: */
        !            75:        |       WRITE drive NUMBER { s_write($2, $3, 1); }
        !            76:        |       WRITE drive NUMBER NUMBER { s_write($2, $3, $4); } /*:WRITE drive start n:: */
        !            77:        ;
        !            78: 
        !            79: drive  :       NUMBER
        !            80:        ;
        !            81: 
        !            82: shelf  :       NUMBER
        !            83:        ;
        !            84: 
        !            85: side   :       SIDEA  { $$ = 0; }
        !            86:        |       SIDEB   { $$ = 1; }
        !            87:        ;
        !            88: 
        !            89: %%
        !            90: 
        !            91: yywrap()
        !            92: {
        !            93:        return(1);
        !            94: }
        !            95: 
        !            96: yyerror(s1, s2)
        !            97:        char *s1, *s2;
        !            98: {
        !            99:        fprint(2, s1, s2);
        !           100:        fprint(2, "\n");
        !           101: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.