X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fdata-io%2Ffile-handle.q;h=5f2a44075a78835d36afe933184cb7e4bf6c6ec9;hb=48e0129f54424a6fd5fb1bc7651e48dedc5293c2;hp=33aa1d168a5c4efce423688b3d8998193b8c7abc;hpb=cb586666724d5fcbdb658ce471b85484f0a7babe;p=pspp diff --git a/src/language/data-io/file-handle.q b/src/language/data-io/file-handle.q index 33aa1d168a..5f2a44075a 100644 --- a/src/language/data-io/file-handle.q +++ b/src/language/data-io/file-handle.q @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,13 +15,13 @@ along with this program. If not, see . */ #include + #include -#include -#include #include #include #include #include +#include #include #include #include @@ -57,7 +57,7 @@ cmd_file_handle (struct lexer *lexer, struct dataset *ds) if (!lex_force_id (lexer)) return CMD_CASCADING_FAILURE; - str_copy_trunc (handle_name, sizeof handle_name, lex_tokid (lexer)); + str_copy_trunc (handle_name, sizeof handle_name, lex_tokcstr (lexer)); handle = fh_from_id (handle_name); if (handle != NULL) @@ -69,7 +69,7 @@ cmd_file_handle (struct lexer *lexer, struct dataset *ds) } lex_get (lexer); - if (!lex_force_match (lexer, '/')) + if (!lex_force_match (lexer, T_SLASH)) return CMD_CASCADING_FAILURE; if (!parse_file_handle (lexer, ds, &cmd, NULL)) @@ -159,7 +159,7 @@ cmd_close_file_handle (struct lexer *lexer, struct dataset *ds UNUSED) if (!lex_force_id (lexer)) return CMD_CASCADING_FAILURE; - handle = fh_from_id (lex_tokid (lexer)); + handle = fh_from_id (lex_tokcstr (lexer)); if (handle == NULL) return CMD_CASCADING_FAILURE; @@ -200,7 +200,7 @@ fh_parse (struct lexer *lexer, enum fh_referent referent_mask) handle = fh_inline_file (); else { - if (lex_token (lexer) != T_ID && lex_token (lexer) != T_STRING) + if (lex_token (lexer) != T_ID && !lex_is_string (lexer)) { lex_error (lexer, _("expecting a file name or handle name")); return NULL; @@ -208,14 +208,15 @@ fh_parse (struct lexer *lexer, enum fh_referent referent_mask) handle = NULL; if (lex_token (lexer) == T_ID) - handle = fh_from_id (lex_tokid (lexer)); + handle = fh_from_id (lex_tokcstr (lexer)); if (handle == NULL) { - if (lex_token (lexer) != T_ID || lex_tokid (lexer)[0] != '#' || settings_get_syntax () != ENHANCED) - handle = fh_create_file (NULL, ds_cstr (lex_tokstr (lexer)), + if (lex_token (lexer) != T_ID || lex_tokcstr (lexer)[0] != '#' + || settings_get_syntax () != ENHANCED) + handle = fh_create_file (NULL, lex_tokcstr (lexer), fh_default_properties ()); else - handle = fh_create_scratch (lex_tokid (lexer)); + handle = fh_create_scratch (lex_tokcstr (lexer)); } lex_get (lexer); }