2 * Copyright (C) 2015 Thadeu Lima de Souza Cascardo <cascardo@cascardo.eti.br>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include "declaracao.h"
21 #include "contribuinte.h"
24 #define SET_INT_CONTRIBUINTE(attr) \
25 SET_INT_(attr, attr, contribuinte.attr)
27 #define SET_STRING_CONTRIBUINTE(attr) \
28 SET_STRING_(attr, attr, contribuinte.attr)
30 SET_STRING_CONTRIBUINTE(uf);
31 SET_INT_CONTRIBUINTE(cd_municipio);
32 SET_STRING_CONTRIBUINTE(municipio);
33 SET_STRING_CONTRIBUINTE(cep);
34 SET_STRING_CONTRIBUINTE(bairro);
35 SET_STRING_CONTRIBUINTE(tipo_logradouro);
36 SET_STRING_CONTRIBUINTE(logradouro);
37 SET_STRING_CONTRIBUINTE(numero);
38 SET_STRING_CONTRIBUINTE(complemento);
39 SET_STRING_CONTRIBUINTE(titulo_eleitor);
40 SET_STRING_CONTRIBUINTE(dn);
41 SET_STRING_CONTRIBUINTE(ddd);
42 SET_STRING_CONTRIBUINTE(telefone);
43 SET_INT_CONTRIBUINTE(natureza_ocupacao);
44 SET_INT_CONTRIBUINTE(ocupacao_principal);
46 void contribuinte_salva(struct declaracao *dec, FILE *f)
48 #define SALVA_STRING(attr) \
49 if (dec->contribuinte.attr) \
50 fprintf(f, #attr " \"%s\"\n", dec->contribuinte.attr);
51 #define SALVA_INT(attr) \
52 fprintf(f, #attr " %d\n", dec->contribuinte.attr);
54 SALVA_INT(cd_municipio);
55 SALVA_STRING(municipio);
58 SALVA_STRING(tipo_logradouro);
59 SALVA_STRING(logradouro);
61 SALVA_STRING(complemento);
62 SALVA_STRING(titulo_eleitor);
65 SALVA_STRING(telefone);
66 SALVA_INT(natureza_ocupacao);
67 SALVA_INT(ocupacao_principal);
70 int contribuinte_cmd_init(void)
73 cmd_add(&cmd_cd_municipio);
74 cmd_add(&cmd_municipio);
77 cmd_add(&cmd_tipo_logradouro);
78 cmd_add(&cmd_logradouro);
80 cmd_add(&cmd_complemento);
81 cmd_add(&cmd_titulo_eleitor);
84 cmd_add(&cmd_telefone);
85 cmd_add(&cmd_natureza_ocupacao);
86 cmd_add(&cmd_ocupacao_principal);