00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef CUTEXT_LSOURCE_H
00019 #define CUTEXT_LSOURCE_H
00020
00021 #include <cutext/bufsource.h>
00022 #include <cu/location.h>
00023 #include <cu/wchar.h>
00024
00025 CU_BEGIN_DECLARATIONS
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 struct cutext_lsource
00037 {
00038 struct cutext_bufsource bsrc;
00039 int indentation;
00040 struct cu_locbound locb;
00041 };
00042
00043 void cutext_lsource_init(cutext_lsource_t lsrc, cutext_source_t src,
00044 cu_locbound_t locb_start);
00045
00046 cu_bool_t cutext_lsource_init_fopen(cutext_lsource_t lsrc,
00047 char const *enc, cu_str_t path);
00048
00049 cutext_lsource_t cutext_lsource_new(cutext_source_t subsrc,
00050 cu_locbound_t locb_start);
00051
00052 cutext_lsource_t cutext_lsource_new_fopen(char const *enc, cu_str_t path);
00053
00054 CU_SINLINE cu_locbound_t
00055 cutext_lsource_locbound(cutext_lsource_t src)
00056 { return &src->locb; }
00057
00058 CU_SINLINE int
00059 cutext_lsource_indentation(cutext_lsource_t src)
00060 { return src->indentation; }
00061
00062 size_t cutext_lsource_read(cutext_lsource_t lsrc, cu_wchar_t *buf,
00063 size_t size);
00064
00065 size_t cutext_lsource_skip(cutext_lsource_t lsrc, size_t size);
00066
00067 cu_wchar_t const *cutext_lsource_look(cutext_lsource_t lsrc,
00068 size_t size, size_t *size_out);
00069
00070
00071 cu_wchar_t cutext_lsource_peek(cutext_lsource_t src);
00072
00073
00074 cu_wchar_t cutext_lsource_get(cutext_lsource_t src);
00075
00076
00077
00078 void cutext_locbound_put_wchar(cu_locbound_t locb, cu_wchar_t ch);
00079
00080
00081 CU_END_DECLARATIONS
00082
00083 #endif