/[smarc]/smarc/src/spasm/main.c
ViewVC logotype

Diff of /smarc/src/spasm/main.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by batonik, Thu Dec 19 20:45:37 2002 UTC revision 1.2 by batonik, Sat Dec 28 21:29:26 2002 UTC
# Line 5  Line 5 
5  #include <stdio.h>  #include <stdio.h>
6  #include <getopt.h>  #include <getopt.h>
7  #include <string.h>  #include <string.h>
8    #include <sys/types.h>
9    #include <unistd.h>
10    
11    #include "main.h"
12  #include "stale.h"  #include "stale.h"
13  #include "funkcje.h"  #include "funkcje.h"
14    
# Line 17  int            numerInstrukcji = 0; Line 20  int            numerInstrukcji = 0;
20  int             daneOffset = 0;  int             daneOffset = 0;
21  char *          buforZnakowy = NULL;  char *          buforZnakowy = NULL;
22  int             wystapilBlad = 0;  int             wystapilBlad = 0;
23    int             aktualnaSekcja = 0;
24    int             wyrownanieAdresow = 0;
25    int             zapiszASCIIZ = 0;
26    
27    FILE            *plikWynikowyDanych = NULL;
28    
29    // *******
30    
31    int             bezOstrzezen = 0;
32    
33    // ========================================================================
34    
35  void yyerror (char *s)  void yyerror (char *s)
36  {  {
# Line 24  void yyerror (char *s) Line 38  void yyerror (char *s)
38          wystapilBlad = 1;          wystapilBlad = 1;
39  }  }
40    
41    void yywarn (char *s)
42    {
43            if (!bezOstrzezen)
44                    fprintf(stderr, "*** OSTRZEŻENIE *** linia %d: %s\n", numerLinii, s);
45    }
46    
47    // ------------------------------------------
48    
49  int main (int argc, char **argv)  int main (int argc, char **argv)
50  {  {
51          yydebug = 1;          int     opcja;
52            char    *nazwaPlikuDanych;
53    
54            while ((opcja = getopt(argc,argv,"hvo:qz")) != -1)
55                    switch (opcja)
56                    {
57                            case 'v':
58                                            yydebug = 1;
59                                            break;
60                            case 'q':
61                                            bezOstrzezen = 1;
62                                            break;
63                            //zapisywanie ASCIIZ
64                            case 'z':
65                                            zapiszASCIIZ = 1;
66                                            break;
67                            case '?':
68                            case 'h':
69                                            printf(SPASM_POMOC);
70                                            exit(1);
71                    }
72    
73    //      yydebug = 1;
74          freopen("test.asm", "r", stdin);          freopen("test.asm", "r", stdin);
75    
76          yyparse();          Dopisz (&buforZnakowy, "");     //sama alokacja :)
77            sprintf(buforZnakowy, SPASM_DANE_PREFIX"%d", getpid());
78            nazwaPlikuDanych = strdup(buforZnakowy);
79    
80            if ((plikWynikowyDanych = fopen(nazwaPlikuDanych, "w")))
81            {
82                    yyparse();
83                    fclose(plikWynikowyDanych);
84            }
85            else
86                    fprintf(stderr, "Błąd otwarcia pliku wynikowego!\n");
87    
88            printf("plik z danymi: `%s'\n", nazwaPlikuDanych);
89            printf("daneOffset = %d\n", daneOffset);
90    
91            if (!yydebug)
92                    unlink (nazwaPlikuDanych);
93          return(0);          return(0);
 }  
94    }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26