summaryrefslogtreecommitdiff
path: root/input.c (unfollow)
Commit message (Collapse)Author
2014-12-16Add missing err_cantopen.Simon Tatham
As far as I can tell from the source control history, Halibut has _never_ actually printed an error message on failure to open one of its input files! The error message has existed all along, but was never actually invoked. Ahem.
2014-12-16Fix segfault when a source file doesn't exist.Simon Tatham
There was a missing NULL check in the code that test-opens files in both binary and text mode (for font-handling purposes).
2013-03-10Add \s for 'strong' text, i.e. bold rather than italics. I've missedSimon Tatham
this a couple of times in Halibut markup recently (in particular, it's handy to have a typographical distinction between 'this term is emphasised because it's new' and 'this term is emphasised because I want you to pay attention to it'), so here's an implementation, basically parallel to \e. One slight oddity is that strong text in headings will not be distinguished in some output formats, since they already use bolded text for their headings. [originally from svn r9772]
2012-08-29Revamp of the Halibut error handling mechanism.Simon Tatham
I'm not quite sure why I ever thought it was a good idea to have a central variadic error() function taking an integer error code followed by some list of arguments that depend on that code. It now seems obvious to me that it's a much more sensible idea to have a separate function per error, so that we can check at compile time that the arguments to each error call are of the right number and type! So I've done that instead. A side effect is that the errors are no longer formatted into a fixed-size buffer before going to stderr, so I can remove all the %.200s precautions in the format strings. [originally from svn r9639]
2012-02-24Allow macro definitions to be terminated by tok_eof as well asSimon Tatham
tok_eop, to prevent Halibut tight-looping when a definition is the last thing in a file. [originally from svn r9419]
2010-02-27A user recently reported that Halibut's font-file handling doesn'tSimon Tatham
work on Windows, because input files are never opened in binary mode. Introduce a small piece of compensatory mechanism, which opens files initially in binary mode and then reopens them as text if they're determined not to match any binary file type. I hope. [originally from svn r8889]
2009-10-24Enable Halibut to read a .but file from standard input, by supplyingSimon Tatham
the special filename '-'. [originally from svn r8728]
2008-11-21Correct mishandling of paragraphs beginning with "\#{".Simon Tatham
(Embarrassingly, this was showing up in inputs/test.but itself.) [originally from svn r8312]
2007-02-03Add support for using TrueType fonts, including embedding in PostScript butBen Harris
not yet in PDF. There's a lot of cleaning up to be done, especially in the area of error, but I think it would be better committed gradually. [originally from svn r7198]
2007-01-27Add support for PFB files. This seems to have caused me to completelyBen Harris
rewrite the Type 1 font support, and I'm sure the result is more complex than it needs to be, but it seems to work correctly, so I shouldn't complain. [originally from svn r7175]
2006-12-07I've just noticed some unacceptably long lines in code paragraphs inSimon Tatham
the Halibut manual. They turn out to be \cfg directives with multiple braced sections after them. The obvious thing to do for legibility would be to wrap those sections by putting newlines between } and {, but that isn't legal in the Halibut syntax. Therefore, it is now :-) For paragraph types which don't have any body text (such as \cfg), we are now lenient about whitespace between multiple keywords. So I can fix the docs so they don't go over the limit, and be confident that the fixed version is still technically accurate. [originally from svn r6970]
2006-12-05Distingush font files from other input by magic number rather than name.Ben Harris
This prevents one having Halibut files that begin "StartFontMetrics", "%!FontType1-", or "%!PS-AdobeFont-", but I doubt that will be a great hardship. [originally from svn r6960]
2006-05-14Fairly ropey font-embedding support. In particular, the PDF output isBen Harris
technically incorrect, though it works perfectly well with xpdf. To do it properly requires actually parsing the unencrypted part of a Type 1 font, which will be a bit tedious in C. [originally from svn r6685]
2006-05-13Initial support for adding fonts at run-time. Currently we only supportBen Harris
loading AFM files, we recognise them by name, and we can't embed fonts in the output (which is also invalid, though accepted by xpdf, in the PDF case). Oh, and there's no documentation. Still, it's a start. [originally from svn r6681]
2005-11-13Just to be on the safe side about avoiding other portability hazardsSimon Tatham
in future, add `-ansi -pedantic' to the Halibut default compile options and fix the few resulting warnings (mostly signed/unsigned char mismatches and commas at the ends of enums). The one remaining warning I'm still seeing is `missing initializer' for the big table in charset/iso2022.c, but I think the code genuinely is more readable this way, and I haven't found a gcc option to disable that specific warning. [originally from svn r6458]
2005-09-29Remove the error message `no text found in paragraph'. Aaron BrownSimon Tatham
points out that it's perfectly possible to generate an empty paragraph using legal Halibut syntax: a paragraph containing nothing but a \#{...} comment will do the job, and is quite likely to happen if you've commented out a load of Halibut code. Therefore, an empty paragraph is now silently ignored rather than being an error condition in itself; if you create an empty paragraph due to it containing an unrecognised directive, then you'll get an error for _that_ and only that. [originally from svn r6361]
2005-04-12input.c was capable of generating a paragraph structure with no textSimon Tatham
in it, if the input paragraph contained (say) an unrecognised control command and nothing else. Such paragraphs can confuse back ends later on, so input.c should refrain from generating them. Added a check and a polite error message (just in case the user manages to generate an empty paragraph using otherwise legal syntax). [originally from svn r5629]
2005-01-24`origtext' was not getting set correctly for escaped tokens (\\, \{,Simon Tatham
\}), making it difficult to put CSS fragments in HTML configuration. [originally from svn r5193]
2004-11-17Allow macros to work (a) at the very start of a paragraph, and (b)Simon Tatham
across files (defining a macro in one source file and invoking it in a later one). [originally from svn r4803]
2004-08-20Forgot to set a file position on characters being returned fromSimon Tatham
macro expansions. [originally from svn r4489]
2004-07-16Right; I'm finally sick of typing \q{\cw{foo}}, so I've invented aSimon Tatham
shorthand command \cq{foo}. [originally from svn r4327]
2004-06-27Sort out error handling everywhere a charset name is converted intoSimon Tatham
an integer charset ID. [originally from svn r4317]
2004-06-12Enforce that \q may not be used anywhere within \c. It shouldn't beSimon Tatham
necessary since the whole point of \c should be that the user wants to exercise exact control over the glyphs used, and forbidding it has the useful effect of relieving some backends of having to make difficult decisions: it means the text backend doesn't have to nest two pairs of identical quotes, and the paper backends don't have to downgrade their quote characters if (as is perfectly plausible) the fixed-pitch font doesn't support the same range as the body text fonts. [originally from svn r4277]
2004-06-12Switch the memory allocation macros from the Halibut onesSimon Tatham
(mknew/mknewa/resize) to the PuTTY ones (snew/snewn/sresize). snewn and mknewa have their arguments opposite ways round; this may make the change initially painful but in the long term will free me of a nasty context switch every time I move between codebases. Also sresize takes an explicit type operand which is used to cast the return value from realloc, thus enforcing that it must be correct, and arranging that if anyone tries to compile Halibut with a C++ compiler there should be a lot less pain. [originally from svn r4276]
2004-04-23Enhance the text backend to support configurable quote characters,Simon Tatham
configurable emphasis characters, various other configurable bits which have been marked FIXME in the code for a while, and also to warn when a code paragraph line is too long (because that was the only other thing labelled FIXME). Fallback options are implemented, and defaults set accordingly. A UTF-8 text output file now looks like proper UTF-8. [originally from svn r4128]
2004-04-20Infrastructure changes for character set support. ustrtoa,Simon Tatham
ustrfroma, utoa_dup and ufroma_dup now take a charset parameter, and also have a variety of subtly distinct forms. Also, when a \cfg directive is seen in the input file, the precise octet strings for each parameter are kept in their original form as well as being translated into Unicode, so that when they represent filenames they can be used verbatim. [originally from svn r4097]
2004-04-19Support for \cfg{input-charset}. Input files can now be in ASCII,Simon Tatham
8859-*, UTF-8, or a variety of more fun encodings including various multibyte ones. [originally from svn r4095]
2004-04-15Support the \W{...}\i\c{...} combination used in the NASM manual.Simon Tatham
Halibut is now capable of reading the old NASM manual with only minor modifications, and probably doing a much better job of formatting it than rdsrc.pl ever did. (Certainly much _faster_!) [originally from svn r4081]
2004-04-10Info backend now takes care to avoid magic characters in node namesSimon Tatham
and index terms (the Info format doesn't like them). In the course of this I've had to introduce some infrastructure for carrying a filepos forward from the definition of every RHS index term so that a particular backend can provide a usefully localised report of which index term had a problem. [originally from svn r4051]
2004-03-30\lcont and \quote were being confused by whitespace (in particular,Simon Tatham
a single newline) immediately after their opening brace; this was causing a normal paragraph to be started, thus making it fiddly and annoying to arrange the first paragraph of a \lcont to be a code para or anything else special. Now fixed. [originally from svn r4005]
2004-03-30Make \ii work!Simon Tatham
[originally from svn r4003]
2004-03-25Introduce \. as a NOP command. The purpose of this is to act as aSimon Tatham
zero-width delimiter between a macro invocation and text beyond it, so that you can define (say) a macro which expands to a Euro sign and then write `\eur\.2500' to avoid having space between the Euro sign and the number. [originally from svn r3982]
2004-03-25Obsoleted the `\preamble' command. Preamble text is now taken to beSimon Tatham
any ordinary displayable paragraph(s) appearing before the first chapter heading, meaning in particular that you can put lists, code paragraphs etc in preambles. Of course, `\preamble' is still supported for backwards compatibility, but it's now a zero-effect paragraph marker. [originally from svn r3981]
2004-03-25Add a \quote{...} directive, working like <blockquote> in HTML.Simon Tatham
[originally from svn r3978]
2004-03-24Cleanups to complete the man page backend. Also, an additional newSimon Tatham
markup feature: a \c line in a code paragraph can now be followed by an optional \e line indicating emphasised bits of its preceding \c. This allows discretionary bolding and (italic/underline) emphasis within code paragraphs, but without introducing an escape character or breaking any existing input files. Users are warned that not all backends are required to actually render these hints, and so they should avoid depending on them 100% to convey semantic information unless they know they're writing for a restricted range of backends. [originally from svn r3965]
2004-03-23Man-page back end for Halibut. Also, a couple of additional markupSimon Tatham
features commonly used in man pages: (a) the ability to nest paragraph breaks, code paragraphs and other lists inside list items, and (b) description lists as normally used in man pages to describe command-line options. [originally from svn r3954]
2002-08-23Just had a play with this newfangled `valgrind' memory debuggerSimon Tatham
thingy, which seems moderately cool and has reported a few very small memory leaks. Now apparently fixed. [originally from svn r1863]
2002-08-12Arrange for multiple \cfg, \IM and \BR paragraphs to not requireSimon Tatham
blank-line separators (config directives visually _want_ to be in a single chunk). [originally from svn r1837]
2002-08-05Rename Buttress to Halibut. I _think_ I've caught everything in this pass.Simon Tatham
[originally from svn r1800]
2001-12-14Buttress was dealing poorly with \r in input files (though not _too_Simon Tatham
poorly; mostly it just treated \r as whitespace, and the only time it actually suffered was at the end of a line in a code paragraph). Should now be fixed. [originally from svn r1492]
2001-12-04This update should bring the Windows Help back end up toSimon Tatham
near-complete functionality. All that's missing now is indexing and horizontal rules. [originally from svn r1449]
2001-12-04Replace Buttress's old tree23 routines with my shiny new countedSimon Tatham
tree234 routines; they will be useful in the WinHelp stuff at least. [originally from svn r1444]
2001-10-25Fix segfault on \W{URL}\cw{link text} construction.Simon Tatham
[originally from svn r1321]
2000-11-22Add nonbreaking space as \_Simon Tatham
[originally from svn r810]
1999-11-12Daft error in input.c was causing messy aux fields and misgenerated emphasisSimon Tatham
in text output. Now all aux fields are carefully zeroed when not used [originally from svn r307]
1999-11-07First stab at text backend configurabilitySimon Tatham
[originally from svn r276]
1999-11-07Configurability backbone, and first use of itSimon Tatham
[originally from svn r275]
1999-11-07Added \q{...} for quoted textSimon Tatham
[originally from svn r274]
1999-10-24Macros; \- for nonbreaking hyphenSimon Tatham
[originally from svn r252]
1999-10-22Fix a couple of segfaults in error handling codeSimon Tatham
[originally from svn r250]