File: scope.c

package info (click to toggle)
csound 1%3A6.18.1%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 63,220 kB
  • sloc: ansic: 192,643; cpp: 14,149; javascript: 9,654; objc: 9,181; python: 3,376; java: 3,337; sh: 1,840; yacc: 1,255; xml: 985; perl: 635; lisp: 411; tcl: 341; lex: 217; makefile: 128
file content (73 lines) | stat: -rw-r--r-- 2,619 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include "csoundCore.h"
#include "corfile.h"
#include "score_param.h"

extern uint8_t file_to_int(CSOUND*, const char*);
int scope(CSOUND *csound)
{
extern void print_csound_prsdata(void *);
extern int csound_prslex_init(void *);
extern void csound_prsset_extra(void *, void *);

extern int csound_prslex(CSOUND*, void*);
extern int csound_prslex_destroy(void *);
extern void csound_sco_scan_buffer (const char *, size_t, void*);
extern int csound_scoparse(SCORE_PARM *, void *, CSOUND*, ScoreTree*);
extern void csound_scolex_init(void *);
extern void csound_scoset_extra(void *, void *);
extern void csound_scoset_lineno(int, void*);
extern void csound_scolex_destroy(void *);
#if 0
    {
      PRS_PARM  qq;
      char buff[1024];
      /* Pre-process */
      memset(&qq, '\0', sizeof(PRS_PARM));
      csound_prslex_init(&qq.yyscanner);
      csound_prsset_extra(&qq, qq.yyscanner);
      //printf("depth = %d\n", qq.depth);

      csound->expanded_sco = corfile_create_w();
      printf("Input:\n%s<<<\n", corfile_body(csound->sreadStatics.str->cf));
      snprintf(buff, 1024, "#source %d\n",
               qq.lstack[0] = file_to_int(csound,
                                          csound->scorename?
                                          csound->scorename:"**unknown**"));
      corfile_puts(buff, csound->expanded_sco);
      snprintf(buff, 1024, "#line %d\n", csound->scoLineOffset);
      corfile_puts(buff, csound->expanded_sco);
      qq.line = 1;
      csound_prslex(csound, qq.yyscanner);
      csound->Message(csound, "yielding >>%s<<\n",
                       corfile_body(csound->expanded_sco));
      csound_prslex_destroy(qq.yyscanner);
      corfile_rm(&csound->scorestr);
    }
    {
      ScoreTree* scoTree = (ScoreTree *)csound->Calloc(csound, sizeof(ScoreTree));
      SCORE_PARM  pp;
      extern int csound_scodebug;
      int err;
      /* Parse */
      memset(&pp, '\0', sizeof(SCORE_PARM));
      csound_scolex_init(&pp.yyscanner);
      csound_scoset_extra(&pp, pp.yyscanner);
      csound_sco_scan_buffer(corfile_body(csound->expanded_sco),
                             corfile_tell(csound->expanded_sco), pp.yyscanner);
      csound_scodebug = 0;
      err = csound_scoparse(&pp, pp.yyscanner, csound, scoTree);
      corfile_rm(&csound->expanded_sco);
      if (LIKELY(err == 0))
        csound->Message(csound, "Parsing successful!\n");
      {
        ScoreTree* s = scoTree;
        while (s) {
          printf("(%d,%s): opode = %c\n",
                 s->line, csound->filedir[s->locn&0xff], s->op);
          s = s->next;
        }
      }
    }
#endif
    return 0;
}