📄 fs.lst
字号:
C51 COMPILER V7.08 FS 12/26/2003 07:27:15 PAGE 1
C51 COMPILER V7.08, COMPILATION OF MODULE FS
OBJECT MODULE PLACED IN fs.OBJ
COMPILER INVOKED BY: C:\Keil708\C51\BIN\C51.EXE fs.c LARGE BROWSE DEBUG OBJECTEXTEND
line level source
1 /*
2 * Copyright (c) 2001, Swedish Institute of Computer Science.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the Swedish Institute
16 * of Computer Science and its contributors.
17 * 4. Neither the name of the Institute nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * This file is part of the lwIP TCP/IP stack.
34 *
35 * Author: Adam Dunkels <adam@sics.se>
36 *
37 * $Id: fs.c,v 1.6 2001/11/25 18:47:36 adam Exp $
38 */
39
40 #include "uip.h"
41 #include "fs.h"
42 #include "fsdata.h"
43
44 #define NULL (void *)0
45 #include "fsdata.c"
46
47 #ifdef FS_STATISTICS
48 #if FS_STATISTICS == 1
49 static u16_t count[FS_NUMFILES];
50 #endif /* FS_STATISTICS */
51 #endif /* FS_STATISTICS */
52
53 /*-----------------------------------------------------------------------------------*/
54 static u8_t
55 fs_strcmp(char *str1, char *str2)
C51 COMPILER V7.08 FS 12/26/2003 07:27:15 PAGE 2
56 {
57 1 u8_t i;
58 1 i = 0;
59 1 loop:
60 1
61 1 if(str2[i] == 0 ||
62 1 str1[i] == '\r' ||
63 1 str1[i] == '\n') {
64 2 return 0;
65 2 }
66 1
67 1 if(str1[i] != str2[i]) {
68 2 return 1;
69 2 }
70 1
71 1
72 1 ++i;
73 1 goto loop;
74 1 }
75 /*-----------------------------------------------------------------------------------*/
76 int
77 fs_open(char * name, struct fs_file *file)
78 {
79 1
80 1 #ifdef FS_STATISTICS
81 1 #if FS_STATISTICS == 1
82 1 u16_t i = 0;
83 1 #endif /* FS_STATISTICS */
84 1 #endif /* FS_STATISTICS */
85 1 struct fsdata_file_noconst *f;
86 1
87 1 for(f = (struct fsdata_file_noconst *)FS_ROOT;
88 1 f != NULL;
89 1 f = (struct fsdata_file_noconst *)f->next) {
90 2
91 2 if(fs_strcmp(name, f->name) == 0) {
92 3 file->databuffer = f->databuffer;
93 3 file->len = f->len;
94 3 #ifdef FS_STATISTICS
95 3 #if FS_STATISTICS == 1
96 3 ++count[i];
97 3 #endif /* FS_STATISTICS */
98 3 #endif /* FS_STATISTICS */
99 3 return 1;
100 3 }
101 2 #ifdef FS_STATISTICS
102 2 #if FS_STATISTICS == 1
103 2 ++i;
104 2 #endif /* FS_STATISTICS */
105 2 #endif /* FS_STATISTICS */
106 2
107 2 }
108 1 return 0;
109 1 }
110 /*-----------------------------------------------------------------------------------*/
111 void
112 fs_init(void)
113 {
114 1 #ifdef FS_STATISTICS
115 1 #if FS_STATISTICS == 1
116 1 u16_t i;
117 1 for(i = 0; i < FS_NUMFILES; i++) {
C51 COMPILER V7.08 FS 12/26/2003 07:27:15 PAGE 3
118 2 count[i] = 0;
119 2 }
120 1 #endif /* FS_STATISTICS */
121 1 #endif /* FS_STATISTICS */
122 1 }
123 /*-----------------------------------------------------------------------------------*/
124 #ifdef FS_STATISTICS
125 #if FS_STATISTICS == 1
126 u16_t fs_count
127 (char *name)
128 {
129 1 struct fsdata_file_noconst code *f;
130 1 u16_t i;
131 1
132 1 i = 0;
133 1 for(f = (struct fsdata_file_noconst code *)FS_ROOT;
134 1 f != NULL;
135 1 f = (struct fsdata_file_noconst code *)f->next) {
136 2
137 2 if(fs_strcmp(name, f->name) == 0) {
138 3 return count[i];
139 3 }
140 2 ++i;
141 2 }
142 1 return 0;
143 1 }
144 #endif /* FS_STATISTICS */
145 #endif /* FS_STATISTICS */
146 /*-----------------------------------------------------------------------------------*/
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 527 ----
CONSTANT SIZE = 11261 ----
XDATA SIZE = 22 24
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -